I am using the BOOSTXL-playback as a reference for running an audio detection code on the MSP430FR5994. The MSP used is external and is successfully detected by the launchpad. In the code, I use a switch-case structure to move between the 'DEFAULT' and 'RECORD' modes as available in the BOOSTXL-example. The code for my execution is as follows:
void runApplication(void) { while(1) { P5IE &= ~BIT7; // Disable interrupt on P5.7 // vm1010 P5IE &= ~BIT6; // Disable interrupt on P5.6 P5IE &= ~BIT5; // Disable interrupt on P5.5 switch(applicationMode) { case RECORD: { ............... ............... break; default: break; } } // Toggle app mode applicationMode = DEFAULT; P6OUT &= ~BIT1; // vm1010 // Set a Switch debounce to 500ms __delay_cycles(0.01 * __SYSTEM_FREQUENCY_MHZ__); P5IFG &= ~BIT6; // Clear interrupt on P5.6 P5IE |= BIT6; // Enable interrupt on P5.6 P5IFG &= ~BIT5; // Clear interrupt on P5.5 P5IE |= BIT5; // Enable interrupt on P5.5 P5IFG &= ~BIT7; // Clear interrupt on P5.7 // vm1010 P5IE |= BIT7; // Enable interrupt on P5.7 // vm1010 // vm1010 mode pin, o/p, high for WoS mode P6OUT |= BIT1; // vm1010 __bis_SR_register(LPM4_bits + GIE); int16_t spectrum[SIGNAL_ROWS1][SIGNAL_COLS1]; if(FFT_data[1] != 0) { .............. .............. }
After uploading the code on the external MSP, when I tried to run this code - the program fails to exit the LPM4 while checking the 'DEFAULT' case of the application. I am aware that this happens due to the ISR being used in this case as it uses the push-button functionality to exit the mode. The code for the ISR is as follows:
#pragma vector=PORT5_VECTOR __interrupt void port5IsrHandler(void) { switch (__even_in_range(P5IV, P5IV_P5IFG7)) { case P5IV_NONE: break; case P5IV_P5IFG0: break; case P5IV_P5IFG1: break; case P5IV_P5IFG2: break; case P5IV_P5IFG3: break; case P5IV_P5IFG4: break; case P5IV_P5IFG5: break; case P5IV_P5IFG6: // Toggle record mode applicationMode = RECORD; //exit LPM mode on exit __bic_SR_register_on_exit(LPM4_bits+GIE); break; case P5IV_P5IFG7: // Toggle record mode applicationMode = RECORD; //exit LPM mode on exit __bic_SR_register_on_exit(LPM4_bits+GIE); break; default: break; } }
However, the external circuit I am using has no push-button available on it and thus, I need to exit the LPM4 directly to enable the recording of audio data after the initial checks performed by the MSP430. I am evaluating the entire application using the in-built debugger and in the current scenario - using the Push Button after entering the LPM4 allows the MSP to check the 'if' condition and then enter the 'RECORD' mode.
While I found various articles describing the possibility of using interrupts to exit the LPM, I am not sure how I can make it work in my case as I don't want to change the structure of the entire code for a single step in the execution. I have also tried the possiblity of using a different ISR but this doesn't work as the push-button functionality is still involved in the execution.
Please let me know if any other information is necessary and I will get back at the earliest.