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.

RTOS/PROCESSOR-SDK-AM437X: Data abort exception in EMAC driver

Part Number: PROCESSOR-SDK-AM437X
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

My aplication raises an E_dataAbort exception at line 391 of function EMAC_rxPacket of "ti\pdk_am437x_1_0_10\packages\ti\drv\emac\src\v4\emac_drv_v4.c"

#391 -> memcpy((void *)p_cslPkt_desc, (void *)p_new_pkt_desc, sizeof(EMAC_PKT_DESC_T));

E_dataAbort exception on EmacPollPkt task.

Exception occurred in ThreadType_Task.
Task handle: 0x800e30e8.
Task stack base: 0x800e3138.
Task stack size: 0x800.
R0 = 0x8004ee1c  R8  = 0x80183d80
R1 = 0x0000005c  R9  = 0x8003e6a0
R2 = 0x00000000  R10 = 0x00000000
R3 = 0x000030bc  R11 = 0x800e3874
R4 = 0x800dab44  R12 = 0x00000060
R5 = 0x8017e738  SP(R13) = 0x800e3860
R6 = 0x800dabac  LR(R14) = 0x800390f8
R7 = 0x80183dd0  PC(R15) = 0x80038364
PSR = 0x200001df
DFSR = 0x00000805  IFSR = 0x0000100e
DFAR = 0x00000018  IFAR = 0x6c1bfafc
ti.sysbios.family.arm.exc.Exception: line 205: E_dataAbort: pc = 0x80038364, lr     = 0x800390f8.
xdc.runtime.Error.raise: terminating execution

The problem was observed during the integration tests. It is rare to happen.  The external environment may be creating a situation that spots it.


I´ve made the follwing change in EMAC_rxPacket and the exception stopped happen.

static EMAC_PKT_DESC_T* EMAC_rxPacket(Handle      hApplication, EMAC_PKT_DESC_T*   p_cslPkt_desc)
{
    EMAC_PKT_DESC_T*    p_new_pkt_desc;
    uint32_t from_port = 0U;
// MB: 2018-06-22
#if 0    
    uint32_t bufLen = 0U;
    uint8_t* bufPtr = NULL;
#endif
    
    from_port = ((p_cslPkt_desc->Flags & EMAC_PKT_FLAG_FROM_PORT_MASK) >> EMAC_PKT_FLAG_FROM_PORT_SHIFT) -1U;
    if( from_port < EMAC_NUM_MAX_MAC_PORTS )
    {
        /* Allocate the PKT to replenish the RX_FREE_QUEUE queue first.
          * Only provide packet to the applicaton if EMAC_ALLOC_PKT suceeds, 
          * otherwise re-use the packet descriptor */
        p_new_pkt_desc = EMAC_ALLOC_PKT(from_port, EMAC_PKT_SIZE(from_port));
        if (p_new_pkt_desc != NULL)
        {
            EMAC_RX_PKT(from_port, p_cslPkt_desc);
            memcpy((void *)p_cslPkt_desc, (void *)p_new_pkt_desc, sizeof(EMAC_PKT_DESC_T));
        }
        else
        {
// MB: 2018-06-22
#if 0
            bufLen = p_cslPkt_desc->BufferLen;
            bufPtr = p_cslPkt_desc->pDataBuffer;
            memset(p_cslPkt_desc, 0, sizeof(EMAC_PKT_DESC_T));
            p_cslPkt_desc->BufferLen = bufLen;
            p_cslPkt_desc->pDataBuffer = bufPtr;
            p_cslPkt_desc->AppPrivate = ( uint32_t)p_cslPkt_desc;
#endif
            gRxDropCounter++;
        }
    }
    return p_cslPkt_desc;

}


My test application is attached. The PDK is 1.0.10.

Regards,
Marcio.

0624.ced2_net_test-20180706.zip

  • The RTOS team have been notified. They will respond here.
  • Marcio,

    This seems to be the same project as you attached in e2e.ti.com/.../2605930
    In which test case the crash happens? Do you continuously send UDP packets or ping the other PC?

    Regards,
    Garrett
  • Hi Garrett,

    Yes, it is the same project. My intention was to show you how my application configure and use the NDK.

    On our integration test environment, 2 identical boards exchange UDP packets at 10ms (100Mbps/full-duplex), and each one exchange UDP packets with a PC. I have not determined yet what is triggering the problem.

    The E_dataAbort exception stops happening when I took that piece of code out. But I can see that gRxDropCounter goes to 1 or 2 after hours running.

    Why EMAC_ALLOC_PKT would not succeed to allocate a packet? Maybe the application is to busy to consume the buffers and return then to the system. However, when EMAC_ALLOC_PKT fails, why removing that piece of code would make the E_dataAbort exceptions stop? Is it a bug?

    Regards,
    Marcio.