Briefly:
-
Is it possible to switch LFCLKSRC to the internal RC from Xtal with WDT or RTC running? It appears I am only able to do this when Xtal is generating LFCLK correctly.
-
Is it possible to successfully disable softdevice (S110 in this case) when an Xtal generating LFCLK is disconnected?
Detail:
I'm using nrf51822 with a 32.768kHz external oscillator for lowest standby power in a portable device.
A few of these devices have been observed to have the crystal come loose during normal use by the end user.
We are using extra space in flash on nrf51822 to maintain a log file. I would like to maintain the integrity of the log file when possible and also log when the crystal comes loose.
When the crystal is disconnected while HFCLK is running (which has been the case for the end users who've seen symptoms of crystal disconnection), I can detect it with a check I've implemented using a TIMER. After detection, ideally I would save to flash any parts of the log that are still only in RAM along with an entry for crystal disconnection.
Additional constraints are that I have softdevice (S110) enabled and WDT running.
softdevice_handler_sd_disable() does not return when called after Xtal disconnection (returns when Xtal is connected), and I'm only able to switch LFCLKSRC to the RC when the Xtal is running normally (confirmed with LFCLKSTAT), so, so far I've only been able to get what I want logged by making calls directly to NVM with softdevice enabled, which is not ideal (according to Nordic).
Is it possible to disable softdevice when LFCLK is frozen after lost external clock source at runtime?
Is it possible to switch LFCLK over to the RC when LFCLK is frozen after lost external clock source at runtime?