Part Number: AM2732
Hello experts!
We found a weird problem while developing a UDP client: packet corruption while sending lots of data in a row.
I have replicated this issue by slightly modifying the enet_cpsw_udpclient example from the mcuplus sdk.
The most important piece of code is inside app_udpclient.c and inside the function AppSocket_simpleClient.
CacheP_wbInv(snd_buf, sizeof(snd_buf), CacheP_TYPE_ALLD);
ret = lwip_sendto(sock, snd_buf, sizeof(snd_buf), 0,
pAddr, sizeof(*pAddr));
// NOTE: THIS FIXES THE PROBLEM
// ClockP_usleep(10 * 1000);
By uncommenting that sleep, the code produces the expected behaviour, which is sending UDP packets of 1024 bytes each with alternating patterns (once 0xAA and then 0xBB).
If I don't have a sleep, packets get corrupted such that the pattern is no longer alternating each packet, and there are instead chains of packets with the same pattern.
Attached you can find:
- project sources
- wireshark capture of code without sleep
- wireshark capture of code with sleep
Thanks in advance
enet_cpsw_udpclient_am273x-evm_r5fss0-0_freertos_ti-arm-clang.zip
wireshark_captures.zip