What is an Asynchronous UART Framing Error?
In asynchronous serial communication like Modbus RTU, devices do not share a common clock line. Instead, the transmitter and receiver synchronize on a per-character basis using framing bits:
- Idle State: The serial bus sits in a continuous logical HIGH state (Marking).
- Start Bit: The transmitter pulls the line to logical LOW (Spacing) for exactly one bit period to signal the start of a byte.
- Data Bits: 8 data bits are transmitted sequentially, least-significant bit (LSB) first.
- Optional Parity Bit: Even, Odd, or None to detect single-bit corruption.
- Stop Bit(s): The transmitter returns the line to logical HIGH (Marking) for 1 or 2 bit periods to allow the receiver to settle before the next character.
A framing error occurs when the receiver's UART samples the line at the exact time where the Stop Bit is supposed to be HIGH, but detects a logical LOW (0V differential or negative voltage). Because the receiver expects a valid HIGH delimiter, it flags the character as misframed, sets the FE (Framing Error) interrupt, and discards or corrupts the payload byte.
The Top 5 Causes of Modbus RTU Framing Errors
1. Baud Rate Mismatch or Clock Frequency Drift
If the Master transmits at 19,200 bps and the Slave listens at 9,600 bps (or vice-versa), the bit timings will be completely mismatched, resulting in immediate framing errors on byte 1.
However, a subtler issue is UART clock frequency drift. Internal RC oscillators in inexpensive microcontrollers or USB-serial dongles can drift by 3% to 5% across industrial temperature extremes (-20°C to +70°C). By the time the 10th or 11th bit of a character arrives, the receiver's sampling point has drifted past the stop bit into the subsequent start bit or idle gap, triggering intermittent framing errors that only occur at high temperatures or high baud rates (38,400 to 115,200 bps).
2. The Modbus Parity and Stop Bit Dilemma (8-N-1 vs 8-N-2 vs 8-E-1)
The official Modbus over Serial Line Specification (Modbus-IDA v1.02) explicitly mandates:
- Default Standard: 1 Start bit, 8 Data bits, Even parity, 1 Stop bit (
8-E-1= 11 bits total). - No Parity Rule: If no parity is used, the device must implement 2 Stop bits (
8-N-2= 11 bits total) to preserve identical frame duration.
In practice, many modern sensor manufacturers and software tools ignore the specification and configure devices as 8-N-1 (10 bits total). If your master transmits with 1 stop bit while the slave expects 2 stop bits, the slave will sample the second stop bit during the start bit of the next byte, creating a framing error on every consecutive byte!
3. Reversed RS-485 Signal Polarity (Data+ / Data- Inversion)
RS-485 is a differential signaling standard:
- Logical 1 (Mark / Idle / Stop): Terminal A is negative with respect to Terminal B ($V_{A} - V_{B} < -200\text{ mV}$).
- Logical 0 (Space / Start): Terminal A is positive with respect to Terminal B ($V_{A} - V_{B} > +200\text{ mV}$).
Note: Terminal labeling is notoriously inconsistent across manufacturers. Some vendors label Non-Inverting (+) as 'A' and Inverting (-) as 'B', while the TIA/EIA-485 standard specifies 'B' as non-inverting and 'A' as inverting! If cables are accidentally reversed, the receiver sees continuous Spacing (0) instead of Marking (1), causing immediate, constant framing errors and bus timeouts.
4. Signal Reflections from Missing 120-Ohm Termination Resistors
At baud rates of 19,200 bps and higher, or on RS-485 cable runs longer than 50 meters, sharp square-wave pulse edges reflect back from unterminated cable ends. These electrical reflections collide with incoming data bits, distorting the voltage slope. If a reflected transient dips the voltage below the receiver's threshold during a stop bit, the UART registers a framing error.
Fix: Install a $120\,\Omega$, 1/4-watt termination resistor across the $(+)$ and $(-)$ lines at the two physical ends of the daisy chain only. Never place termination resistors on intermediate slave taps.
5. Floating Ground and Common-Mode Voltage Excursions
Although RS-485 uses differential voltage, standard transceivers can only tolerate common-mode voltage differences between -7V and +12V relative to local earth ground. In industrial facilities with heavy machinery, motor drives, or variable earth potentials, ungrounded 2-wire cables can drift tens of volts above ground. This saturates the receiver's input stage, destroying character framing. Always use 3-wire shielded twisted pair cable (Data+, Data-, and Signal Reference/Ground).
Comparison: Framing Error vs CRC Error
| Parameter | Framing Error (UART FE) | CRC Checksum Error |
|---|---|---|
| Detection Layer | Hardware UART Physical/Data Link | Software Modbus Protocol Application |
| Trigger Mechanism | Stop bit read as 0 instead of 1 | Calculated 16-bit CRC does not match packet tail |
| Primary Cause | Baud rate mismatch, parity/stop bit config, wiring noise | Flipped data bit from EMI, byte order endianness bug |
| Visibility in Logs | Serial driver interrupt error; packet often discarded before app | Full packet received, rejected by Modbus stack |
Step-by-Step Diagnostic Troubleshooting Workflow
- Audit Communication Settings: Verify that Baud Rate, Data Bits (8), Parity (None/Even/Odd), and Stop Bits (1 or 2) match 100% across both Master and Slave devices.
- Check Idle Voltage with a Multimeter: Measure DC voltage across Data+ and Data- while the bus is idle. You should see a steady differential voltage of +200mV to +300mV (Data+ higher than Data-). If the voltage is negative, your wiring polarity is inverted. If it is 0V, you lack fail-safe pull-up/pull-down biasing resistors.
- Lower Baud Rate to 9600 bps: If framing errors vanish at 9600 bps but appear at 38400 or 115200 bps, your problem is cable capacitance, lack of 120-ohm termination, or clock oscillator drift.
- Verify Daisy-Chain Bus Topology: Ensure your RS-485 bus is a straight daisy chain. Star topologies, long tee stubs (>1 meter), and loop configurations create severe reflections that break character framing.
Isolate Hardware vs Software with ModbusSimulator
When diagnosing elusive serial errors, the biggest challenge is separating hardware electrical faults (wiring, transceivers, ground loops) from software configuration mistakes (baud rate, parity, timing).
By downloading ModbusSimulator, you can create a virtual Modbus Slave or Master on your Windows PC and connect your PLC or SCADA system directly over a virtual null-modem serial port (such as com0com). In this virtual software environment:
- Physical RS-485 transceiver noise, reflections, and baud drift are 100% eliminated.
- You can inspect real-time raw byte frames and hexadecimal packets in our built-in high-speed traffic monitor.
- You can simulate multiple slave devices (IDs 1–247) on a single port to verify multi-device polling loops before deploying to physical factory floor wiring.
Eliminate Modbus Serial Guesswork
Test Modbus RTU and Modbus TCP applications with high-resolution visual register grids, dynamic waveform generation, and zero hardware requirements.
Download ModbusSimulator Free →