Hi,
I would like to exit low power mode inside a function call in interrupt.
Here is what I tried so far,
int main(void) // <--- Same for all code
{
// Stop watchdog timer (prevent timeout reset)
WDTCTL = WDTPW | WDTHOLD;
// Some initialization code for DMA, ADC and UART that works so far
while (1)
{
__bis_SR_register(LPM0_bits + GIE);
// I want the program counter to come here after low power mode exit
__no_operation();
}
}
// DMA Interrupt Handler
#pragma vector=DMA_VECTOR
__interrupt void dmaInterruptHandler(void) // <--- This way, interrupt handler works and low power mode exists
{
// Toggle Led
P4OUT ^= BIT0;
__bic_SR_register_on_exit(LPM0_bits); // <--- This works here
}
Above interrupt code works just fine. But when I tried to call a function inside the DMA interrupt handler
// DMA Interrupt Handler
#pragma vector=DMA_VECTOR
__interrupt void dmaInterruptHandler(void) // Does NOT work
{
_adcDmaInterruptHandler(); // Function Call
__bic_SR_register_on_exit(LPM0_bits); // <--- This does NOT work and program counter stuck
}
#pragma FUNC_ALWAYS_INLINE(_adcDmaInterruptHandler) // <--- Always inline pragma did not help
__interrupt void _adcDmaInterruptHandler() // __interrupt keyword did not help
{
// Toggle Led
P4OUT ^= BIT0;
}
What I actually want is
// DMA Interrupt Handler
#pragma vector=DMA_VECTOR
__interrupt void dmaInterruptHandler(void)
{
_adcDmaInterruptHandler(); // Function Call
}
#pragma FUNC_ALWAYS_INLINE(_adcDmaInterruptHandler) // <--- Always inline pragma did not help
__interrupt void _adcDmaInterruptHandler() // __interrupt keyword did not help
{
// Toggle Led
P4OUT ^= BIT0;
__bic_SR_register_on_exit(LPM0_bits); // <--- This does NOT work either and program counter stuck as well
}
So Is there any workaround for calling low power mode exit inside a function call in an interrupt call ?
Thank you,