I port FIFO code to the STM32F0 and got interrupt serial to work. The firmware echoes character typed on the PC back to the PC.
There is an autobaud feature on the serial port. It uses the timing of the Rx character to set the baud rate.
Reference manual - serial port control register bit assignment |
Async serial timing (from logic analyzer) |
ABRMOD[01]: The LSB has to be '01', so that it can measure the falling edge from the falling edge between Start Bit and Bit 1 to the falling edge between bit 1 to bit 2.
The character 0x0d
I have to figure out how to implement the autobaud so that it works reliably in a system.
- Can't leave it on at all times as it would try to recalculate the timing based on received characters that might not have the expected bit pattern.
- Enabling it at the beginning might catches power on/connection glitches of the external device.
- I have no choice of the incoming characters from the embedded system, so for a sanity check, probably have to look at the detected rate to see if it matches one of the known ones.
- Probably trigger this on frame error.
I'll leave it off for now as it is an optional feature and can get very complicated quickly.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.