Skip to content

Conversation

@AlexFabre
Copy link
Contributor

Replace k_sleep() with k_timer and semaphore-based synchronization in the CANopen SYNC thread for more deterministic wake-up timing.

Add configurable CANOPENNODE_SYNC_THREAD_PERIOD_US Kconfig option to allow tuning the thread processing period.

More details

This thread is responsible for processing PDO and SYNC messages. By design it loops every 1ms (now configurable).

When the application is designed to send the SYNC message every 1ms, the k_sleep wait of the thread is not precise enough. The following Systemview capture shows that SYNC messages are distant from a little more than 1ms.

Capture d’écran 2025-12-19 à 17 28 54

With this new implementation, SYNC messages are perfectly distant from 1ms.

Capture d’écran 2025-12-19 à 17 06 31

Replace k_sleep() with k_timer and semaphore-based synchronization
in the CANopen SYNC thread for more deterministic wake-up timing.

Add configurable CANOPENNODE_SYNC_THREAD_PERIOD_US Kconfig option
to allow tuning the SYNC processing period.

Signed-off-by: Alex Fabre <[email protected]>
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants