-
Notifications
You must be signed in to change notification settings - Fork 223
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
uno USART examples fail due to too high baudrate #478
Comments
Hm, I was even able to get 115200 baud working okay in the past IIRC so I'd expect this to not be too bad. What board and MCU are you using here? I think there is a second issue here: |
(And off-topic: Are you at 37c3 by any chance? :D) |
i'm using some obscure arduino uno clone called gscheiduino (the manufacturer is also discontinuing it, so i wouldn't recommend it to anyone 😉) which i got from university (i think due to supply chain issues they couldn't get the real arduino unos at the time) running with an atmega328p. so yeah, maybe this is just an issue of this board?
no, but i wish you a lot of fun there! 😄 |
Hmm, so there is this ugly ugly hack that's needed on some boards to get certain serial baudrates working correctly. Maybe you're hitting some version of that? The code is this one: avr-hal/avr-hal-generic/src/usart.rs Lines 130 to 140 in f6b79dc
|
no clue. but if i'm the only one reporting this i'm happy to just ignore it. i'm just playing around a bit with this device, so i don't care if it doesn't run with higher baud rates. i have no intention of using it for anything more serious. |
The Uno is using a 16 Mhz crystal, and using a 16 Mhz crystal on an AVR causes for example the frequencies 57.6 kbit and 115.2 kbit to be outside of the 1% error normally needed for an UART. To be able to select a good bit rate the Wormfood AVR bit rate calculator is a nice tool. To get 57.6 kbit below 1% error, U2Xn must be set to 1. It is still above 0.5% so it might not work. 115.2 kbit is not working at all. |
the USART examples for the arduino uno fail when i try to run them.
ravedude
fails with the following error (note that the first two characters printed come from USART, though already the 2nd one is garbled):PuTTY doesn't crash but shows a lot of garbled text.
i narrowed it down to the baud rate of
57600
. if i switch this to9600
(obviously both in the code instantiating the serial connection as well as the call toravedude
or in PuTTY) then the problem goes away.do others have the same issue? i remember that i had this issue before with arduino uno, i think
75600 baud
is at the upper limit of what the hardware can handle and using a slower baudrate makes it work more consistently (though slower; but for something as simple as these examples that's irrelevant).maybe it'd make sense to reduce the default baud rate for the examples?
The text was updated successfully, but these errors were encountered: