Crash in sd_clock_hfclk_is_running on Soft Device S140, 7.3.0

Hi, I recently noticed crashing in sd_clock_hfclk_is_running() on a nrf52840 using SoftDevice S140 7.3.0. This is the callstack:

??@0x00000ac4 (Unknown Source:0)

<signal handler called>@0xffffffe9 (Unknown Source:0)

sd_clock_hfclk_is_running@0x000276ae (.../nRF5_SDK_17.1.0_ddde560/components/softdevice/s140/headers/nrf_soc.h:720)

I'm using the following to enable the hfclk whenever I enable QSPI to avoid errata 244:

sd_clock_hfclk_request();
uint32_t isHfclkRunning = 0;
do {
  APP_ERROR_CHECK(sd_clock_hfclk_is_running(&isHfclkRunning));
} while (!isHfclkRunning);
I can trigger this somewhat reliably if I unplug and plug usb power while this code triggers.
Any tips on how I can avoid this issue?
Thanks,
Jeff
Parents Reply
  • The exact operations performed by this function will vary depending on your implementation, but usually it reads certain hardware registers related to the HFCLK in order to get it's current state. It can also check whether the HFCLK source is a crystal oscillator or a synthesized clock. In case you do not call this function, it can results in various problems, say, certain peripherals that depend on the HFCLK may not function properly (like the BLE radio). It can result in timing issues too since the operations that rely on accurate timings will be affected. Also, if the HFCLK is running unnecessarily, tis will in turn increase your power consumption and reduce the efficiency of your device. Moreover, certain operations which expect HFCLK to be available and running, in case they do not get this message, can affect the stability of your system.

    -Priyanka

Children
Related