cancel
Showing results for 
Search instead for 
Did you mean: 

Checksum of each IP Header is not calculated after some point (STM32F4, CubeMX, LwIP)

Michael Steinecke
Associate II
Posted on September 23, 2014 at 10:19

Hello Folks,

its me again. I've discovered another strange behavior with a STM32F429ZG custom board in conjunction with LwIP 1.4.1 (and FreeRTOS). Everything goes smoothly for some time, several transfers and so on. But from one point on, the checksum calculation for all outgoing packets fails or is not executed entirely.

In the attached pcap file, I've transferred the same file (~10 MB) from SD-Card several times. Beginning with packet 68320 every outgoing IP Header has a checksum of zero. Eventually every packet gets discarded by PC. Then with packet 68341, the PC sends another command. The MCU tries to ACK it, but still no checksum. Conclusion: checksum on receive either works or ist not checked by MCU.

After the RST from PC, the MCU falls back in auto discovery state. For that, TCP data port 55557 gets closed and a new accept() socket with the same port is initiated.

Now we can see a lot of UDP 55555 and DHCP discovery broadcasts. Each of them with the same problem.

After a reset of the device, everything is working smoothly again.

Checksum calculation is done by HW (SW calculation in LwIP turned off), therefore I would expect another STM bug. Is there something known? Some ideas how to track down this?

PC: 192.168.111.63

MCU: 192.168.111.200

Turn on checksum calculation in Wireshark. (UDP/TCP settings)

http://lwip.100.n7.nabble.com/file/n23334/IP-Header_CRC_not_calculated_one_transfer.pcap

Edit:

The CRC module itself is not activated/used (stm32f4xx_hal_crc.c)

Edit 2:

- Turning on software generated checksums by LwIP eliminates the error. Therefore it is most likely a driver or hardware issue.

- Replaced ambiguous CRC by checksum.

#checksum #stm32f4 #ethernet
3 REPLIES 3
Posted on October 22, 2014 at 16:03

Hi Michael,

Unfortunately, we can't really reproduce your issue. We have tried to transfer files with sizes from 10MB to 30MB without any encountered issues of the ones you're experiencing.

Let me know if this helps or if you have further questions.

Regards,

Heisenberg.

hans2
Associate
Posted on November 17, 2014 at 22:13

Hello,

Any news on this one?

I have the same problem with STM32F427.

Trying to send a 21GB file, trying on 10 different MCU:s

After ~ 150MB to 2GB IP Header checksum becomes 0

UDP also seems to be Zero while TCP still is OK.

After a while TCP becomes corrupt but not 0x0000 as IP and UDP

Reinitialize of MAC and DMA seems to cure the problem.

Enable SW checksum also solves the problem.

Just toggling checksum off/on load doesn't  help.

Got a feeling that TXDMA OSF mode is better, I can't see the fault there (have not test OSF so mush yet).

Regards

Hans

hans2
Associate
Posted on November 17, 2014 at 22:48

Hello again

Sorry for the noise.

I missed that enhanced DMA buffers must be used.

Regards

Hans