cancel
Showing results for 
Search instead for 
Did you mean: 

Stm32f407-lwip send UDP packet larger than MTU size

mohamad_armoon
Associate III
Posted on November 19, 2017 at 13:50

 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

#raw-lwip #udp #etherent #lwip* #stme32-cube
1 REPLY 1
Posted on November 20, 2017 at 10:34

You may want to ask general lwip questions in

https://lists.nongnu.org/mailman/listinfo/lwip-users

 

JW