I am failing to communicate with a device using minimalmodbus, Modbus RTU.
I have connected the device to a raspberry pi via a usb to rs-485 adapter (FTDI chip) A to A and B to B.
The device configurations are as follows:
Port settings:
- Baud rate: 9600
- Parity: No
- Stop bits: 1
- Silent Interval: 70 ms.
- Transmission Mode: RTU
Interface 2 Wire RS485
- Connector of ECM: DB9
- Connections: A on pins 1, 4. B on pins 6, 9
Modbus Holding registers (simplified for the purpose of this example)
- Swapped Floating point format:
- 40001 (address 0) Parameter 1
- 40003 (address 2) Parameter 2
I have tried using raw serial commands to communicate with the device, as well as using pymodbus, and now on my latest attempt minimal modbus. Please see below my code attempt using minimalmodbus.
Also, i know the serial adapter works as i use it for various other serial sensors. Only difference is that i am working with modbus now.
import minimalmodbus
instrument = minimalmodbus.Instrument('/dev/tty/USB1',1)
instrument.debug = True
instrument.handle_local_echo = True # The serial device echos back every write, hence this
instrument.serial.baudrate = 9600
instrument.serial.timeout = 1
value = instrument.read_register(0,2)
print value
I expected to receive some sort of reply even if an error or incorrect, but i am getting nothing. the debug output of minimalmodbus says "IOError: No communication with the instrument(no answer)"
Is there any obvious mistakes in my code vs the sensor requriements? I confirmed my wiring with the manufacturer, and is correct.