AnsweredAssumed Answered

__WFI() will not sleep even with all interrupts disabled and pending cleared - LPC18XX Series

Question asked by Lane Lutgen on Nov 10, 2018
Latest reply on Nov 14, 2018 by Alexis Andalon

Background: I am trying to make my embedded application go to sleep when there is no CAN activity with the __WFI() and then wake up whenever a CAN interrupt is received. Before enterring sleep mode, I disable all interrupts and clear their pending states in the NVIC registers.

To start, right now I'm just trying to make sure that I can sleep forever when I have all interrupts disabled.

for(int i = 0; i < IRQ_MAX; i++)
{   
    IRQ_ClearPending
((IRQ)i);
    IRQ_Disable((IRQ)i);
}
__DSB();
__ISB();
__WFI();
MCU_Reset();

I checked the NVIC registers, and they are all set to 0, which should mean that all interrupts are disabled and there are no pending interrupts. However, everytime I execture the WFI (Wait for interrupt) instruction, it will just NOP on me.

Why can I not enter sleep mode? Do I actually have to somehow disable all of my peripherals and disable the interrupts at their source or is there a way to just mask all interrupts minus the CAN?

I have tried this with the debugger both connected and disconnected.

Thank you for your time. Let me know if there is anything I can do to clarify the question.

Outcomes