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.

MSP432E401Y: WFI() causes hard fault running lwIP

Part Number: MSP432E401Y

I am using the MSP432E401Y to transmit data from several ADCs to a PC via Ethernet using the lwIP library and no RTOS. The data rate is 1kHz. The ADCs trigger a GPIO interrupt on the MSP432, whose ISR reads the data via SPI then sends the data via a UDP packet.  After the data has been read the MSP432 goes into a software polling loop waiting for a semaphore to be set. The semaphore is set in the ISR. The data collection and transmission process takes less than 250uS, so the MSP432 spends over 75% of the time spinning in the wait loop.

I'd like to put the MSP432 in a low power mode while waiting for the ADC's interrupt.  I'm attempting to use the __WFI() function to put the MSP432 to sleep while it's in the polling loop.

Here is the loop that waits for the ISR semaphore (dataReady) and creates and transmits the UDP packet. If I remove the __WFI(); statement everything runs as expected, but when I add the __WFI() I never see any subsequent Ethernet activity and the GPIO interrupt is never serviced. The "running" semaphore is set by an incoming UDP packet.

    while(running)                               // until the STOP command is received
    {
        while(!dataReady) __WFI();               // wait for valid data in TXbuffer

        dataReady = false;                       // clear the data ready semaphore

        struct pbuf *p = pbuf_alloc(PBUF_TRANSPORT, sizeof(TXbuffer), PBUF_RAM); // allocate a new pbuf for sending the response
        if(p == NULL) { return;}

        memcpy(p->payload, TXbuffer, sizeof(TXbuffer)); // copy the response packet data into the pbuf
        udp_send(pcb, p);                        // send the response
        pbuf_free(p);                            // free the pbuf
    }

When I paused the debugger after the hang condition it was stuck in the Default_Handler() routine. The PSR Exception register indicates a Hard Fault. The NVIC Fault Status indicates a Precise Data Bus Error and the Bus Fault Address Register is valid. The FAULT_ADDR register points to a memory location that is labeled "EMAC0_EMAC_DMARIS", so apparently something is up with the EMAC DMA Interrupt, but I'm not sure what it could be.

The NVIC PEND registers indicate that there is a pending interrupt on GPIO Port N, which is where the ADC ready pin is connected so I believe the NVIC has seen the external interrupt but obviously something is causing a hard fault before it can service the interrupt.

If I set a break point at the "while (running)" statement, and then use F8 to cycle through the loop with CCS, I don't see the fault and I collect data as expected. As soon as I remove the break point a hard fault is generated.

How do I go about finding the cause of the EMAC DMA Receive Interrupt fault?

**Attention** This is a public forum