AnsweredAssumed Answered

Stm32f407-lwip send UDP packet larger than MTU size

Question asked by armoun.mohamad on Nov 19, 2017
Latest reply on Nov 20, 2017 by waclawek.jan

 I created a project by CubeMx and enabled Ethernet in RMII mode plus LWIP.

I am trying to send UDP packet with this code :

 

 

void udpAppi_sendPacket(void)
{

     ip_addr_t     client1IpAddr;
     IP4_ADDR(&client1IpAddr , 192 , 168 ,0,2);
     ethTxBuffer_p = pbuf_alloc(PBUF_RAW_TX , bufferSize , PBUF_RAM);
     memcpy(ethTxBuffer_p ->payload , fakeBuffer ,  bufferSize);
     status = udp_sendto(udpPcb1_p ,ethTxBuffer_p ,&client1IpAddr , 5222);
     pbuf_free(ethTxBuffer_p);

}

 

 

and in the main function :

 

while (1)
  {

      HAL_Delay(100);
      udpAppi_sendPacket();
      ethernetif_input(&gnetif);
      sys_check_timeouts();

  }

 

 

every thing is Ok until packet length is smaller than MTU size which is 1500 byte. when i increased the packet size to 1600 no packet was sent.

then i increased MEM_SIZE from 1600 to 10240 and now i can see the fragmented packets with Wireshark(network sniffer) in my PC but the packets checksum are incorrect, so they will be dropped.

 

is there any parameter that should be changed? i dont think that this is the LWIP 's bug.

i am working on it more than a week.please help me.

any suggestion would be appreciated.

thanks in advance

Outcomes