Part Number: MSP432P401R
Hello! I'm trying to make a sleep routine using Timer32 on a MSP-EXP432P401R Rev. 1.0 board (DriverLib - v4_00_00_11). This is the code I'm using:
void Timer32_sleep_cycles(uint32_t cycles) { /* Configuring Timer32 to "uint32_t cycles" cycles of MCLK in periodic mode */ MAP_Timer32_initModule(TIMER32_0_BASE, TIMER32_PRESCALER_1, TIMER32_32BIT, TIMER32_PERIODIC_MODE); MAP_Interrupt_enableInterrupt(INT_T32_INTC); MAP_Timer32_setCount(TIMER32_0_BASE, cycles); MAP_Timer32_enableInterrupt(TIMER32_0_BASE); MAP_Timer32_startTimer(TIMER32_0_BASE, true); MAP_Interrupt_enableSleepOnIsrExit(); MAP_Interrupt_enableMaster(); MAP_PCM_gotoLPM0InterruptSafe(); MAP_Interrupt_enableMaster(); } void T32_INTC_IRQHandler(void) { Timer32_clearInterruptFlag(TIMER32_0_BASE); MAP_Interrupt_disableSleepOnIsrExit(); }
The function works if I use MAP_PCM_gotoLPM0(), but if I use the interrupt safe version, the program hangs in Default_Handler(void).
Why is this happening and, most importantly, how can it be resolved?