This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM6442: AM6442: rt linux: The real-time performance of igh ethercat test is poor

Part Number: AM6442

Hi, there is a problem when I test igh ethercat on AM6442 rt kernel.

1. The rt kernel is from ti-processor-sdk-linux-rt-am64xx-evm-08.01.00.39,the configuration CONFIG_PREEMPT_RT is opened

2. Test rt kernel with cyclictest

The real-time performance of CPU0、CPU1 is not very good.

Isolate CPU1,real-time performance of CPU1 is better than CPU0.

3. Igh ethercat test

I connect motor control module(hardware) to cpsw network port or pru network port.

Use the ethercat generic driver which is base on cpsw network port driver or pru network port driver.

I run a app testing Igh ethercat:first clock_nanosleep(1ms),  then get and change motor state through ethercat api  in each period.

This app will always calculate time consumed per period and record the min/max value,then print the result to uart console every 1s.

3.1 Do not Isolate CPU1,then run Igh ethercat test app

The time consumed of some periods is much larger than 1ms,  whether using cpsw network port or pru network port.

3.2 Isolate CPU1,then run Igh ethercat test app on CPU1

The time consumed of most period is better,around 1.2ms.

 

But some period consume much larger than 1ms,  with skipping unmatched datagram by ethercat.

becasue of isolating CPU1, the warning about skipping unmatched datagram by ethercat appear frequently.

This problem will appear whether use cpsw network port or pru network port to test igh ethercat.

Use usb ethernet port(AX88772C) to test

The time consumed of most period is better,around 1.2ms.

Even if isolate CPU1, the warning about skipping unmatched datagram by ethercat appear rarely.

If the cpsw network port driver or pru network port driver limit the real-time performance of the ethercat?

3.3 If there are some ethercat tests result on AM6442 rt kernel which can be provided?

4. How to improve real-time performance of AM6442 rt kernel

If there is another way to improve real-time performance of AM6442 rt kernel except isolating CPU1?

  • Hi,

    Thank you for the extensive details and background. We have not benchmarked IgH EtherCAT master on AM64x and don't have an example yet. I think there are several steps you can take to optimize. I'm listing them below in order of simplicity. I would initially focus on using just CPSW3G, and the first couple steps.

    1. Setting of priorities

    I'm assuming the IgH application is already running at some high RT priority (i.e. ps -ALo -policy, priority shows FF as policy and -50 as priority or something like that) The Ethernet driver uses ksoftirqs for Ethernet frames. By default those run timeslice (best effort). Run ps aux | grep ksoftirq and you look for the priority of them. Set them real-time with chrt -f -p 10 10 and chrt -f -p 10 21

    2. Core isolation

    Isolate Networking and IgH. to a core. Including using isolcpu and/or cpusets. 

    3. Fine grained control of networking

    Once the Linux scheduling is good enough, utilize QoS features in Ethernet tx like https://software-dl.ti.com/processor-sdk-linux/esd/AM64X/08_04_01_04/exports/docs/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/CPSW3g.html#enhancements-for-scheduled-traffic-est-offload or even as far as not use Linux networking stack. EtherCAT network is not a general LAN, it only has single application and single raw Ethernet frames. So write a custom device driver that owns the Ethernet peripheral and is only usable from IhG EtherCAT master. This approach is sometimes called native driver.

      Pekka