Hi,
I'm using TI-RTOS on the MSP430. I would like to put my MSP430 in LPM4 mode then using an interrupt to return in normal mode.
To do that I wanted to use the function __bis_SR_register(LPM4_bits) to put my register in LPM4 mode and __bic_SR_register_on_exit(LPM4_bits) to return.
I'am using the HWI module in my configuration file. So the hardware interrupt routine are generated by SYS/BIOS in the HWIfunc.c with the function added in my configuration.
This my code :
Void ti_sysbios_family_msp430_Hwi32_p2(Void)
{
ti_sysbios_BIOS_ThreadType prevThreadType;
UInt swiKey;
/* disable Swi scheduler */
swiKey = ti_sysbios_knl_Swi_disable();
/* set thread type to Hwi */
prevThreadType = ti_sysbios_BIOS_setThreadType(ti_sysbios_BIOS_ThreadType_Hwi);
/* run ISR function */
HWI_IsrPortP4(0);
/* run any posted Swis */
ti_sysbios_knl_Swi_restoreHwi(swiKey);
/* restore thread type */
ti_sysbios_BIOS_setThreadType(prevThreadType);
}
Void HWI_IsrPortP4(Void)
{
__bic_SR_register_on_exit(LPM4_bits);
// Clear the interrupt to avoid another interrupt
GPIO_clearInt(MSP_EXP430FR5969LP_S2);
// Disable the interrupt to avoid the rebond
GPIO_disableInt(MSP_EXP430FR5969LP_S2);
// Send the semaphore to the keyboard task to indicate a push/release on S2
Semaphore_post(SEM_InterruptS2);
}
This create an error because the function __bic_SR_register_on_exit can be call only in interrupt routine...
If I add __interrupt in my declaration (like this __interrupt Void HWI_IsrPortP4(Void)) There is another way?
Can I use the LPM4 mode in debug ?