ModBus Timeout error


Thread Starter

mattia bruno

Hi there

I'm working on a project involving ModBus RTU on rs-485 on the vdx-6354 single board by ICOP. It provides a 3-pin rs-485 connector and the possibility to commute one of the COM rs-232 ports to a rs-485 one.

The OS installed is Ubuntu 8.04 with a kernel including all the drivers for the on board hardware; the slave device tested was a Seneca net-analizer.

The problem is that I always get a "connection timeout" error, no matter what port I connect the device to, what baud rate I set, what slave ID I set, what modbus library I use.

The /dev/ttyS* devices are created and recognized as they should be.
Could you help me on this subject?

Thanks in advance!

Lynn August Linse

Just my first guess - Linux/Unix would probably default to what us old-folk call 'cooked mode', which means you don't have control of DTR/DSR nor RTS/CTS. Your RS-485 port might require RTS to be used to turn the line around (to stop it from being a receiver and start being a transmitter).

So you probably need to do some special IO controls on the port to either enable an automatic, kernel supported RS-485 line-turn-around, or you need to gain that control directly for your application.

Curt Wuollet

Yeah, Google Linux stty and you'll get the common switches and the rest you can do with ioctl. The Linux tty discipline is pretty complete and you can do just about anything that can be done with a serial port. There's also plenty of documentation like the Linux Network Administrators Guide and tty HOW TO. Between that and trussing your connector up with jumpers like a chicken on the spit you can handle an incredible variety of situations and the most arcane of serial devices from a real teletype to almost any terminal made and the zillions of serial printers, each with their own ideas about flow control. You can do terminal attached printers and bar-code scanners and in a pinch read switches and control things.