Modbus DISCUSSION

How do I calculate the Modbus RTU 3.5 character silent interval for a given baud rate?

Started by mayankpershad Modbus RTU timing3.5 character timeinter-frame delayt1.5 timeoutframe detection
5 replies 248 views 6 participants
Latest activity · 30 Sep 2026

How do I calculate the Modbus RTU 3.5 character silent interval for a given baud rate?

mayankpershad Modbus Forum
#1

My Modbus RTU slave on an STM32 uses a timer to detect the end of a frame. The specification says frames are separated by a silent interval of at least 3.5 character times, and that a gap of more than 1.5 character times inside a frame is an error. At 9600 baud my slave works, but at 115200 baud it misses frames from a PC master.

How are these times calculated, and is a "character" 8, 10 or 11 bits here?

Community replies 5

Re: How do I calculate the Modbus RTU 3.5 character silent interval for a given baud rate?

#2

A character in Modbus RTU is 11 bits on the wire: 1 start bit, 8 data bits, 1 parity bit and 1 stop bit. With no parity the specification calls for 2 stop bits, so it is still 11 bits. Many devices run 8N1 with 10 bits in practice; in that case use 10 in the calculation.

One character time is 11 / baud. At 9600 baud that is 1.146 ms, so t3.5 = 3.5 × 11 / 9600 = 4.01 ms and t1.5 = 1.5 × 11 / 9600 = 1.72 ms. At 19200 baud the values halve to about 2.0 ms and 0.86 ms.

Re: How do I calculate the Modbus RTU 3.5 character silent interval for a given baud rate?

#3

Above 19200 baud the specification stops scaling the times and recommends fixed values: 750 µs for the inter-character timeout and 1.750 ms for the inter-frame delay. The reason is interrupt load; at 115200 baud a true 3.5 characters would be only about 334 µs, which is hard to time reliably on small controllers.

So at 115200 your slave should treat about 1.75 ms of silence as the end of a frame. If your timer is set to the scaled 334 µs, any small pause inside a frame is taken as a frame boundary and the frame is cut in two.

Re: How do I calculate the Modbus RTU 3.5 character silent interval for a given baud rate?

#4

The PC master is the likely source of those pauses. A desktop operating system and a USB serial adapter do not always send a frame as one uninterrupted burst. USB adapters forward data in packets, and a gap of a millisecond or more can appear in the middle of a frame. A slave enforcing t1.5 strictly then discards a frame that was actually valid.

Many real implementations therefore ignore the 1.5 character rule and rely on the 3.5 character silence plus the CRC, and some add a little margin to the silence time when talking to PC masters.

Re: How do I calculate the Modbus RTU 3.5 character silent interval for a given baud rate?

#5

On STM32 you may not need a separate timer for this. Many parts have a USART receiver timeout feature, programmed in bit times, which raises an interrupt after that many bit periods of silence following the last received character. For Modbus at up to 19200 baud, a timeout of 39 bit times (3.5 × 11 = 38.5, rounded up) matches the specification directly. Not every STM32 family or USART instance has this feature, so check the reference manual; the IDLE line interrupt is the fallback, but it fires after only one character time of silence.

With DMA reception plus the timeout interrupt, the CPU is interrupted once per frame instead of once per byte.

Re: How do I calculate the Modbus RTU 3.5 character silent interval for a given baud rate?

#6

Remember the other direction too. After receiving a request, a slave must leave at least 3.5 character times of silence before transmitting its reply. With RS-485 it must enable the driver before the start bit and disable it only after the last stop bit has left the shift register, which is the transmission complete flag, not the transmit buffer empty flag.

Releasing the driver one character early cuts off the CRC, and releasing it late can collide with the master's next request. A logic analyser on the driver enable pin and the data line shows both errors immediately.

TEP COMMUNITY