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

Is SD with WDT IRQ set to priority-zero a problem?

The basic question is: if I initialize the SD and then forcibly change the priority of the WDT IRQ to zero via NVIC_EnableIRQ(), will that cause a problem?

I know you don't normally want to do anything which might preempt the SD's radio handler... but since the WDT IRQ should really only fire just before the system goes down anyhow, is there any reason it can't be set to priority-zero? I've tried setting it to zero before initializing the SD, and when you try to initialize the SD, it throws the "NRF_ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION" error, which would normally make sense, but like I suggest - the WDT isn't going to be firing under any normal circumstances, so does that really matter?

This is with S110v8 and the v10 SDK.

  • According to the softdevice specification you cannot use priority 0 for application interrupts. That said, I think the WDT interrupt should be an exception to this rule. When you get WDT interrupt, the only possibility is the WDT timeout. So when you get this interrupt, your chip will reset within 2 lfclk cycles. Since the BLE connection will be lost anyways, I think it is safe to imagine that the softdevice assert is of no worry.

    So the conclusion is that you can set WDT interrupt to priority 0 after you have enabled the softdevice. Since it will check the priority of app interrupts when you enable softdevice and it would return with error if it finds illegal interrupt priorities, you should always set WDT priority to zero after softdevice is enabled.

  • Yes... the goal of setting the WDT to priority-zero is exactly that: maximize the amount of time I have during the 2 LFCLK cycles before the system resets in order to clean things up as best I can. I just wanted to make sure there wasn't a hidden reason that I shouldn't do it.

Related