This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP432 Exiting Low Power mode

Hi,

I am trying to write a modified I2C protocol using the eUSCI module B on the MSP432P401R.  My problem is that I don't know how to accomplish the same goal as the line 

__bic_SR_register_on_exit(CPUOFF); in the MSP430

In order to exit sleep mode.  I could find no documentation explained how this is done, though I found some obscure code that did this:

SCB_SCR &= ~SCB_SCR_SLEEPONEXIT;

But this does not appear to work correctly, since there are multiple ISR's running simultaneously, some of which wake up the device and some of which do not.  

If anyone knows of a solution, thanks.

  • Hello Broderick,

    If you are using the MSP432 driverlib then you can use the function Interrupt_disableSleepOnIsrExit();. SCB_SCR &= ~SCB_SCR_SLEEPONEXIT; is also the correct line to wake up on exit from ISR, I believe your confusion comes from an I2C code example where multiple eUSCI I2C flags are handled differently in the same ISR.

    Regards,
    Ryan
  • I'm confused about this as well.  Most of my designs have multiple ISRs, some of which should wake up the CPU when they exit, some of which should not.  On the MSP430 this was easily accomplished by going to sleep in the main program, and at the end of any ISR that SHOULD wake up the CPU, you'd add a call to "__bic_SR_register_on_exit(LPM0_bits)".  This meant that if this ISR fired while the CPU was asleep, it would wake it up, and any OTHER ISRs that did not have this call would simply leave the CPU alone (it would stay awake if already awake, or stay asleep if already asleep).

    How would you accomplish this on the MSP432?  All I can seem to find is this global SCB_SCR_SLEEPONEXIT flag, which if I'm understanding things correctly is just an all-or-nothing sledge hammer.  Either every ISR will wake the CPU back up when they exit or none of them will.

  • In each ISR you could handle the SCB_SCR_SLEEPONEXIT flag accordingly to determine whether that particular ISR woke the CPU upon exiting or not. So in similar fashion you could always keep it set and then clear the flag inside an ISR in which the CPU must be woken up afterwards.

    Regards,
    Ryan
  • Nice, that is a good way to do it.  Though it seems that you would need to conditionally set or clear the flag in all ISRs so that one does not interfere with the others.  Or, if the program structure allows it, you could always set the flag before entering sleep mode.  

    I now realize that that is just a restatement of what Ryan said.  Thanks!

  • I have disabled sleep_on_ISR exit, but still the code in the while loop seems to be not working. It is not blinking the RED LED in the main(). I was not able to figure it out. Any suggestions?

**Attention** This is a public forum