RS485 board/The 120 Ω resistor/07. When nobody talks
The 120 Ω resistor · 07 of 11

When nobody talks

Between messages no driver is on, and the bus has to read as idle. Two 20 kΩ resistors on every board pull A up and B down for that, but the 120 Ω across the pair shorts most of their pull away. The idle bus lands under the 200 mV a receiver needs to be sure, and a sketch should expect the odd stray byte.

Idle is supposed to be a 1

A UART line rests high between bytes, and a start bit is the first thing that pulls it low. On RS485 "high" means A above B. While a board is talking, its driver makes that so. When nobody is, something else has to.

On these boards, that is a pair of 20 kΩ resistors: one from A up to the supply, one from B down to GND. With nothing else on the bus, they hold A well above B, and every receiver outputs the idle level.

The 120 Ω gets in the way

The terminator sits straight across A and B, and it is 120 Ω against 20 kΩ. The bias resistors and the terminator make a divider, and almost all of the supply is dropped across the 20 kΩ resistors. What is left between A and B is a few tens of millivolts.

An idle bus, and what the receivers read
undecided
Boards on the bus
120 Ω fitted
Boards
Pull each way
10.0 kΩ
A to B
60 Ω
Idle A − B
15 mV
Undecided: 15 mV, under the 200 mV a receiver needs. The 120 Ω shorts most of the bias away. In practice the receiver usually holds the last level it saw, which after a byte is idle, but it is not guaranteed, and noise can knock out a stray byte while nobody is talking. A sketch should expect that and ignore bytes that are not part of a message.

The receiver is guaranteed to read a 1 only above 200 mV. Between −200 and +200 mV the datasheets promise nothing. With the terminators fitted, a quiet bus of these boards always lands in that band: about 15 mV on two boards, and under 100 mV even on twelve with only the ends terminated.

What that means in practice

Usually nothing you notice. The receiver has a little hysteresis, so it tends to hold the last level it saw, and after a byte's stop bit that is idle. But noise can tip it, and then the UART sees a start bit that nobody sent and reads a stray byte.

The cure is in the sketch, not the soldering iron:

  • Send messages the other end can recognise, such as whole lines ending in a newline, and discard anything that is not one.
  • Set the direction pin HIGH a moment before the first byte, so the bus is driven to a clean idle before the start bit.

The builds in the next chapter do both.

When it does not work

My receiver prints a stray character now and then when nobody is sending.

That is the idle bus sitting under the receiver's 200 mV threshold, with noise tipping it. It is expected on any terminated RS485 bus without stronger bias. Send messages the receiver can recognise, such as whole lines, and ignore bytes outside them.

The first byte of every message is wrong.

The receiving UART may have caught a stray edge while the bus was idle and be part-way through a false byte when the real one starts. Have the talker set its direction pin HIGH a moment before sending, so the bus is driven to idle first, and skip anything before the start of a message.

Should I change the 20 kΩ bias resistors?

Not usually. Stronger bias fixes the idle level but loads every driver, and a bus of these boards already has twelve pairs of them. Framing messages in software is the cure that costs nothing.

Where this goes next

The first message: one ESP32 talking to itself through two boards and a pair of wires.

One ESP32, two boards

Edit this page — content/books/rs485/when-nobody-talks.mdx

Community

Questions about this product

See what other owners have asked, and read their solutions.

This page covers several products. Choose yours to see the right discussions.

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Modules and blocks on the forum