Sidk
Sidk

Reputation: 11

Microcontroller hangs with LWIP UDP

I am using LWIP TCP/IP Stack on SAME70 without RTOS. Microcontroller hangs and stops responding after few seconds.

  1. it stops sending data over serial
  2. I echo UDP data back to the client for testing, but I do not receive that echo packet on the client side
  3. Also when I ping from client PC, the request is timed out.

Following is my while loop.

` while (1)  {

    ethernet_task();
    //********* WRITE PACKET BYTES
    memcpy(&value_f, data_rx+4, 4);
    value_w=(uint16_t)(value_f/0.01);
    buffer[2]= (uint8_t)value_w;
    buffer[3]= (uint8_t)(value_w>>8);


    memcpy(&value_w, data_rx+8, 2);
    value_w=(uint16_t)((value_w-65288)%65536);
    buffer[4]= (uint8_t)value_w;
    buffer[5]= (uint8_t)(value_w>>8);
    
    memcpy(&value_f, data_rx+10, 4);
    value_w=(int16_t)((value_f-32)/0.018);
    buffer[8]= (uint8_t)value_w;
    buffer[9]= (uint8_t)(value_w>>8);
    
    tx_buffer();    //Transmits buffer on serial    
}`

If I leave only ethernet_task(); in While loop UDP Echo and Ping work fine. I want to execute calculations and serial transmission in While loop without losing UDP response.

Upvotes: 0

Views: 135

Answers (0)

Related Questions