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

How to reset main embedded application within nRF52810 without resetting flash or powering off the MCU?

Hi all, the application i'm using nRF52810 for requires that I keep the device powered on all the time. However, in the case of errors (tolerable within my application) I would like the nRF52810 to soft reset itself. This means reset the main() application and restart. I have the default NVIC_SystemReset() call still in app_error_weak.c (nRF SDK V15.2), and I've read that this causes problems with flash memory. It's important that the contents of my flash that I may/may not have written at the time of soft reset remains intact. When the application restarts, the first few lines of code read variables in flash. The whole idea is to maintain state variables across shutdowns or soft resets.

Can anyone advise how to do this? The MCU cannot be fully powered off, not even for 0.0001 miiliseconds. And I need to have any content I've written to flash stay how it is. 

Parents
  • I believe I need to use sd_nvic_systemreset() instead, which I am now trying. I use the soft device s112, my application is constructed on top of the uart example.

  • Hi Noah,

     I do not think that using NVIC_SystemReset() API will cause any flash corrupted for an already written data. However it is good practice to always use SD provided API for restricted peripheral access

  • Okay great, thank you. 

    What is the behavior for GPIO? I control various digital logic blocks with GPIO outputs (HIGH or LOW). Even if sd_nvic_systemreset() is called, I need to ensure that the GPIO levels (for configured pins) do not change even briefly during the reset. I know that if I go to deep sleep and am holding a GPIO at LOW output, it will remain this way in and out of whatever sleep I want to do (besides full shut down of course). Is this the same for nvic_systemreset? 

    I set the pin logic right at the beginning of my main application, so restarting the main application code would not change the pin logic output levels (as they'd just get set to what they were set to already). however, if the GPIO outputs change or become undefined temporarily during the sd_nvic_systemreset, this is bad for my application.

    Can you please share some documentation on to what sd_nvic_systemreset does? What does it mean to "reset" in this fashion, what things are reset and what kind of things happen before the application is restarted?

Reply
  • Okay great, thank you. 

    What is the behavior for GPIO? I control various digital logic blocks with GPIO outputs (HIGH or LOW). Even if sd_nvic_systemreset() is called, I need to ensure that the GPIO levels (for configured pins) do not change even briefly during the reset. I know that if I go to deep sleep and am holding a GPIO at LOW output, it will remain this way in and out of whatever sleep I want to do (besides full shut down of course). Is this the same for nvic_systemreset? 

    I set the pin logic right at the beginning of my main application, so restarting the main application code would not change the pin logic output levels (as they'd just get set to what they were set to already). however, if the GPIO outputs change or become undefined temporarily during the sd_nvic_systemreset, this is bad for my application.

    Can you please share some documentation on to what sd_nvic_systemreset does? What does it mean to "reset" in this fashion, what things are reset and what kind of things happen before the application is restarted?

Children
Related