Hello! I'm interfacing a MSP432 microcontroller with a WIZ550S2E serial to Ethernet converter via UART. My program works in interrupts and communicates with a TCP server (Hercules) using 16 byte messages. When a message is received, the ISR wakes up the MCU which then interprets the message and sends a response (ex: receives HELLO and responds with ACK - 16 byte coded messages).
The problem is that sometimes (after a number 10-20 (sometimes fewer) HELLO messages sent from the server) the MCU does not respond. I can confirm that the message is received as I have visualized it using a logic analyzer and that the message is stored in the RX buffer when the MCU does not respond.
I can see that the message is stored in the RX buffer because I pause the program execution after I see that the MCU does not respond and check the RX buffer contents.
I interpret this situation like the MCU is not executing the code after the message is received or it is not woken up from sleep. This is my interrupt code:
void EUSCIA0_IRQHandler(void)
{
unsigned int status;
status = MAP_SPI_getEnabledInterruptStatus(EUSCI_A0_BASE);
MAP_SPI_clearInterruptFlag(EUSCI_A0_BASE, status);
if (extension1_spiMode == true)
{
if (status & EUSCI_A_SPI_TRANSMIT_INTERRUPT)
{
extension1SpiTxFlag = true;
MAP_Interrupt_disableSleepOnIsrExit();
return;
}
if (status & EUSCI_A_SPI_RECEIVE_INTERRUPT)
{
extension1SpiRxFlag = true;
MAP_Interrupt_disableSleepOnIsrExit();
return;
}
}
else
{
if (status & EUSCI_A_UART_TRANSMIT_INTERRUPT)
{
extension1UartTxFlag = true;
MAP_Interrupt_disableSleepOnIsrExit();
return;
}
if (status & EUSCI_A_UART_RECEIVE_INTERRUPT)
{
extension1UartRxFlag = true;
if (WIZ550S2E_extension_in_use)
{
//if (extensionManager_rxFinished == false)
//{
extensionManager_rxBuffer[extensionManager_rxBytes] = MAP_UART_receiveData(EUSCI_A0_BASE);
extensionManager_rxBytes++;
if (WIZ550S2E_isInCommandMode == true)
{
if (extensionManager_rxBuffer[extensionManager_rxBytes-1] == extensionManager_rxTerminator) // '\n'
{
extensionManager_rxFinished = true;
MAP_Interrupt_disableSleepOnIsrExit();
return;
}
}
else
{ //"[R,0,16]\r\nabcdefghifdmf\r\n"; 16 bytes message + 10 bytes AT message + \r\n
if (extensionManager_rxBuffer[extensionManager_rxBytes-1] == extensionManager_rxTerminator) // '\n'
{
WIZ550S2E_endLineCount++;
}
if (WIZ550S2E_endLineCount == 2)
{
WIZ550S2E_endLineCount = 0;
extensionManager_rxFinished = true;
}
if (enableAsyncCommands == true && extensionManager_rxFinished == true)
{
commandReceived = true;
MAP_Interrupt_disableSleepOnIsrExit();
return;
}
if (extensionManager_rxFinished == true)
{
MAP_Interrupt_disableSleepOnIsrExit();
return;
}
}
//}
}
}
}
MAP_Interrupt_enableSleepOnIsrExit();
}
I am using SimpleLink SDK 1.50.0.12, CCS 7.2.0, no optimizations.
Does anybody encountered this behaviour? Do you know what causes it and how it can be avoided?
Please let me know if you need additional information.
Thank you,
Cristian