Questions about UART in RS-485 mode

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Questions about UART in RS-485 mode

1,271 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ezharkov on Wed Jul 31 07:59:30 MST 2013
I wanted to make sure that I understand the LPC (1788) UART correctly, just as a sanity check. I'm so used to a UART on another platform, AVR, so that every time I see something different, I start questioning my understanding of the datasheet.

So, here it goes. Couple of questions.

1) I see that there is TXEN. But there is no RXEN. I.e., there is not way to have RX disabled, right? Not that I need to have RX disabled, just curious.

2) When I transmit something to RS-485, I do not receive anything back. I assume this is because I use Auto Direction Control and the receiver gets disabled automatically when the transmitter is active, right? Is there anything in a datasheet that clearly documents this behavior?

Thanks,
Eugene
Labels (1)
0 Kudos
2 Replies

851 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ezharkov on Tue Aug 06 13:09:46 MST 2013

Quote: MikeSimmonds
This is not a direct answer, but I hope it will give the required background (or at least hints)
so that you can interpret your schematic/user manual yourself.

Thanks Mike. Your answer did help me. (To realize that whatever I said about receiving something back on AVR was all wrong. We have identical circuits on LPC and AVR boards, with an ST485 driver chip (which is probably pretty much the same as LTC485). The DE and -RE pins of that chip are connected to the same pin on the microcontroller. Therefore, when the driver output is enabled, the receiver output is disabled at the same time. That is why we do not receive back whatever we transmit. And this has nothing to do with the UART itself.)

Thanks again,
Eugene
0 Kudos

851 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MikeSimmonds on Sun Aug 04 11:53:15 MST 2013
RS485 transmits (and receives) using a differential bus (the cable between the devices).
What people call RS-485 actually coveres two diferent standards: 4-wire (full duplex) and 2-wire (half duplex)
Check wikipedia for RS422.

4-wire uses two differential pairs, one to transmit, one for receive.
In this setup, the receive is always enabled, the transmit is like
a walkie-talkie, push to talk. I.e. only enabled when actually transmitting.

2-wire uses just the one pair; the TXEN will enable the transmitter AND disable the receiver
When the transmission is done, the transmitter is disabled AND the receiver is enabled.

When I say the transmitter/receiver is ..., I am refering to external hardware -- the micro
can not drive a differential pair (or generate the voltage levels required by the standard).
The external device (google LTC485) handles a single differential pair out/in and 'gates' this
pair to the rx and tx pins (from/to the cpu) depending on the level of the TXEN pin.

On the LTC485, there are separate drive enable/ receive enable pins. One is active high
the other active low. The cpu TXEN pin is wired to both to achieve the enabling/disabling
that I described above.

NOTE Depending on how the PCB is actually wired, you may need to invert this signal.
There is a bit (OINV) in the RS485CTRL register to choose this.
Also, you need to set the RS485DLY register so that the last bit of your outgoing
character stream is not cut off.

4-wire systems have two 485 chips, one permenantly receive enabled driving the cpu RX pin,
one (with TXEN controling the drive enable) driven by the cpu TX pin.

As we often want multi drop (three or more devices on the same bus -- i.e wires) only one device
may transmit at any one time [or no device may be transmitting].

This is not a direct answer, but I hope it will give the required background (or at least hints)
so that you can interpret your schematic/user manual yourself.

Regards, Mike
0 Kudos