Auto-baud only works for lower baud rates #582
Replies: 2 comments
-
Per datasheet:
0x00 at half the current baud rate is 18 consecutive low bits. 0x00 at twice the current baud rate is only 4.5 low periods. You need to generate a break condition. There is generally not a convenient way to do that. SerialUPDI does the breaks which are used to reset the UPDI interface by switching to some crazy low baud rate and sending 0x00, because generating a break is often hard. The autobaud is a lot less easy to do anything cool with than it sounds... because there's a need for those breaks
This complication was why I chose not to do a wrapper around it... |
Beta Was this translation helpful? Give feedback.
-
At one point I tried that and couldn't get it to work, but for some reason when I saw you post about writing the WFB bit, it clicked to me what I was doing wrong. If I set the WFB bit at the top of void loop, before reading Serial, everything works properly. Thanks! |
Beta Was this translation helpful? Give feedback.
-
If I start Serial on an ATtiny3224 with:
Serial.begin(230400); bitSet(USART0.CTRLB, 2);
then I can open a COM port at 230400 and all works fine. I can then switch that COM port to 115200, get gibberish and once I send 0x00 0x55 to the port at 115200, the AVR's baud is automatically changed to 115200 and works perfectly. Exactly how it should work. I can even keep lowering this all the way down to 9600 with no problems. The problem is that the new baud rate cannot be higher than the current one. So if I start at 230400 and switch it to 115200 it works, but if I try to go back to 230400 it doesn't work. I've tried many different work arounds and setting of bits (including switching back to 230400 on baud rate error) but it just will not work on a higher baud rate. Am I missing something?
Beta Was this translation helpful? Give feedback.
All reactions