-
Notifications
You must be signed in to change notification settings - Fork 2k
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
cpu/stm32_common/uart: fix rare uart failure #12100
Conversation
in uart_poweroff the peripheral should be disabled through the register instead of just disabling the peripheral clock. In uart_poweron the peripheral should be enabled after enabling the clock. Not explicitely disabling the peripheral causes some bad signals on the uart line sometimes.
once hardware flow control is enabled, rts should only be initialized after the uart is enabled by setting the UE flag. This is stated in the stm32f4 errata.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. @fjmolinas is it possible to test this PR on your STM32 cluster ?
Will do, I'm testing some watchdog stuff but I will do that promptly. Do you want to run all tests or a subset? |
This is touching UART so I don't see any particular restriction. Just run them all :) |
Here are the results: failuresummary.mdnucleo-f091rc/failuresummary.md
The failures with @toonst if possible could you post the terminal output that showed the issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No obvious failure reported by @fjmolinas. We discussed the problem IRL with @toonst and the changes of this PR make sense.
Let's merge this, so ACK.
If there is more context to what is stated in the PR, its better if you also comment it in the PR.
For future PR's it would be ideal if you could post in the PR the details of your setup that caused the issue and some terminal output that showcases it. In any case thanks for the fix! |
I used our custom app & board to reproduce this issue. I will try to find time to make an upstreamable test to reproduce. |
No need in this case, its unnecessary overhead here. My comment was just intended as a suggestion for future PR's ;) . |
Contribution description
in
uart_poweroff
the peripheral should be disabled through the register instead of just disabling the peripheral clock. Inuart_poweron
the peripheral should be enabled after enabling the clock.This change seems to fix some rare issues with the uart not working properly after a power off.
Testing procedure
I reproduced the issue by letting a custom app run for a few hours which powers the uart on & off. At some point the uart_write was not actually sending any data on the TX line.
Issues/PRs references
none