Hi ,XiangJun Rong
My "glitch" is not a glitch in the clock waveform. It is that I get an abnormal value when I access an out-of-sync register on the bus.
The code is as follows, It gets the register value twice, just like RTC_GetSecondsTimerCount().
static inline uint16_t RTC_GetWakeupCount(RTC_Type *base)
{
uint32_t a, b;
/* Follow the RF document to read the RTC default seconds timer (1HZ) counter value. */
do
{
a = base->WAKE;
b = base->WAKE;
} while (a != b);
return (uint16_t)((b & RTC_WAKE_VAL_MASK) >> RTC_WAKE_VAL_SHIFT);
}
B.R.