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.

SK-AM64B: Codesys Ethercat Master & Softmotion Driving Two Servo Motors Directly

Part Number: SK-AM64B
Other Parts Discussed in Thread: SK-AM62B,

Hi TI Experts,

Customer is evaluating the performance of our AM64 device driving two servo motors.

The SDK version they applied is SDK9.2 (early released version, I heard that the final SDK9.2 version is still on the way) RT-Linux SDK default image.

They have run Ethercat master & Softmotion module inside the Codesys on A53 cores and drive two servo motors shown below.

The data path is: Codesys -> CPSW2G -> A53 -> Servo Motor

However, the performance is not expected.

The maximum cycle time reached 1313us and the maximum jitter reached 227us shown below.

Due to the cycle time and jitter is quite high, it cause data frame loss and the servo motor is stopped finally.

We have searched that we have some benchmark experiments of running AM64x ethercat master connecting to AM24x as slave then driving the servo motors. 

For this customer experiment, because they want to achieve implement everything on the AM64x without using AM24x, so the high latency described above has a greater effects on driving the servo motors.

May I know is there any suggestions to improve the performance here please?

Also may I know the upcoming SDK9.2 final version will have a better performance?

Thanks a lot!

Kevin

  • The interrupt latency improvements as measured with cyclictest are not sufficient to make any application real-time performance the best it can be. 9.1 is already good from this perspective. With Codesys or any other real-time application, you will need to do further application specific tuning, making choices on what you want to be prioritized. The base SDK environment will not be tuned to treat exactly what you want to prioritize over other features. We are working on an app report for this in the context of Codesys, and Daolin will repond here with some of the steps to take.

    Some of this work will be presented at Embedded World 2024, https://events.weka-fachmedien.de/embedded-world-conference/program April 9th 4:00 PM - 5:45 PM
    SESSION 2.3 CONNECTIVITY SOLUTIONS .

      Pekka

  • Hi Kevin,

    Codesys recently added some new ways to try and optimize real time performance https://content.helpme-codesys.com/en/CODESYS%20Control/_rtsl_performance_optimization_linux.html. I would suggest following their steps step-by-step first.

    Several initial suggestions to tune the performance of Codesys EtherCAT master from the work I was trying, before Codesys updated their performance optimization page.

    1. If it's possible to reduce the number of tasks running from Codesys, I would suggest combining the functionalities of "EtherCAT_Task" and "VISU_TASK" into one task. The switching between the two tasks during runtime can cause large jitter.

    2. If the "codemeter" licensing application (to allow for longer than 30 minute runtime on Codesys) is running, please try changing the cpu affinity to be the same as the cpu affinity of "EtherCAT_Task". 

    3. If there are any background processes running on SK-AM64B such as "ti-apps-launcher" or "telnetd" on the default SDK image please disable those. In general, I've observed better overall performance when running on thin SDK image (when I had SK-AM62B as the EtherCAT controller)

    4. For more visibility to performance during runtime with graph, rather than what Task Monitor can show try to add a Trace object to track the current cycletime and when it spikes. Some instructions can be found here: https://medium.com/@sean.gongz/how-to-get-current-task-actual-cycle-time-in-codesys-267384bcd3b7 

    -Daolin

  • Hi Daolin & Pekka,

    Thanks for your explanation in details!

    Customer recently has retried this experiment. They have done the below 3 testing based on SDK9.1 RT Linux.

    1: Run Codesys ethercat on AM64x only (not connecting to am24x), the servo motor runs normally.

    2: Run Codesys ethercat on AM24x only (not connecting to am64x), the servo motor runs normally.

    3: Run Codesys ethercat master on AM64x & run ethercat slave on AM24x. And when the cycle time is at 500us, there will be small possibility to have data frame loss.

    For this experiment, they only run the ethercat, the softmotion module previously discussed is not used in this experiment to avoid any conflict.

    Could you help provide any suggestions for this please?

    Kind Regards,

    Kevin

  • Hi Kevin,

    As mentioned in our webex chat, I've observed frame loss on AM64x when at a configured cycle time of 1ms. I've also noticed frame loss is reduced as the configured cycle time increases. Is there a particular reason for them to choose a 500us configured cycle time?

    I would suggest as large of a configured cycle time as possible, by default 4ms is what CODESYS sets and I remember not seeing any frame loss during a 17 hour run when at this configuration. I have not tried running 1.5ms for long period but I remember 2ms may or may not result in frame loss.

    If they haven't already, I would also recommend the customer to try and get the observed cycle time as small as possible by tuning the Linux environment (change scheduling policies, priorities, disabling unnecessary threads etc) which can probably also help with reducing frame loss.

    -Daolin