Hey All,
I’ve got an issue with a remote deployed boron system running OS 4.0.1 (Australian Ag-Tech level remote), where the Boron seems to enter some sort of dead-lock condition. The Cyan LED stops breathing, and just locks at a solid intensity, and everything just goes completely unresponsive.
Since the lock-up seems to be pretty low level, I don’t trust the OS-level watchdog, since it looks like the OS-level stuff is also getting locked out if the status LED stops breathing. For better reliability I’m trying to make use of the On-board watchdog in the NRF with the following method:
/**
* @brief Arm the NRF internal watchdog timer with the specified timeout.
*
* @param timeout Desired timeout value in seconds used to calculate the setting for the CRV register - defaults to 10 minutes
* @param kickRegCount Number of kick registers to activate - defaults to 1.
*
* From the moment this function is called, it is required that all of the armed WDT registers get poked throught the kickNordicWatchdog function or
* a hardware reset will be generated.
*
* The CRV value is calculated according to the following formula.
* timeout [s] = ( CRV + 1 ) / 32768
* CRV = (WTD_TIME * 32768) - 1
*/
void armNordicWatchdog(unsigned int timeout, unsigned int kickRegCount){
uint32_t crv_target_value = (timeout * 32768) - 1;
uint32_t kick_reg_mask = (0x01 << (kickRegCount+1)) - 1; // This will generate a bitmask with 1's in the lowest order bits
NRF_WDT->CONFIG = 0x09; // Configure WDT to run when CPU is asleep, and when 'debugger paused' as-well
Log.trace("Arming WDT - Timeout 0x%x", crv_target_value);
NRF_WDT->CRV = crv_target_value;
NRF_WDT->RREN = kick_reg_mask; // Enable the RR[0] reload register
NRF_WDT->TASKS_START = 1; // Start WDT
}
I’m trying to test this, by running this method in my setup()
call, and then just going into my usual behaviour and waiting for the watchdog reset to happen. The problem is that I’m just not seeing the watchdog reset at all. Is there something I’m missing here?
As an aside, It’s on a long timeout (10 minutes), and it’s getting kicked every time through loop()
, so it won’t interfere with cloud firmware updates.
Does anyone know about a conflict here? I can’t find anything in the docs that specifically say I’m not allowed to play with this module.