SDK 5.0.x usage for external 32kHz clock (NOT XTAL)

5 posts / 0 new
Last post
CD
Offline
Last seen:3 years 11 months ago
加入:2015-11-18 02:51
SDK 5.0.x usage for external 32kHz clock (NOT XTAL)

Hi,

Please let me ask the question regarding the usage of SDK for external 32kHz clock source use case.

I use DA14583 and cooperative MCU which has 32kHz XTAL and I would like to provide 32k clock source from the MCU to DA14583. Regarding to "DA14583" Datasheet, there is the register CLK_32K_REG, and we have to set "1" to XTAL32K_DISABLE_AMPREG bit when we use an external clock on XTAL32Kp port.

On the other hand, in the SDK, system_init() function proceeds some system and peripheral initialization. In this initialization, init_pwr_and_clk_ble() function is called. This function is coded as followings:

if ( arch_clk_is_XTAL32( ) )
{
SetBits16(CLK_32K_REG, XTAL32K_ENABLE, 1); // Enable XTAL32KHz

// Disable XTAL32 amplitude regulation in BOOST mode
if (GetBits16(ANA_STATUS_REG, BOOST_SELECTED) == 0x1)
SetBits16(CLK_32K_REG, XTAL32K_DISABLE_AMPREG, 1); /// Here !!!
else
SetBits16(CLK_32K_REG, XTAL32K_DISABLE_AMPREG, 0); /// Here !!!
SetBits16(CLK_32K_REG, XTAL32K_CUR, 5);
SetBits16(CLK_32K_REG, XTAL32K_RBIAS, 3);
SetBits16(SYS_CTRL_REG, CLK32_SOURCE, 1); // Select XTAL32K as LP clock

}
else if ( arch_clk_is_RCX20( ) )
{
SetBits16(CLK_RCX20K_REG, RCX20K_NTC, 0xB);
SetBits16(CLK_RCX20K_REG, RCX20K_BIAS, 1);
SetBits16 (CLK_RCX20K_REG RCX20K_TRIM 0);
SetBits16(CLK_RCX20K_REG, RCX20K_LOWF, 1);

SetBits16(CLK_RCX20K_REG, RCX20K_ENABLE, 1);

SetBits16(CLK_RCX20K_REG, RCX20K_SELECT, 1);

SetBits16(SYS_CTRL_REG, CLK32_SOURCE, 0);

SetBits16(CLK_32K_REG, XTAL32K_ENABLE, 0); // Disable Xtal32KHz
}
else
ASSERT_WARNING(0);

I use DA14583 as Buck mode, so
SetBits16(CLK_32K_REG, XTAL32K_DISABLE_AMPREG, 0);
is progressed even 32kHz is provided as external clock. (I think - SetBits16(CLK_32K_REG, XTAL32K_DISABLE_AMPREG, 1); - should be executed when an external 32k clock is provided to DA14583. )

My question is how should we modify/use SDK 5.0.x when external 32kHz clock is provided to DA14583? Are there any configuration switch like #define setting????
Are there any other parts that I have to modify when we provide external 32kHz clock? (i.e. sleep and wake up related functions... they seems set 32kHz related parameters...)

If I could get any comments on this, it would be much appreciated.

Thanks for your cooperation in advance.

Best regards,
CD

Device:
MT_dialog
Offline
Last seen:3 months 14 hours ago
Staff
加入:2015-06-08 11:34
Hi CD,

Hi CD,

There is no definition in the SDK when you set your device with an external clock. The external 32.768 KHz signal must be applied to pin Xtal32Kp, the other pin can be left floating. For the level at this pin please check the datasheet. The XTAL32K_DISABLE_AMPREG must be set to '1' when applying an external clock signal either is in buck or boost mode, else the oscillator will not work well.

Thanks MT_dialog

CD
Offline
Last seen:3 years 11 months ago
加入:2015-11-18 02:51
Hi MT_dialog,

Hi MT_dialog,

Thank you very much for your quick reply!

OK, I would like to fix XTAL32K_DISABLE_AMPREG register's value to "1". Is this all that I have to modify the SDK?
Do we need to set this register again after wake up from extended-sleep? (Are all registers categorized as A-ON domain??)

How should I set other registers related CLK_32K_REG?

  • RC32K_TRIM: I think this must be "Don't Care" here...
  • RC32K_ENABLE: Should be handled by SDK.
  • XTAL32K_CUR: Can I set this to minimum value to save power consumption??
  • XTAL32K_RBIAS: Can I set this to minimum value to save power consumption??
  • XTAL32K_ENABLE: Should be handled by SDK.

Sorry for many questions, but if I could get any comments from you, I would appreciate it.
Thanks for your cooperation.

Best regards,
CD

MT_dialog
Offline
Last seen:3 months 14 hours ago
Staff
加入:2015-06-08 11:34
Hi CD,

Hi CD,

The system initialization occurs before the device goes to the while loop, not all the registers are in the A-ON domain but the CLK_32_REG is retainable.

RC32K_TRIM: you dont have to worry about this
RC32K_ENABLE: yes let the SDK handle this
XTAL32K_CUR:XTAL32K_RBIAS: i cant be certain if those bits are going to offer you lower power consumption butsince you are having an external clock source i dont think that they will do you any good, but you can apply and measure.
XTAL32K_ENABLE: since you are using an external source you dont have to enable this, the SDK enables it when the RCX20 is not selected.

Thanks MT_dialog

CD
Offline
Last seen:3 years 11 months ago
加入:2015-11-18 02:51
Hi MT,

Hi MT,

Thank you very much for your comments.

I understand and I'll try it.

Many thanks,
CD

Topic locked