Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to perform both PDO and SDO communication simultaneously without affecting the PDO communication thread cycle #885

Open
Deft-C opened this issue Feb 17, 2025 · 4 comments

Comments

@Deft-C
Copy link

Deft-C commented Feb 17, 2025

Hi,
I am currently using SOEM for ecat communication testing, and my requirement is for SOEM to run with a 1ms cycle. It performed well in the initial tests, but I have a thread that needs to periodically read and write some SDOs. After adding this thread, the ecat thread gets blocked.I noticed that SDO read and write operations are blocking. Do you have a proper method to prevent the ecat thread from being blocked due to SDO operations?

@Deft-C
Copy link
Author

Deft-C commented Feb 17, 2025

Currently, it seems that the blocking is caused by ecx_waitinframe_red. Both PDO and SDO use this function to wait for data to arrive.

@ArthurKetels
Copy link
Contributor

SOEM supports multiple threads. So you should be able to run PDO in one thread and SDO in another, while not blocking each other. However this depends on the performance of scheduler. What OS are you using, and what is the scheduler policy? SOEM works best with real time scheduler, and the PDO thread should have a higher priority than the SDO thread..

@Deft-C
Copy link
Author

Deft-C commented Feb 17, 2025

SOEM supports multiple threads. So you should be able to run PDO in one thread and SDO in another, while not blocking each other. However this depends on the performance of scheduler. What OS are you using, and what is the scheduler policy? SOEM works best with real time scheduler, and the PDO thread should have a higher priority than the SDO thread..

Thank you for your detailed reply. I am using a Linux system with a real-time kernel, and I created a real-time thread for PDO communication using osal_thread_create_rt. I also modified the sched_priority within this function to a higher value. For the SDO communication thread, I used osal_thread_create to create it.

I checked the thread priorities, and the PDO thread's priority is clearly higher than the SDO thread. From the Wireshark data, I can see that when there is jitter in the PDO communication, the first few data frames are related to SDO. Additionally, from the system call interrupt information, it seems that the SDO thread interrupts are affecting the PDO thread.

@Deft-C
Copy link
Author

Deft-C commented Feb 18, 2025

I think this issue is similar to #604
Make the SDO write/read non-blocking would be very useful
Has there been any progress on this work so far?

Kind regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants