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

nRF51422 can not sleep after flash erasing (s310)

I'm using the softdevice S310 on nRF51422 and when the softdevice is enable and I erase flash, the device won't go to sleep.

My code implementation is like as below:

int main(void)
{
  ANT_init(); //into this function softdevice will be enabled

  while(1)
  {
    if(softdevice_is_enable)
       sd_flash_page_erase(PAGE_NUM);
     else
       nrf_nvmc_page_erase(PAGE_START_ADDR);
  
    app_timer_start_and_wakup_callback();
    
   if(softdevice_is_enable)
       sd_app_evt_wait();
   else
   {
       __WFE();
       __SEV();
       __WFE();
   }

  }
}

If the softdevice isn't enabled no problems occours and the program wakeup with the wake-up callback setted, else, if the softdevice is enable the program never go to sleep.

It seems like as an interrupt wake up the device each times after erase flash.

The same during flash write.

How can I put in sleep the device after a flash erase or write?

I saw that if I call 2 times sd_app_event_wait() it works.

Thanks

Related