i am trying to send video over ethernet using the tms320dm6437 dvdp from board to the PC.
For capturing and encoding the video i have used video_encdec.pjt(from dvsdk) and for ethernet emac.pjt given by TI.
I send the h.264 encoded video buffer to the following code
"iCount" is the no. of packets which varies with each frame size.
The packet_data[0] to packet_data[15] is the header part
*************************************************
for (i=0 ; i<iCount; i++)///// { ptr = & packet_data[16]; memcpy(ptr, encoded1 + TX_SIZE * i,TX_SIZE); pDesc = pDescBase + 1; pDesc->pNext = 0;//////// pDesc->pBuffer = packet_data; pDesc->BufOffLen = 1514; pDesc->PktFlgLen = EMAC_DSC_FLAG_OWNER | EMAC_DSC_FLAG_SOP | EMAC_DSC_FLAG_EOP | 1514;
pDescTx = pDescBase + 1; EMAC_TX0HDP = ( Uint32 )pDescTx;
/* Busy period */ _wait( 10000 );
/* Manually check ISR, if using interrupts this will be done automatically */ EMAC_isr( );}
**********************************************
But for each frame i am getting the same data in every packet and this data corresponds to the data of the last packet of previous frame. So for the first frame i get the data which was present previously (i.e. before running) in the "packet_data".
Same thing happens for raw data also...
Thankyou in advance
Rutcha,
I assume that you are trying to transmit TX_SIZE bytes of data, but the packet descriptors are telling EMAC to transmit 1514 bytes. Is TX_SIZE equal to 1514?
-Michael
----------------------------------------------------------------------------------------------------------Please click the Verify Answer button on this post if it answers your question.----------------------------------------------------------------------------------------------------------
hi....
no TX_SIZE = 1498 i.e. 1514-16 bytes of header. so each packet contains 1498 bytes of data.
The packet size that you program into the descriptors should include some header-type data bytes like DST ADDR, SRC ADDR, and LEN. Please ensure that this is handled in the program. You can see a figure of the frame in Section 2.4.1 of the EMAC user guide (spru941a).
Do you have a simple application that is able to transmit EMAC packets in a way that matches your expectations? We can use that as a starting point to isolate the problem.
-Mike
yes I have included the dst and src addresses in header and I have tested the simple application to send ethernet packets :
#include "emac.h"
#define TX_BUF 1514//////#define RX_BUF 1536
Uint8 packet_data[TX_BUF];void* ptr;//////Uint8 packet_buffer1[RX_BUF];Uint8 packet_buffer2[RX_BUF];Uint8 packet_buffer3[RX_BUF];Uint8 packet_buffer4[RX_BUF];Uint8 packet_buffer5[RX_BUF];Uint8 packet_buffer6[RX_BUF];Uint8 packet_buffer7[RX_BUF];Uint8 packet_buffer8[RX_BUF];Uint8 packet_buffer9[RX_BUF];Uint8 packet_buffer10[RX_BUF];
/* * We use pDescBase for a base address. Its easier this way * because we can use indexing off the pointer. */EMAC_Desc* pDescBase = ( EMAC_Desc* )EMAC_RAM_BASE;
/* * The following are used to allow the ISR to communicate with * the application. */extern volatile int RxCount;extern volatile int TxCount;extern volatile int ErrCount;extern volatile EMAC_Desc *pDescRx;extern volatile EMAC_Desc *pDescTx;extern Uint8* dest;Int16 verify_packet( EMAC_Desc* pDesc, Uint32 size, Uint32 flagCRC );
/* ------------------------------------------------------------------------ * * * * emac_test * * EMAC tests to send data to external loopback cable. * * * * ------------------------------------------------------------------------ */Int16 emac_test( ){ Int32 i; Int16 errors = 0; Uint32 status;
Int32 emac_timeout = 0x100000; Int32 timeout; EMAC_Desc* pDesc; dest = (void*)dest; //one frame data
/* ---------------------------------------------------------------- * * * * Setup EMAC * * * * ---------------------------------------------------------------- */ emac_init( );* ---------------------------------------------------------------- * * * * Setup TX packets * * Send 2 copies of the same packet using different sizes * * * * ---------------------------------------------------------------- */ packet_data[0]=0x00;// packet_data[1]=0x11;// packet_data[2]=0x2F;// packet_data[3]=0xF4; packet_data[4]=0x6F; packet_data[5]=0x28; packet_data[6]=0x00; packet_data[7]=0x0E; packet_data[8]=0x99; packet_data[9]=0x02; packet_data[10]=0x99; packet_data[11]=0x3C; packet_data[12]=0x08; packet_data[13]=0x09; packet_data[14]=0x00; packet_data[15]=0x00; // for ( i = 12 ; i < TX_BUF ; i++ ) //////////////// // packet_data[i] = i; for (i=0 ; i<553; i++)/////{
ptr = & packet_data[16]; memcpy(ptr, dest+1498 * i,1498); pDesc = pDescBase + 10; pDesc->pNext = 0;//////// pDesc->pBuffer = packet_data; pDesc->BufOffLen = 1514; pDesc->PktFlgLen = EMAC_DSC_FLAG_OWNER | EMAC_DSC_FLAG_SOP | EMAC_DSC_FLAG_EOP | 1514;
/* * Start TX sending */ pDescTx = pDescBase + 10; EMAC_TX0HDP = ( Uint32 )pDescTx;
/* ---------------------------------------------------------------- * * * * Normally there would be a interrupt to service the EMAC RX/TX * * transmission. Instead a short pause and manually call the ISR * * Interrupt Service Routine to check on the status. * * * * You can later add in the ISR and the code to support. * * * * ---------------------------------------------------------------- */
Thanks Rutcha. The example really helps me put your code snippet into context.
Are you receiving the correct number of packets?
Instead of the _wait() statement, can you try a while loop to poll for any of the following: a) while( pDesc->PktFlgLen | EMAC_DSC_FLAG_OWNER ); b) while( EMAC_TX0CP != (Uint32) pDescTx ); /* EMAC_TX0CP should be zero before the packet is transmitted */ c) tmpInt = EMAC_TXGOODFRAMES; while( EMAC_TXGOODFRAMES == tmpInt );