AM263P4-Q1: high frequency UDP client example

Part Number: AM263P4-Q1

Hello,

for debugging purposes, I want to write data over ethernet with UDP packets to my computer. the goal is something like 200 bytes per package and 50000 packets per second.

With my basically non-existent knowledge of ethernet and the enet_cpsw_udpclient example, I somehow managed to reach about 7000 packets/s. 

Is there a better example I can use for this purpose?

Best regards

Frank

  • Hi Frank

     the goal is something like 200 bytes per package and 50000 packets per second.

    This is about 10MBps or 80Mbps throughput. But achieving this also depends on how fast you can produce these debug packets in your Software. If you already have these packets created before the transmission starts, then you should be able to achieve this throughput, but if you plan to create this packet from scratch at runtime and transfer, then i doubt if you will have the packet created in time to achieve 50000 packets of 200B per second. This is something that will have to be experimented,


    If you are interested in learning more about the CPSW networking IP, please go through: dev.ti.com/.../node

    The UDP capabilities on the device are derived from the open source LWIP stack, you can read more about it here: www.nongnu.org/.../index.html

    On other note, incase you want to increase the number of UDP connections, please follow this FAQ: e2e.ti.com/.../faq-mcu-plus-sdk-am263x-how-to-increase-number-of-udp-or-tcp-connections-in-lwip-examples

  • Hi Frank,

    Q. What is the interface speed you are using? Is it 100M or 1G?

    Q. Can you send packets of larger size? Max packet size we can send is around 1.5KB. This way you could send less number of packets but more data.

    IF you create packets at run-time,

    1. You could use RAW UDP APIs which will increase the application speed, helping you send more data. dev.ti.com/.../node

    2. You can further optimize your application by keeping all the packet headers ready, and just modify the payload at run-time

    3. Remove all prints/debug logs that add additional delays

    Moreover, you can make some changes in the lwipopts.h file:

    1. Increase tcpip mbox to 256 or burst handling (TCPIP_MBOX_SIZE)

    2. Increase pbuf count to 256 for high-rate TX (MEMP_NUM_PBUF)

    After this you will have to rebuild the LWIP library using command line. (software-dl.ti.com/.../MAKEFILE_BUILD_PAGE.html)

    You can try the above steps and see if it helps. Additoinally at run-time, you can check the lwip_stats to see if there are any limitations/errors coming from the application

    dev.ti.com/.../ethernet_debug_guide.html

    Regards,
    Shaunak

  • I can use 1G, but 100M would be fine too. I think increasing the packet size by combining data points of different sample times is too much overhead. I already have a working solution with a STM32H7 (100M), outputting packets with 40 kHz resulting in around 80Mbps of traffic. I modified their no-RTOS example and removed all overhead. the controller basically only sends out the "same" UDP frame from a fixed memory location, so the only thing that is changing is the data inside. This is what I am trying to replicate with the AM263P and my minimal knowledge of network stuff. 50kHz is my ADC sampling rate and I want to stream that data to my PC so I have a 1:1 view of the measurements and other controller values.

    Thank you for your suggestions so far, but can you point out an example in the SDK that is easy to modify for that purpose? probably a NoRTOS project? I have not much knowledge of ethernet and rtos and since this should only be a crude lab solution, I don’t want to dive too deep in this topic, so it is kind of hard for me to find a fitting example.

  • The easiest way I can think of is:

    1. Try the minor optimizations i mentioned in the previous reply.

    2. If you need LwIP features/Your IP address changes for the UDP server - If that doesn't work, use the enet_cpsw_raw_httpserver example as a starting base point (since you need NoRTOS) and integrate the UDP RAW API example (if the points mentioned in my previous post do not help you achieve the required 80Mbps). You can find the UDP RAW API files in the LwIP stack, all you have to do is compile the specifically needed files with the application. (the files are called 

    3. If you need do not need LwIP features/Your IP address is fixed for the UDP server -You can also modify the Layer-2 CPSW example incase you do not require any of the LwIP features and your IP address is going to be fixed. Basically instead of sending a layer-2 ethernet packet, you create a UDP packet by keeping the packet headers same, but skip the part of having a bulky and complex LwIP stack in your application. All you have to essentially do is prepare packet headers beforehand, just modify the payload and follow the same flow as the enet_layer2 examples follow. You can see how the mcu_plus_sdk_am263px_11_01_00_19\source\networking\enet\core\examples\enet_cpsw_industrial_app does this exact same thing to achieve high speed and low latency,

    Regards,
    Shaunak

  • ok thanks, no. 3 sounds best, i will try