AnsweredAssumed Answered

Ethernet TX - functional just with delay?!

Question asked by Michl on Mar 23, 2010
Latest reply on Apr 14, 2010 by JiangW

Hey guys,

I'm trying to set up and initiate a raw ethernet communication. At the moment i try to set up the TX but there is some strange behaviour.

I'm using the Power-on-self-test-routines from the ethernet_test.c. I'm not transmitting continously but four messages.

 

for( ib = 0; ib < NO_TX_BUFS; ib++ )
    {
        txbuf = Ethernet_Setup_TxBuffer(TXFRM_SIZE,0x0A);
        if( NULL == txbuf )
        {    // memory allocation failed
        }
       
        if (txfst==NULL)
            txfst = txbuf;
        if (txlst != NULL)
        {
            txlst->pNext = txbuf;                            // chain this buffer on
            txlst->Dma[1].NEXT_DESC_PTR = &txbuf->Dma[0];    // chain the descriptors
            txlst->Dma[1].CONFIG.b_NDSIZE = 5;                // five elements
            txlst->Dma[1].CONFIG.b_FLOW   = 7;
            txlst->Dma[1].CONFIG.b_DI_EN  = 1;                // large descriptors
        }
        txlst = txbuf;
    }

   
    // start the TX DMA channel before enabling the MAC
    txbuf = txfst;
    Ethernet_Poll_EMAC_Busy();
   
   
    if (txfst != NULL)
    {
        *pDMA2_NEXT_DESC_PTR = &txfst->Dma[0];
        *pDMA2_CONFIG =  *((u16*)&txfst->Dma[0].CONFIG);
    }

 

//    while (i < 0x7FFFFFF) {i++;}

 

    Ethernet_Poll_EMAC_Busy();
   
    // finally enable sending/receiving at the mac
    *pEMAC_OPMODE = (TE /*| RE*/ | FDMODE);

 

As you can see, i changed some function names, but the action behind it is still the same.

Now here's the problem:

 

When I'm using the delay (while (i < 0x7FFFFFF) {i++;}), the four messages are transmitted and I can see them with Wireshark.

When not, the messages are not transmitted.

Must there be some delay between setting up the first descriptor and initiate the EMAC to transmit?

 

And: I want an interrupt after every status descriptor event, so i set the (txlst->Dma[1].CONFIG.b_DI_EN  = 1;) but there's just one single interrupt at the end of the whole four messages....

 

Thanks so far.

 

 

In addition, the TX_STAT of every frame is 0x00400043, so the transmit is OK and COMPLETE....

Does anyone have an idea?

Outcomes