This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Any way to put system into "OFF" state in hard fault handler with SD enabled?

Long title, but basically sums it up - is there any way to put the nRF51 into the off state from within the hard-fault handler if the soft-device was enabled prior to the fault? The complication is that the soft-device seems to protect the NRF_POWER peripheral, and when you're inside the hard-fault handler, you can't use sd_power_system_off() nor can you just access NRF_POWER->SYSTEMOFF. So it seems I'm somewhat stuck.

Any ideas on how I might be able to get around this?

The goal is to put the system into the off state to disable the WDT, in case it was running - I don't want the actual WDT reset to occur since technically, it's not guaranteed to preserve RAM through the reset (many of the other reset sources preserve RAM, but for whatever reason, the WDT does not). I've observed that RAM is usually preserved, but since it's not in the datasheet, I don't want to rely on it.

Thanks!

Parents
  • For better or worse, the WDT stays active through system resets - only power-on, pin, and wake-from-off will reset/disable the WDT. So unfortunately, NVIC_SystemReset() won't help on its own. I'm experimenting with doing a system reset and then putting the system to sleep on startup if the WDT was running... but it's not ideal yet. But it may wind up doing what I need it to do.

Reply
  • For better or worse, the WDT stays active through system resets - only power-on, pin, and wake-from-off will reset/disable the WDT. So unfortunately, NVIC_SystemReset() won't help on its own. I'm experimenting with doing a system reset and then putting the system to sleep on startup if the WDT was running... but it's not ideal yet. But it may wind up doing what I need it to do.

Children
No Data
Related