How to check rtc oscillator is running?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to check rtc oscillator is running?

1,950 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tkggitfk24 on Thu May 12 19:55:38 MST 2016
Hello Everyone,

I'm getting crazy about RTC, if the rtc oscillator is not populated or broken, my whole system will be corrupted. This is not acceptable for us.

and I know write the rtc and Alarm timer registers without the 32 kHz clock can stall the CPU from the LPC4357 User Manual. So the key point is how to check rtc oscillator is running?

The User Manual says that,


Quote:

To confirm that the 32 kHz clock is running, read the Alarm timer counter register (DOWNCOUNTER, see Table 866), which counts down from a preset value using the 1024 Hz signal derived from the 32 kHz oscillator.



I think it is NOT feasibility.The  DOWNCOUNTER and PRESET  are zero after reset.

The following is what I tested:

1.
void Chip_Clock_RTCEnable(void)
{
LPC43XX_CREG->CREG0 &= ~((1 << 3) | (1 << 2));/* Reset 32Khz oscillator */
LPC43XX_CREG->CREG0 |= (1 << 1) | (1 << 0);/* Enable 32 kHz & 1 kHz on osc32k and release reset */
}

after invoking this function, the system corrupted without RTC oscillator

2. Writing DOWNCOUNTER and PRESET registers of Alarm timer, just one time, the system corrupted




Does anyone have any idea or suggestion? I would really appreciate it.


Thank you!
Leo
Labels (1)
0 Kudos
5 Replies

1,719 Views
lpcware
NXP Employee
NXP Employee
bump
0 Kudos

1,719 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bavarian on Mon May 23 02:32:32 MST 2016
Well, if you have a simple oscilloscope you can see the 32.768kHz on the CLKOUT pin.
If you want to make a functional test in production you could connect CLKOUT to another input like a timer capture and get the feedback.

This RTC oscillator circuit has been designed for very low power, so it is sensitive with regards to board design and any impact from the outside (crosstalk etc).
You need to find a setup (crystal selection + board design) which works 100%  under your environment conditions, especially temperature.

Regards,
NXP Support Team
0 Kudos

1,719 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tkggitfk24 on Mon May 16 18:32:23 MST 2016

Quote: mc
Hi Leo,
You can send 32KHZ RTC clock to CLKOUT pin and check the frequency. Check Table 147 in the below UM
http://www.nxp.com/documents/user_manual/UM10503.pdf




You mean connect the CKOUT to a timer capture input and check the frequency.
0 Kudos

1,719 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Mon May 16 09:29:00 MST 2016
Hi Leo,
You can send 32KHZ RTC oscillator clock to CLKOUT pin and check the frequency. Check Table 147 in the below UM
http://www.nxp.com/documents/user_manual/UM10503.pdf
0 Kudos

1,556 Views
brich
Contributor III

This is an unacceptable answer in my mind.  It appears the LPC43XX RTC peripheral has a "chicken and egg" problem because there is no way to know if the RTC is running without reading a register (which is explicitly unapproved by the manual if it is not initialized first), and always initializing the RTC at every powerup resets the 32KHz oscillator, and the tick counter (inside of Chip_RTC_Init()), which causes the RTC to drift in the best case, and most likely even resets the date and time counters in the worst case.  This makes the RTC peripheral basically useless!  Isn't there some register that we CAN read to know whether or not the RTC is even running?  We have traced a possible powerup issue that many of our units have in the field to this peripheral malfunctioning and either making the unit act like it does not want to power on (processor stalled when reading registers after unit left on shelf for a while and RTC battery drained), or long powerup delays, in excess of 20 seconds while the user is fumbling with the power to get the unit to do anything.

We are not looking for a solution with an oscilloscope.  We need a solution to detect whether or not the RTC is running, and NOT have the CPU stall when it checks registers of an uninitialized RTC.  We also cannot initialize the RTC at every powerup, as that would erase or corrupt the date and time.  A solution with reading the REGFILE has been proposed, but those registers are in the RTC domain, and reading them without initializing the RTC first MAY cause the processor to stall! 

What say you, NXP?  

0 Kudos