-
Notifications
You must be signed in to change notification settings - Fork 48
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
Race condition in gpio #126
Comments
I think that you are correct, there is a potential race condition here. |
But writing the bits one at a time would on the other hand cause potentialy bad things to happen since the write would be split up into multiple writes. For example looking at
|
However i suppose it would work very well for things that are single bit like |
Related issue stm32-rs/stm32f3xx-hal#37 |
I hope I am wrong, but I think there might be a race condition in the gpio's
into_{x}
methods.stm32g4xx-hal/src/gpio.rs
Line 386 in f8b6ff8
Notice how we perform a read-modify-write sequence without anything preventing the same thing being done to another pin in the same port.
As far as I can see, I believe we would need either a critical section or exclusive access to some sort of token to guarantee exclusive access. A critical section would cause a slight bit of overhead but would otherwise be non-breaking API-wise, I think.
The text was updated successfully, but these errors were encountered: