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.

TMS320C6657: Ethernet Stack Lockup how to disable interrupts via HwiP_disable() in the emacEnqueueTx() function

Part Number: TMS320C6657


Tool/software:

Hi,

We have encountered a similar situation and would like to make such modifications for verification, but we are unsure about the specific steps. We haven't found any interrupt-related operations in the `emacEnqueueTx()` function. Could you please provide us with detailed operational steps? Thank you very much!

  • Hi,

    Can you try the following:

    1. Include the "HWiP.h" header file : #include <ti/osal/HwiP.h>

    2. Modify the code as follows,

    uintptr_t key;
    
    //Disable the interrupt
    key = HwiP_disable();
    
    //Existing Code/Test Code
    
    //Restore the interrupt
    HwiP_restore(key);

    For your reference, suggest you to go through the header file "HwiP.h" located at "pdk_c665x_2_0_16/packages/ti/osal/HwiP.h"

    Best Regards,

    Betsy Varughese

  • Hi,Betsy Varughese

    Thank you very much for your prompt reply. I will verify it as soon as possible and hope it can be effective in my project.

    Best Regards

  • Hi,

    Please check from your end and let me know.

    Regards,

    Betsy Varughese

  • Hi,I am very pleased to share my latest progress with you. Although I did not perform verification according to such modifications, inspired by this solution, we found anomalies when inspecting the NIMU driver code. We use a third-party solution and code, and they added the following code to the NIMU driver code. After our verification, this is the root cause.

    I would like to express my sincere gratitude to you again.

    I also want to remind others who encounter similar problems: first, be sure to use official EVMs and related example routines; second, if you use third-party code, you must compare it with the official code to find differences.

    static EMAC_DRV_ERR_E
    EmacSendPkt
    (
        EMAC_DATA*      ptr_pvt_data
    )
    {
        PBM_Handle hPkt;
        EMAC_DRV_ERR_E emac_send_status;
        register UINT8*     buffer;
        register uint       length;
        EMAC_PKT_DESC_T     pkt_desc;
        EMAC_PKT_QUEUE_T    *pq;
        EMAC_Pkt *pPktHdr;
    
        /* Checking for any queued packets to be transmitted */
    
        /* First check the Raw Packet Tx Queue. If there are any
        * pending packets in this queue, always transmit them
        * first over the IP packets.
        */
        hPkt = PBMQ_deq(&ptr_pvt_data->pdi.PBMQ_rawtx);
    
        /* Check if no raw packet to transmit and if any
        * IP packet to transmit. If no raw or IP packets to
        * transmit, set the "Transmitter Free" TxFree
        * flag for this device to 1.
        */
        if( !hPkt && !(hPkt = PBMQ_deq(&ptr_pvt_data->pdi.PBMQ_tx)) )
        {
            return EMAC_DRV_RESULT_SEND_ERR;
        }
    
        buffer = (Uint8 *)Convert_CoreLocal2GlobalAddr((uint32_t)(PBM_getDataBuffer(hPkt))) + PBM_getDataOffset(hPkt);
        length = PBM_getBufferLen(hPkt);
    
        /* Clean the cache for external addesses */
        if( ((UINT32)buffer & EMAC_EXTMEM) || ((UINT32)buffer & EMAC_MSMCMEM) )
            OEMCacheClean( (void *)buffer, length );
    
        pkt_desc.AppPrivate  = (Uint32)hPkt;
        pkt_desc.pPrev       = NULL;
        pkt_desc.pNext       = NULL;
        pkt_desc.pDataBuffer = (Uint8 *)Convert_CoreLocal2GlobalAddr((uint32_t)(PBM_getDataBuffer(hPkt)));
        pkt_desc.BufferLen   = PBM_getBufferLen(hPkt);
        pkt_desc.Flags       = EMAC_PKT_FLAG_SOP | EMAC_PKT_FLAG_EOP;
        pkt_desc.ValidLen    = PBM_getValidLen(hPkt);
        pkt_desc.DataOffset  = PBM_getDataOffset(hPkt);
        pkt_desc.PktChannel  = coreNum;
        pkt_desc.PktLength   = PBM_getValidLen(hPkt);
        pkt_desc.PktFrags    = 1;
    
        /*This piece of code is both the root cause and the key difference. 
        // while(1) {
        //     pq = (EMAC_PKT_QUEUE_T *)&EMAC_TX_QUEUE(NIMU_PORT_NUM_USED);
        //     pPktHdr = pq->pHead;
        //     if(pPktHdr)
        //         break;
        // }
        
    
        emac_send_status = emac_send(NIMU_PORT_NUM_USED, &pkt_desc);
        return emac_send_status;
    }