Re: nRF52832 hardware cycle count freezing at chip start

Carles Cufi

Hi Thiago,

-----Original Message-----
Subject: [Zephyr-users] nRF52832 hardware cycle count freezing at chip

Hi everyone,

We've been having some strange problem lately. When nRF52832 powers up,
our code starts running, but the hardware cycle count (calling
k_cycle_get_32(), for example) remains static at zero for some time (one
to two minutes).
Therefore, when we call k_sleep or k_busy_wait, the code stops there and
hangs in the k_busy_wait while loop, as the hardware cycle count is not
After a while, the chip restarts by itself (watchdog wasn't configured
by this point), and this second time the code runs normally.

To debug this problem, we added a printk inside k_busy_wait's while
loop: printk("%d %d %d\n", start_cycles, current_cycles,
cycles_to_wait); Adding this printk lead us to the evidence above:
1) that the hardware cycle count is not running the first time;
2) that, after a restart (by whom?), the hardware cycle count is normal
and the code runs just fine.

The serial output and modified k_busy_wait code is here:
The first line of the chip's output is "[exati-watchdog] [DBG]
watchdog_init: [34m-------------=============Watchdog thread scheduled
The code hangs just after "Protocol initialized.", where we call

Can somebody shed some light on this problem? My teammate and I have
been struggling with it for the last couple days, but no progress so
Interesting, we haven't heard of this problem before, although there have been some issues with the nRF5x timer driver that we thought we had addressed.

So can you please expand on the following basic info before I try to reproduce:

1) Are you using the latest master or an older release?
2) What board are you building for does it have a 32Khz crystal, and do you enable the 32KHz timer in your .config?
3) Are you enabling TICKLESS_IDLE or TICKLESS_KERNEL? In fact, could you provide your .config file?
4) When did this problem appear if you're using master? There was a commit merged recently that added TICKLESS_KERNEL support for the nrf RTC driver, I wonder if it broke then.



Join to automatically receive all group messages.