This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP432P401R: Microcontroller not executing code?

Part Number: MSP432P401R


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

  • > MAP_Interrupt_enableSleepOnIsrExit();

    I recommend you not do this in the ISR, since it will cause the foreground to freeze, whatever it was doing.

    Even in the foreground, it should be used judiciously.
  • I replaced it with Interrupt_disableSleepOnIsrExit(), but I get the same behavior:

    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;
            }
            if (status & EUSCI_A_SPI_RECEIVE_INTERRUPT)
            {
                extension1SpiRxFlag = true;
            }
        }
        else
        {
            if (status & EUSCI_A_UART_TRANSMIT_INTERRUPT)
            {
                extension1UartTxFlag = true;
            }
            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;
                            }
                        }
                        else
                        { //"[R,0,16]\r\nabcdefghifdmf\r\n"; 16 octeti mesaj + 10 octeti mesaj AT + \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();
    }


    I tried placing MAP_Interrupt_disableSleepOnIsrExit() at the beginning of the ISR and replacing MAP_PCM_gotoLPM0InterruptSafe() with MAP_PCM_gotoLPM0() when going to sleep, but the behavior is the same.

    What am I misunderstanding here?

  • I figured it out! I had a timer activated which triggered sometimes MAP_Interrupt_enableSleepOnIsrExit(). I removed that line and it worked. Thank you for the advice!

**Attention** This is a public forum