Skip to content

Use a critical section mutex in CAN Fdcan driver. #4271

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

Merged
merged 3 commits into from
Jun 1, 2025

Conversation

cschuhen
Copy link

The FDCAN driver was using a static function to hand out &mut State internally. Generally, care was taken to only access this from within a critical section or Interrupt. The interrupt case is an issue, if some code decided to [de]configure the buffering mode from a higher priority interrupt level than the CAN interrupt. This seems unlikely, anyway...

This change was proposed by @DrTobe in: #4223

This required: #4265 as a dependency. Which also points us to the fact that buffered mode was unsound if the Channel was constructed with a Raw mutex. The first commit in this series blocks that.

This patch has been tested on STM32G431 boards, mainly with the buffered mode.

@cschuhen
Copy link
Author

@Dirbaio , @lulf Tests for last changeset didn't run. Can I get trusted on this please? Thanks.

@Dirbaio
Copy link
Member

Dirbaio commented Jun 1, 2025

bender run

@Dirbaio Dirbaio enabled auto-merge June 1, 2025 12:32
@Dirbaio Dirbaio added this pull request to the merge queue Jun 1, 2025
Merged via the queue into embassy-rs:main with commit c637ee7 Jun 1, 2025
7 checks passed
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

Successfully merging this pull request may close these issues.

2 participants