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

sd_power_system_off return 2

Hey guys,

I'm working with a nordic nrf5182 and s130. What I need is to put the system in sleep mode after a reset. The main problem is with function sd_power_system_off that return 2, maybe NRF_ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED? A fast work around is to move the function after ble_stack_init(); but I'd like to know more and avoid a spike consumption in some circumstance, as you know ble_stack_init() switch to external oscillator(in my case) and starts the radio module. I think the problem is related to the nvic sub system not yet initialized when main starts, but i'm quite sure you already know the reason and the right workaround. Of course sd_power_system_off doesn't work either in debug session and non.

My thought is to rewrite sd_power_system_off, set nvic priority interrupt for sensing pin and call _WFI/WFE as for all cortex but I prefer to read your ideas about.

Thanks

Parents
  • The error is NRF_ERROR_SOFTDEVICE_NOT_ENABLED which also has the value 2. You can't call sd_* functions until you enable the softdevice. That's why it works if you put the function after the ble stack enable code.

    If you don't want to enable the softdevice because you don't want to incur any power usage, just write the POWER->SYSTEMOFF register with the POWER_SYSTEMOFF_SYSTEMOFF_Enter value directly.

Reply
  • The error is NRF_ERROR_SOFTDEVICE_NOT_ENABLED which also has the value 2. You can't call sd_* functions until you enable the softdevice. That's why it works if you put the function after the ble stack enable code.

    If you don't want to enable the softdevice because you don't want to incur any power usage, just write the POWER->SYSTEMOFF register with the POWER_SYSTEMOFF_SYSTEMOFF_Enter value directly.

Children
Related