ODP: k_sleep causes nRF5340 to reset

Chruściński, Krzysztof

Hi Jason,

I would check two things:
  • if call to k_sleep happens before kernel is ready. You can use k_is_pre_kernel to check that.
  • if your board has LF XTAL (as nrf5340dk) or it must run from LFRC. You can try CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y just to check if it will work then. k_busy_wait is using cpu noping so does not need system clock (used by k_sleep) which is using low frequency clock.

Od: users@... <users@...> w imieniu użytkownika Jason Bens via lists.zephyrproject.org <jason.bens=teufel.de@...>
Wysłane: środa, 3 listopada 2021 12:35
Do: users@... <users@...>
Temat: [Zephyr-users] k_sleep causes nRF5340 to reset



I’m porting some code from an nRF5340 eval board to my own board, and I’ve run into an issue.  While waiting for the net core to boot up, I enter a loop and call k_sleep until an initialization callback returns, before proceeding to the rest of the code.  For some reason, k_sleep is causing the application to reset, but only when building for release.  Debug works perfectly fine.  Replacing k_sleep with k_busy_wait or k_yield also works.  This code was originally built on the zephyr release that ships with nRF Connect SDK 1.6.1, but updating to 1.7.1 doesn’t resolve the issue.


I’m working on creating a minimal project that reproduces this behaviour, but in the meantime, what could I check to troubleshoot this?  Blinky, which also uses k_sleep in main, does not trigger a reset loop.




  • Jason