0
\$\begingroup\$

I have used UART RS232 communication between MCUs extensively. Now I need to interface my STM32F407 MCU over RS485 bus with with devices. I have understood few things about RS485 but not-clear about some points. Please correct me if I am wrong in my understanding:

  1. From MCU firmware point of view both are same since we use same pins for RS232 or RS485.

  2. The main difference is in their signal voltage levels and point-to-point (RS232) or multipoint (RS485).

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Shared schemes are drastically different because software must know when to talk. \$\endgroup\$ Commented Feb 19, 2019 at 18:15

2 Answers 2

1
\$\begingroup\$

Mostly right. Certain configurations of half duplex, collision detecting RS485 require a driver enable signal and software changes to detect the collision which RS232 would never need. RS485 might also have addressing implemented in hardware or software which RS232 would never have.

But for point-to-point communications you can essentially use the same code for both RS232 and full duplex RS485.

\$\endgroup\$
4
  • \$\begingroup\$ RS232 is byte oriented, what about RS485.. is bit or byte oriented? \$\endgroup\$
    – scico111
    Commented Feb 19, 2019 at 15:28
  • 1
    \$\begingroup\$ With RS-485 there is a little more flexibility since you can have multi-master and multi-drop, but it still all goes back to what the UART module in the MCU allows, and not the RS-485 itself. The UART might allow you to send 7, 8, or 9-bits in between every stop and start bit, where the extra bit could be either a parity bit or address-flag bit, and the payload might be 7 bits, or 8bits. You would have to read the manual for the RS-485 device you are interfacing with to see the details of it's protocol (which you would have to do anyways to find out what messages it sends and receives). \$\endgroup\$
    – DKNguyen
    Commented Feb 19, 2019 at 17:43
  • 2
    \$\begingroup\$ Remember that RS-232 can also be configured have a parity bit as a 9th bit. So it's not entirely accurate to say it's byte oriented. It comes down to the UART behind the RS-232 and RS-485 transceiver. RS-232 and RS-485 is just the physical, electrical layer. For example, the UART is what produces the start and stop bits. Many quad encoders exist that output their pulses over RS-485 just as a stream of pulses with no start or stop bits. \$\endgroup\$
    – DKNguyen
    Commented Feb 19, 2019 at 17:45
  • \$\begingroup\$ Full duplex RS485 is known as RS422, so there is really no such thing as "full-duplex RS485". \$\endgroup\$ Commented Nov 26, 2019 at 9:25
1
\$\begingroup\$

RS232 uses non-balanced signals. RS485 has balanced signals which increases noise immunity radically.

You are right that several devices can use same RS485 wires. Of course only one of them can can transmit at a time, but all can transmit in turns. RS232 doesn't have that capability, each wire has one dedicated transmitter. RS485 needs some complex software to retain law and order if there's several possible transmitters on the same bus. That's a general networking problem and it has several common solutions.

RS232 defines how transferred bits and characters are presented (=timing) and handshaking for flow control, RS485 defines only bit voltage levels, one can use as complex timings as he wants.

ERRATA: Comments claim that the common asynchronous communication data format with start- and stopbits isn't a part of RS232 spec. User Sam Gibson has checked it from the current standard, so it's a fact and I was wrong.

\$\endgroup\$
11
  • 3
    \$\begingroup\$ RS485 doesn't define timings any more, or less than RS-232 does...the UART defines that, \$\endgroup\$
    – DKNguyen
    Commented Feb 19, 2019 at 15:10
  • 1
    \$\begingroup\$ RS232 has data format and handshaking definitions. Maybe timing is a bad term for it. \$\endgroup\$
    – user136077
    Commented Feb 19, 2019 at 15:16
  • 1
    \$\begingroup\$ Handshaking or software flow control are the terms you're looking for. But those are still defined by the UART standard and have nothing to do with the RS485 or RS232 which are hardware standards. The same handshaking can be used for full duplex RS485. \$\endgroup\$
    – DKNguyen
    Commented Feb 19, 2019 at 15:22
  • 1
    \$\begingroup\$ Unfortunately I haven't the standards because they are copyrighted and high cost commercial stuff. Do you think that handouts like this are crap analog.com/media/en/technical-documentation/… \$\endgroup\$
    – user136077
    Commented Feb 19, 2019 at 15:28
  • 2
    \$\begingroup\$ Nobody prevents connecting UART via other than RS232 signals. Musicians have their MIDI, for ex. But have you some facts which tell that in some phase RS232 in his life hasn't commented at all such things as word lengths or start-, stop,- and parity bits? \$\endgroup\$
    – user136077
    Commented Feb 19, 2019 at 16:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.