AnsweredAssumed Answered

FreeRTOS demo for K60 transmitts ethernet frames twice

Question asked by larry ciummo on Jun 10, 2015
Latest reply on Jun 16, 2015 by Richard Barry

I've been using the Ethernet code included in the FreeRTOS V8.1 demo for a while in an application, and the outgoing (from the K60) always get sent out twice.  I've tried fixing the obvious things in the driver, and without the "double transmits", it doesn't work.   We don't use the IP stack - we just send out short custom built Ethernet frames to a Linux machine.

 

Here's the code from the tree.
Thanks

Larry

 

 

 

 

 

 

 

void vEMACWrite(
void )

{

long x;

        /*
       Wait until the second transmission of the last packet has completed. */

for(x = 0; x < emacTX_WAIT_ATTEMPTS; x++ )

{

if(( xTxDescriptors[ 1 ].status & TX_BD_R ) != 0 )

{

/*
Descriptor is still active. */

vTaskDelay(emacTX_WAIT_DELAY_ms );

}

else

{

break;

}

}

 

/*
Is the descriptor free after waiting for it? */

if(( xTxDescriptors[ 1 ].status & TX_BD_R ) != 0 )

{

/*
Something has gone wrong. */

prvResetEverything();

}

 

/*
Setup both descriptors to transmit the frame. */

xTxDescriptors[0 ].data = ( uint8_t * ) __REV( ( unsigned long ) uip_buf );

xTxDescriptors[0 ].length = __REVSH( uip_len );

xTxDescriptors[1 ].data = ( uint8_t * ) __REV( ( unsigned long ) uip_buf );

xTxDescriptors[1 ].length = __REVSH( uip_len );

 

/*
uip_buf is being sent by the Tx descriptor.
Allocate a new buffer

for
use by the stack. */

uip_buf= prvGetNextBuffer();

 

/*
Clear previous settings and go. */

xTxDescriptors[0 ].status |= ( TX_BD_R | TX_BD_L );

xTxDescriptors[1 ].status |= ( TX_BD_R | TX_BD_L );

 

/*
Start the Tx. */

ENET_TDAR= ENET_TDAR_TDAR_MASK;

}

/*-----------------------------------------------------------*/

 

Outcomes