Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UART speed possibly wrong

My brain is fried, so I thought I would pass this one to the community.

When sending 1 character to my embedded system, it consistently thinks it receives 2 characters. The first received character seems to map to the transmitted character (in some unknown way) and the second received character is always 0xff.

Here is what I observed:

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 have check my clocks and them seem to be OK. The only difference between this non working version and the previous version is that i am now using a RS485 chip.

I have traced the signal all the way up to the MCU and it looks fine (confirmed the bit value on the RX pin)

like image 985
Mike Avatar asked Apr 13 '10 22:04

Mike


1 Answers

The first received character seems to map to the transmitted character (in some unkown way)

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

For instance:

31 = 00110001 9D = 10011101

0x31 << 1 = 01100010

the complement of 01100010 is 0x9D

I checked a couple of the others, looks to be the same for them all. I don't know where the second byte is coming from but it could be a result of the likely signal inversion thats going on.

RS485 uses differential signaling. It smells like you used the inverted output of the chip and plugged into a RS232 input.

I have traced the signal all the way up to the MCU and it looks fine (confirmed the bit value on the rx pin)

What signal did you use as the ground reference?

like image 161
Mark Avatar answered Sep 22 '22 08:09

Mark