hippy
Ex-Staff (retired)
This looks like a serial framing issue; do you have a pause after sending the "U" preamble ?
Even with the pause it's still possible for data to be corrupted; that's the nature of over-the-air transmissions. The SERIN looks for a start bit and when it sees one starts reeling in a byte, delivers what it thinks it got. If the start bit wasn't a start bit you'll capture a 'random' next eight bits as a character, if it misses a start but it will take the next high data bit as a start bit.
The differing characters may not be that different because there are a number of conversions between what you have as a binary representation of a character and what is actually sent over the air. Characters are shown as positive logic, lsb to the right. Serial Nxxxx data is inverted logic, send lsb first ( on the left ) with a prefixed high start bit and a low stop bit. The SERIN can either see a false start bit or miss one and when that happens the bits are all shifted. That's fairly easy to see on a scope but difficult to see as displayed characters; a simple bit change cause much more after conversion to display character.
So it seems that what you may be receiving is just 'good old fashioned data corruption' which should be expected.
Even with the pause it's still possible for data to be corrupted; that's the nature of over-the-air transmissions. The SERIN looks for a start bit and when it sees one starts reeling in a byte, delivers what it thinks it got. If the start bit wasn't a start bit you'll capture a 'random' next eight bits as a character, if it misses a start but it will take the next high data bit as a start bit.
The differing characters may not be that different because there are a number of conversions between what you have as a binary representation of a character and what is actually sent over the air. Characters are shown as positive logic, lsb to the right. Serial Nxxxx data is inverted logic, send lsb first ( on the left ) with a prefixed high start bit and a low stop bit. The SERIN can either see a false start bit or miss one and when that happens the bits are all shifted. That's fairly easy to see on a scope but difficult to see as displayed characters; a simple bit change cause much more after conversion to display character.
Code:
_ _________ _
A is 01000001 sent as __| |_| |_| |__
S 0 1 2 3 4 5 6 7 P
_________ _ _
P is 01010000 sent as __| |_| |_| |__
S 0 1 2 3 4 5 6 7 P
Code:
_ _________ _
A is 01000001 __| |_| |_| |__?
S 0 1 2 3 4 5 6 7 P
_________ _
Missed start bit ______| |_| |__?
S 0 1 2 3 4 5 6 7 P
_________ _ _
Could be read as P ______| |_| |_| |__
S 0 1 2 3 4 5 6 7 P
_________ _
Could be read as ______| |_| |______
S 0 1 2 3 4 5 6 7 P