Modbus over serial line "parity" question

M

Thread Starter

mbusland

How important is the parity "bit" during communication?

I have a firmware that supports RS-485 communication, and I have usually used an USB-TO-RS485 Adaptor to communicate from the PC to the device.

The default configuration has always been 9600 baud with 8bits, 1 stop bit, and no parity.

Modbus over serial-line v1.02 talks about parity MUST be "even" is RTU mode and 'no' parity as preferable on page 12.

The next line the spec says "devices may accept all different parity's (odd, even,none).

On most serial communications I have seen the default is always "NO PARITY". Do customers/developers/EMS care about 'even' parity?

Please share your experience.
 
In my opinion parity checking went out with ASCII.

Modbus RTU mode uses CRC checking which basically makes parity checking redundant. Again, this is an opinion.
 
L

Lynn August Linse

Sadly, many large users do care. I knew of a solar product which 'followed the spec' defaulting to 19200,8,E,1 ... and every customer screamed.

Why? Because all of their masters/slaves ran in 9600,8,N,1, and in order to change the baud rate of this device to 9600,8,N,1 they needed to change the master to 19200,8,E,1, then issue a Modbus write to change the default, then restore the system to 9600,8,N,1.

The vendor had a spare DIP switch, so after the screaming they implemented 19200,8,E,1 as a software setting, and allowed flipping the DIP to over-ride and force a fixed 9600,8,N,1.

At a minimum you should support 9600 & 19200, plus No and Even parity. It won't hurt to toss Odd parity in there.

Keep in mind that most Modbus devices treat 'No parity' as a 'MARK parity', so always '1' like an extra STOP bit and 8-data bits plus no parity = 9-bits. Some micro-p do NOT support this, so be aware.
 
L

Lynn August Linse

No problem.

Personally, I love end-device products with at least 1 DIP switch or jumper. In default position it allows baud rate (etc) to be set via software or Modbus, but in the other position it forces 9600,8,N,1 and slave #1.

This makes talking to a device with unknown settings so fast & predictable (such as reusing a device from stock, etc). Otherwise you have to thrash around trying different baud rates, parity, & slave addresses. Imagine how long it might take to recover if someone had set it to 4800 baud, odd parity, and slave address 96?
 
Top