-
Notifications
You must be signed in to change notification settings - Fork 218
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
USART hangs on read overrun #107
Comments
https://gist.github.com/ctz/86b63fa8d95b42d04245 Patch which Works For Me™ |
Thanks for this! Mind submitting a PR? On Fri, Mar 6, 2015 at 6:56 PM, ctz [email protected] wrote:
|
This is improved on the previous patch: if we get an ORE without RXNE when we don't write a junk byte to our buffer. It also avoids the strange-looking blind read. See issue leaflabs#107 for more info.
This is improved on the previous patch: if we get an ORE without RXNE when we don't write a junk byte to our buffer. It also avoids the strange-looking blind read. See issue leaflabs#107 for more info. Signed-off-by: Joseph Birr-Pixton <[email protected]>
ctz: How about join the new STM32-arduino community: http://stm32duino.com/ ? |
@mbolivar patch was merged, so this ticket should be closed now |
done, thanks |
I have a program which alternately communicates on uart1 and bit-bangs GPIO to talk a certain protocol. When doing the bit-banging, interrupts are turned off.
This hangs very occasionally (~once an hour) on maple mini.
I attached a debugger and caught the hang in action: it's an interrupt flood to USART1 because
usart_irq
doesn't handle all the exceptions it enables.The datasheet says:
So while the current code will read DR and therefore clear RXNE, it never reads SR to clear ORE. If there is an overrun it will never clear that exception and it will be continually reasserted forever. This is the cause of the hang I saw.
(Obviously this means I'm losing bytes sometimes, and that's fine for my application. YMMV, which is why this is an issue and not a pull request.)
The text was updated successfully, but these errors were encountered: