Wrong RTC period unless breakpoint hits during setup

fw1.zip

Hi,

I ran into a problem with nRF52840 based firmware development

I initialize the RTC with

Prescaler = 0

CC[0] = 0x19fd

I tried clock source synthesized from HFCLK and RC oscillator and got the same result (we don't have a LF crystal oscillator)

It should produce a period of 0x19fd/32768 = 203ms but I observe by toggling a pin in the IRQ Handler that the actual period is 112ms

If I breakpoint in my code after initializing the RTC and then let go, I get the right period 203ms

I am currently working on replacing the RTC with Timer for debug

Do you have any errata or known issue regarding RTC setup ?

How can I solve this issue ? I can provide the project if needed

Thanks,

Gabriel

Parents Reply
  • Hi Torbjorn,

    Thanks for your help, I am currently still working on this issue and so far I made this observations 

    1 - If I debug, I get the right period

    2 - I tried to use RTC, Timers and FreeRTOS software timers and I always get the same wrong period when not debugging

    3 - I also tried changing GCC optimization flags with no luck

    I am working on creating a DK version of our firmware so you guys can reproduce this issue

Children
  • Hi Gabriel

    Do you happen to have RTT logging enabled? 

    If yes, could you try to disable it (or switch to UART logging) and see if the problem persists? 

    As soon as you have been able to reproduce it on a DK please let me know, and I will try to reproduce it here. I can make the case private in case you don't want to share your firmware in a public case. 

    Best regards
    Torbjørn

Related