UART Error Probability

My brain was fried, so I thought I would pass it on to the community.

When sending 1 character to my embedded system, he sequentially thinks that he is getting 2 characters. The first character received, it seems, is matched with the transmitted character (in some unknown way), and the second received character is always 0xff.

Here is what I noticed:

Tx char (in hex) Rx character (in hex), I left out the second byte (always ff) 31 9D 32 9B 33 99 61 3D 62 3B 63 39 64 37 65 35 41 7D 42 7B 43 79 

I check my watch, and it seems to them that everything is in order. The only difference between this non-working version and the previous version is that I now use the RS485 chip.

I traced the signal to the MCU, and it looks fine (confirmed the value of the bits on the RX pin)

+6
embedded serial-port rs485
source share
3 answers

The first character received seems to match the passed character (in some inappropriate path)

In each case, the TX byte is shifted to the left by 1 bit, then inverted.

For example:

31 = 00110001 9D = 10011101

0x31 <1 = 01100010

addition 01100010 is 0x9D

I checked a couple of others, looks the same for everyone. I do not know where the second byte comes from, but this may be the result of a probable signal inversion that continues.

RS485 uses differential signaling. It smells like you used the inverted output of the chip and is connected to the RS232 input.

I traced the entire signal to the MCU, and it looks great (confirmed bit value on rx pin)

What signal did you use as the base link?

+9
source share

RS485 is very different from RS232 on the electrical level (differential compared to single and +/- 6V vs + 15 / -3V) - do both sides of your communication line use the same protocol?

+1
source share

If you have RS485, have you correctly configured the "default state" of the bus? How about the right amount of stop bits?

+1
source share

All Articles