Glitch in RTC high-resolution/wake-up timer

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Glitch in RTC high-resolution/wake-up timer

ソリューションへジャンプ
1,123件の閲覧回数
yo_ku_
Contributor II

I am developing LPC540xxx project that uses the RTC high-resolution/wake-up timer (1kHz) as a tick.

This program often shows an abnormal value in the wake-up register. I found a description of another 1Hz RTC counter register having a glitch. There is no description about glitches in the 1kHz register, but I put the same deglitch code in RTC_GetWakeupCount() of the fsl_rtc driver as in RTC_GetSecondsTimerCount(), and it seems to work.


It seems that RTC_GetWakeupCount() needs to be modified.

0 件の賞賛
返信
1 解決策
1,099件の閲覧回数
yo_ku_
Contributor II

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. 

 

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
1,117件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Yosuke,

As far as I know that the 1KHz RTC high resolution RTC counter driving clock  is an internal clock signal, there is not any external pad, how did you  deglitch the 1kHz signal?

Can you share the code of RTC_GetWakeupCount()  api function so that we can have a review?

Thanks

BR

XiangJun Rong

0 件の賞賛
返信
1,100件の閲覧回数
yo_ku_
Contributor II

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. 

 

0 件の賞賛
返信
1,083件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Yosuke,

As you know that reading the base->WAKE; register is faster than counting the base->WAKE; register, so it is difficult to meet the condition while (a != b);

Hope it can help you

BR

XiangJun Rong

0 件の賞賛
返信