I have a project where I need the board to decode json data from a tcp socket.
The code works, however, I get an unacceptable amount of TCP retransmissions.
(my PC is .250, the board is .7, connected through a switch here on my desk. The issue still occurs if I am connected directly to the board, through a MDI or MXI-X cable)
Additionally, if I ping my board through windows, Windows only recognizes ~25% of the replies. Linux is better at approx 75% (or 25% packet loss).
I have been unable to track down this issue.
Here is the compilation script (for the configuration macros that aren't in the header files)
arm-none-eabi-c++ -std=c++23 -DCPU_MIMXRT1024DAG5A -DETH_RX_TASK_PRIO=8 -DCACHE_DISABLE -DBECK_BOARD_REVISION_MAJOR=2 -DFSL_OSA_ALLOCATED_HEAP=0 -DCPU_MIMXRT1024DAG5A_cm7 -DDEBUG_CONSOLE_TRANSFER_NON_BLOCKING -DHAL_UART_TRANSFER_MODE=1 -DENET_ENHANCEDBUFFERDESCRIPTOR_MODE -DARDUINOJSON_ENABLE_STD_STREAM=0 -DFSL_SDK_ENABLE_DRIVER_CACHE_CONTROL -DPING_USE_SOCKETS -DSDK_DEBUGCONSOLE_UART -DSKIP_SYSCLK_INIT -DUTASKER_LOADER -DFSL_FEATURE_PHYKSZ8081_USE_RMII50M_MODE -DSDK_USE_RTOS=1 -DSERIAL_PORT_TYPE_UART=1 -DSDK_DEBUGCONSOLE=1 -D__MCUXPRESSO -D__USE_CMSIS -DDEBUG -D__NEWLIB__ -DSDK_OS_FREE_RTOS -DUSE_RTOS -DLWIP_DISABLE_PBUF_POOL_SIZE_SANITY_CHECKS=1 -I"C:\Users\gavund\Documents\Work\mcux-workspace1\BA-5533-Software\drivers" -I"C:\Users\gavund\Documents\Work\mcux-workspace1\BA-5533-Software\device" -I"C:\Users\gavund\Documents\Work\mcux-workspace1\BA-5533-Software\CMSIS" -I"C:\Users\gavund\Documents\Work\mcux-workspace1\BA-5533-Software\component\serial_manager" -I"C:\Users\gavund\Documents\Work\mcux-workspace1\BA-5533-Software\component\uart" -I"C:\Users\gavund\Documents\Work\mcux-workspace1\BA-5533-Software\utilities" -I"C:\Users\gavund\Documents\Work\mcux-workspace1\BA-5533-Software\component\lists" -I"C:\Users\gavund\Documents\Work\mcux-workspace1\BA-5533-Software\component\phy" -I"C:\Users\gavund\Documents\Work\mcux-workspace1\BA-5533-Software\freertos\freertos-kernel\include" -I"C:\Users\gavund\Documents\Work\mcux-workspace1\BA-5533-Software\freertos\freertos-kernel\portable\GCC\ARM_CM4F" -I"C:\Users\gavund\Documents\Work\mcux-workspace1\BA-5533-Software\source" -I"C:\Users\gavund\Documents\Work\mcux-workspace1\BA-5533-Software\drivers\freertos" -I"C:\Users\gavund\Documents\Work\mcux-workspace1\BA-5533-Software\board" -I"C:\Users\gavund\Documents\Work\mcux-workspace1\BA-5533-Software\lwip\port" -I"C:\Users\gavund\Documents\Work\mcux-workspace1\BA-5533-Software\lwip\src" -I"C:\Users\gavund\Documents\Work\mcux-workspace1\BA-5533-Software\lwip\src\include" -I"C:\Users\gavund\Documents\Work\mcux-workspace1\BA-5533-Software\component\silicon_id" -I"C:\Users\gavund\Documents\Work\mcux-workspace1\BA-5533-Software\CMSIS_driver\Include" -I"C:\Users\gavund\Documents\Work\mcux-workspace1\BA-5533-Software\nor_flash" -I"C:\Users\gavund\Documents\Work\mcux-workspace1\BA-5533-Software\lwip\contrib\apps\ping" -I"C:\Users\gavund\Documents\Work\mcux-workspace1\BA-5533-Software\component\osa" -I"C:\Users\gavund\Documents\Work\mcux-workspace1\BA-5533-Software\usb\host\class" -I"C:\Users\gavund\Documents\Work\mcux-workspace1\BA-5533-Software\lwip\template" -I"C:\Users\gavund\Documents\Work\mcux-workspace1\BA-5533-Software\usb\host" -I"C:\Users\gavund\Documents\Work\mcux-workspace1\BA-5533-Software\usb\phy" -I"C:\Users\gavund\Documents\Work\mcux-workspace1\BA-5533-Software\usb\include" -I"C:\Users\gavund\Documents\Work\mcux-workspace1\BA-5533-Software\source\generated" -O0 -fno-common -g3 -gdwarf-4 -Wall -c -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -fno-rtti -fno-exceptions -Wno-unknown-pragmas -fmerge-constants -fmacro-prefix-map="../source/Hardware/"= -mcpu=cortex-m7 -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mthumb -D__NEWLIB__ -fstack-usage -MMD -MP -MF"source/Hardware/HardwareMisc.d" -MT"source/Hardware/HardwareMisc.o" -MT"source/Hardware/HardwareMisc.d" -o "source/Hardware/HardwareMisc.o" "../source/Hardware/HardwareMisc.cpp"
Note: the ETH_RX_TASK_PRIO did not effect the results, nor did enabling cache.
The memory layout for my project is:
INSTRUCTIONS: DRAM (same chip as the 1024-EVK)
MAIN HEAP: DTCM
FREERTOS HEAP: DTCM
MAIN STACK: DTCM
Linker scripts attached
Running the SDK example on my hardware, with the pings, it works 100% the way it needs to, windows sees all of the replies.
I have noticed that sometimes, wireshark will report that the ICMP checksums are incorrect. I have tried enabling the hardware checksums in lwipopts and that did not fix it (both hardware and software checksums occasionally generate incorrectly).
Has anyone else encountered this issue?
SOLUTION:
The version of LWIP in the SDK seems to be old or broken. I coped the entire LWIP folder from the evkmimxrt1024-lwip-ping-freertos and pasted into my project. I then went in and commented out all the code that referenced the HAL_GPIO SDK example (which I do not need). Following that I was able to import the lwipopts from the sdk example. I have not seen the issue re-occurr.
This is not the first time I have seen the SDK code not work properly, be wary.
Upon further digging, it seems all of the issues arise from checksums being incorrect. Both software generation and hardware generation have this issue