AnsweredAssumed Answered

Ethernet frame transmission

Question asked by Trilok JT on May 2, 2016
Latest reply on Aug 26, 2016 by Norberto Jiménez

Hi, Everyone

 

I'm trying to transmit frame on Ethernet, I made internal loop back, but i'm unable to transmit the frame. I  tested both interrupt and polling. None of them worked. I'm attaching file please have a look at it and tell me whats the problem is?

Processor : MK60N512

Here is the BIT test code

uint8_tPerformBIT_EthernetTest(void)

{

LDD_ETH_TBufferDesc BufferDescListPtr[2];
uint8*  BufferListPtr[2];
uint8 tx_buf[120],rx_buf[120];
uint8_t dummy[100],  Status = 0;
int i;
uint8_t temp[] = {"\n\r\v 3. Testing Ethernet.."};
uint8_t ErrorMsg[] = {"\n\n\r\t Ethernet Test Failed"};
uint32 *reg_ptr1,reg_value1;
BufferDescListPtr[0].DataPtr = tx_buf;
BufferDescListPtr[0].Size = 100;
BufferListPtr[0] = rx_buf;

 

  TxStr(temp);

 

 

 

tx_buf[0]=0xff;  // broad cast frame address = ff:ff:ff:ff:ff:ff
tx_buf[1]=0xff;
tx_buf[2]=0xff;
tx_buf[3]=0xff;
tx_buf[4]=0xff;
tx_buf[5]=0xff;

 

 

tx_buf[6]=0x00;
tx_buf[7]=0x01;
tx_buf[8]=0x02;
tx_buf[9]=0x03;
tx_buf[10]=0x04;
tx_buf[11]=0x05;
for (i=12;i<100;i++) tx_buf[i]=0x55;     // fill data area with 0x55

  for (i=12;i<100;i++)  rx_buf[i]=0xaa;     // fill data area with 0xaa

Status=1;

ENET_PDD_EnableInternalLoopback(ENET_BASE_PTR, PDD_ENABLE);

 

ETH1_ReceiveFrame(eth_handler,  BufferListPtr,  1);

eth_rx_set =0;

ETH1_SendFrame(eth_handler, BufferDescListPtr, 1);

   eth_tx_set = 0;

 

 

 

for (i=0;i<100;i++)
{
Delay(1000);
  if(eth_tx_set)
break;
}

 

 

for (i=0;i<100;i++)
{
Delay(1000);
   if(eth_rx_set)
break;
}
if (eth_tx_set && eth_rx_set )
{
Status=0;
  for(i=12;i<90;i++)  // compare recived data

        {

                if (tx_buf[i] != rx_buf[i])
              {
                  Status=0;

                   break;

              }
             

        }

 

}
else
{
Status = 1;
TxStr(ErrorMsg);
}
return Status;

Original Attachment has been moved to: ETH.c.zip

Original Attachment has been moved to: ENET_PDD.h.zip

Outcomes