UDP packet loss when custom device tree usage

Hi.

I have an udp packet sending problem, when i build a TorizonCore version with custom device tree. My program sends a continous udp stream, 200 packets per second, the packet size is 256 byte. If i use the TorizonCore 6 without evaluation containers image without modification, everything working well, but when i build a custom image with the imx6q-apalis-eval.dts in the yaml file, randomly only every second-third packet arrive to the destination. The yaml file:

input:
  easy-installer:
    local: torizon-core-docker-apalis-imx6-Tezi_6.3.0+build.4.tar
customization:
  splash-screen: logo.png
  device-tree:
    include-dirs:
       - device-trees/include/
    custom: device-trees/dts-arm32/imx6q-apalis-eval.dts
	#overlays: 
    #  add:
    #    - device-trees/overlays/display_dual_lvds_1920x1200.dts #my custom display setting, but it not relevant, without this also wrong 
output:
    local: output_directory18/torizon-core-docker-apalis-imx6-Tezi_6.3.0+build.4.CUSTOM

I followed this documentation for usage the torizonCore Builder: TorizonCore Builder - Workflow | Toradex Developer Center . I can reproduce this issue with a simple C program, it sends udp packets to the PC and on PC i view the packets by wireshark:

int main(int argc, char const *argv[])
{
    int	SendSocket;
    char x;
    struct sockaddr_in SendAddr;
    SendAddr.sin_family = AF_INET;
	SendAddr.sin_port = htons(1234);
	SendAddr.sin_addr.s_addr = inet_addr("192.168.222.148");//PC IP
    SendSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
    char data[256];
    while(1)
    {
        data[0] = x++;//serial number for identify the packets
        sendto(SendSocket, data, sizeof(data), 0, (struct sockaddr *)& SendAddr, sizeof(SendAddr));
        usleep(5000);
    }
}

I use the Apalis Evaluation board and Apalis iMX6Q 1GB V1.1B module. The sendto() function never return with error. I checked the CPU/memory usage, but it was low. What can be the problem? May i use a wrong dts file? I’m still new to torizon, maybe I did something wrong.

Greetings @vigh.balazs,

If the only customization you are doing is the device tree then it seems likely this could be the cause of the issue. But we can’t know for sure unless you share or describe what changes you made to the device tree.

Additionally I noticed you are using this path for your custom device tree: device-trees/dts-arm32/imx6q-apalis-eval.dts

Are you basing your device tree changes on this repo?: GitHub - toradex/device-trees: Device tree, device tree overlays and related header files. Used by TorizonCore Builder.

If so then that is incorrect. The device tree files in this repo are only meant to be used alongside TorizonCore 5.X, and you are on 6.X. For TorizonCore 6.X you want to be manually cloning the correct version of the device tree sources as instructed here: Device Tree Overlays on Torizon | Toradex Developer Center

Perhaps this mismatch of device tree versions is the cause of your issue.

Best Regards,
Jeremias

networking 101 - udp is not a guaranteed delivery mechanism. Try slowing down your packet rate to see what happens.

Thank you for your quick answer!

Your right, the mismatch of device tree versions was the problem.

Have a nice day
Balázs

Glad I was able to help!