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.

TM4C1294 launchpad and Ethernet EMAC_INT_TRANSMIT interrupt source

Hello,

I currently wrote an application that relies on the EMAC_INT_TRANSMIT source of the EMACIntStatus register to perform. Unfortunately, I cannot get the interrupt to hit. I am guessing this is because I am fairly new to the ethernet controller, so I am hoping it is something foolish. None of the examples I have looked over seem to pay any attention to this interrupt source. 

In my TxDescriptor.ui32CtrlStatus, I set the DES0_TX_CTRL_INTERRUPT bit. 

I call this in the init portio. I added a bunch of other interrupts just to see what else was getting thrown.

MAP_EMACIntEnable(EMAC0_BASE, (EMAC_INT_RECEIVE | EMAC_INT_TRANSMIT | EMAC_INT_BUS_ERROR | EMAC_INT_TX_NO_BUFFER | EMAC_INT_TX_STOPPED));

I know the ethernet interrupt is occurring because the EMAC_INT_RECEIVE interrupt does hit. Before actually transmitting I also get the EMAC_TX_NO_BUFFER interrupt. I think that would be expected....

Any other areas that need to be setup in order to use this interrupt source?

Thanks

  • I routinely get a EMAC_TX_NO_BUFFER interrupt after calling EMACTxDMAPollDemand. Is that expected? I cannot find any documentation on that interrupt as to what exactly it is signaling. It sounds like an error.
  • The descriptor's DES0_TX_CTRL_OWN bit is also not being cleared by hardware indicating a successful transmission.
  • Hello Jeff,

    Are you developing a new ethernet stack?

    Regards
    Amit
  • Hi Amit,

    Absolutely not. I am trying to tie into as much useful code as I can. I am running FreeRTOS. I need tcp sockets so I am attempting to port over the FreeRTOS TCP/ip stack. They have posted this porting guide:

    www.freertos.org/.../Embedded_Ethernet_Porting.html

    I am attempting to write the xNetworkInterfaceOutput() function. I have tried both a zero copy and full copy approach. I can't seem to setup my ethernet descriptors correctly.

    I used a lot of the setup from the enet_uip example. Plugging in the buffer, and data length passed down from the FreeRTOS stack. Nothing I have tried seems to want to let me transmit.
  • This is what I have so far: I have tried both the copy and pointer route to no avail. 

    BaseType_t xNetworkInterfaceOutput( xNetworkBufferDescriptor_t * const pxDescriptor, BaseType_t bReleaseAfterSend )
    {
    BaseType_t xReturn = pdPASS;
    UINT32 i = 0;

    //
    // Wait for the previous packet to be transmitted.
    //
    while(TxDescriptor[currentTxDescriptor].ui32CtrlStatus &
    DES0_TX_CTRL_OWN)
    {
    //
    // Spin and waste time.
    //
    }

    currentTxDescriptor++;

    if(currentTxDescriptor >= NUMBER_TX_DESCRIPTORS){
    currentTxDescriptor = 0;
    }


    // for(i=0;i<pxDescriptor->xDataLength;i++){
    // TxBuffer[i] = *(pxDescriptor->pucEthernetBuffer + i);
    // }

    //memcpy((void *)TxBuffer, pxDescriptor->pucEthernetBuffer, pxDescriptor->xDataLength);

    //
    // Fill in the packet size and tell the transmitter to start work.
    //
    TxDescriptor[currentTxDescriptor].ui32Count = (uint32_t)pxDescriptor->xDataLength;
    TxDescriptor[currentTxDescriptor].pvBuffer1 = pxDescriptor->pucEthernetBuffer;
    //TxDescriptor[currentTxDescriptor].pvBuffer1 = TxBuffer;

    TxDescriptor[currentTxDescriptor].ui32CtrlStatus =
    (DES0_TX_CTRL_LAST_SEG | DES0_TX_CTRL_FIRST_SEG |
    DES0_TX_CTRL_INTERRUPT | DES0_TX_CTRL_IP_ALL_CKHSUMS |
    DES0_TX_CTRL_CHAINED | DES0_TX_CTRL_OWN);

    //
    // Tell the DMA to reacquire the descriptor now that we've filled it in.
    //

    MAP_EMACTxDMAPollDemand(EMAC0_BASE);
    // EMACTxDMAPollDemand(EMAC0_BASE);    //try non rom version
    while(xSemaphoreTake(TX_InterruptSem, (TickType_t) 5))     //portMAX_DELAY))
    {

    } //spin until the interrupt has signaled transmission was good

    if(bReleaseAfterSend != pdFALSE){
    pxDescriptor->pucEthernetBuffer = NULL;
    vReleaseNetworkBufferAndDescriptor( pxDescriptor );
    }

    return xReturn;
    }

  • Hello Jeff

    I have assigned your forum post to our Ethernet expert

    Regards
    Amit
  • Hi Amit,

    Thank you. Will they be reaching out to me on here or via email? Is there anything else they are going to need to diagnose my technical issue?

    Thanks
  • Hello Jeff,

    Are you referring to the lwIP port for TM4C129 MCU, inside TivaWare? The following files should be relevant to initializing and setting up the Transmit and Receive functions:

    • "./utils/lwiplib.c",
    • "./utils/lwiplib.h",
    • "./third_party/lwip-1.4.1/ports/tiva-tm4c129/netif/tiva-tm4c129.c"

    The hardware initialization is done in the functions:

    • "lwIPInit" (in lwiplib.c) and
    • "tivaif_hwinit" (in tiva-tm4c129.c).

    The interrupt handler is called "tivaif_interrupt" (in file tiva-tm4c129.c).

    Also, when posting code on the forum please use "Use rich formatting" and then click on the Syntaxhighlighter (with the icon Insert code using Syntaxhighlighter) . This makes the code easier to read and review, which results in faster response.

    Thanks,

    Sai

  • Hi Sai,

    I am attempting to move away from the lwip. I need tcp socket support which I was told in another post is not supported in the lwip port for the tiva products. Because of that, I want to use the ip stack from freertos, which does have socket support.

    My limited understanding of ethernet is that I the hardware interface level should be fairly uniform across the various offerings. The projects like the lwip and enet_uip should setup and interface to the mac and phy on the tiva chip fairly similarly. The layer I am attempting to write is passing buffers, it doesn't care what it says. That't left to higher level software, I believe. Maybe I am completely off my rocker, this is all very new to me.

    I will look at those files. I am not familiar with them. I expect they should be similar to the enet_uip project I ported most of the code from.
  • Hello Jeff,

    "enet_uip" is an application that uses lwIP. So underlying, it uses the files I mentioned. Although it does not hurt, you don't have to look at "enet_uip" for porting to a new TCP/IP stack, the files I mentioned should give a good idea of what is required to be set-up the hardware and how to transmit and receive packets.

    Thanks,
    Sai