Mk60 Ethernet(UDP )

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Mk60 Ethernet(UDP )

1,196 Views
trilokjt
Contributor III

Hi,

 

I'm newbie to the embedded systems, working on MK60. Learning things by doing small small modules, learned few things(Serial Communication,Timers..)  and right now I'm doing UDP internal loop back test, but I'm facing very difficulty to understand. I looked into all SDK demo apps but i'm not able to understand. Please help out. I wanna learn.

 

I took some code from seniors in that one i'm trying to understand small portion and trying to implement the same on board. But in that code some system generated code is missing so I'm unable to build and run the same, I missing the flow to understand. Please can you tell me how to find quick solution for that and proceed.

 

Missing files : ENET_PDD.h

                       UART_PDD.h

Actually code has written in Code Warrior IDE, I'm copying the required modules and doing on Keil IDE I have played with UART, and timers in keil and now i'm focusing on Ethernet Part. 1st thing I not understood how to get Phy address of the device so i'm unable to proceed.

 

Please help me how to learn things quicker and proceed further,

 

Thank you

Trilok

Labels (1)
0 Kudos
Reply
4 Replies

949 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Trilok,

If you want to develop an Ethernet application you need a TCP/IP stack. Doing an application without one would be really complicated.

I recommend 2 options

1) MQX RTOS with RTCS library. Attached you can find simple client server TCP examples with documentation.

2) KSDK2.0 with lwIP support. Here you can find TCP and UDP echo examples and others. The path where you would find the examples may look like this: <KSDK installation path>F\boards\<board>\demo_apps\lwip

You can refer to following document to get started with KSDK2.0

Using Kinetis Design Studio v3.x with Kinetis SDK v2.0


Regards,
Carlos

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

949 Views
trilokjt
Contributor III

Hi Carlos,

I found TCP/IP stack attached the same to my project. I'm trying to do internal loop back test on Ethernet but it is not working, please can you guide/tell what is the problem. I stuck on that part so can't move further to proceed with my project. Please help me out

Thanks/Regards

Trilok

0 Kudos
Reply

949 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Trilok,

I cannot know the problem if I dont see the project. What TCP/IP stack are you using?

Carlos

0 Kudos
Reply

949 Views
trilokjt
Contributor III

Here is my code for Internal loop back test. I used ENET_PDD.h for physical driver functions and definitions. Prior to this test I read PHY Address and set MAC address. Please let me know whats going wrong with code flow and help me in sorting out the problem. I tried attaching the whole project but, I'm unable to attach.

uint8_t PerformBIT_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);

      do

     {

   Status = ETH1_ReceiveFrame(eth_handler,  BufferListPtr,  1);

     }  while(Status != ERR_OK);

     eth_rx_set =0;

    do

     {

        ETH1_SendFrame(eth_handler, BufferDescListPtr, 1);

    }  while(Status != ERR_OK);

   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;

}

0 Kudos
Reply