K
When we connect to a Schneider EM6400 power meter using ModScan64 master on Windows, the slave sends perfect responses (we use Modbus RTU, and RS485).
But when we send query to the slave from Raspberry Pi (using the same USB-RS485 converter as on windows) we get response, but with error. We use the MinimalModBus, and a Python script:
<pre>
#!/usr/bin/env python
import minimalmodbus
powermeter = minimalmodbus.Instrument('/dev/ttyUSB0',2) # serial port name, slave address (in decimal)
print "Setting serial port: \n"
powermeter.serial.baudrate = 19200
powermeter.serial.bytesize = 8
# use only one of the 3 lines below to set the parity, and remark the other two lines
powermeter.serial.parity = minimalmodbus.serial.PARITY_EVEN
powermeter.serial.stopbits = 1
powermeter.serial.timeout = 1 # seconds
print "Details of connection:\n "
print powermeter
print "\n "
powermeter.debug = True
print "Read 'Individual Parameter Address' (line to line avg voltage)register from slave:\n "
print powermeter.read_register(3903, 2)
</pre>
The relevant parts of the response:
<pre>
Writing to instrument: '\x02\x03\x0f?\00\x01\xb7!' (02 03 0F 3F 00 01 B7 21)
Response from instrument: '\x02\x83\x020\xf1' (02 83 03 30 F1)
</pre>
What could be the problem? If it is the USB-RS485 stick, why we get the response at all?
Has anybody an idea?
But when we send query to the slave from Raspberry Pi (using the same USB-RS485 converter as on windows) we get response, but with error. We use the MinimalModBus, and a Python script:
<pre>
#!/usr/bin/env python
import minimalmodbus
powermeter = minimalmodbus.Instrument('/dev/ttyUSB0',2) # serial port name, slave address (in decimal)
print "Setting serial port: \n"
powermeter.serial.baudrate = 19200
powermeter.serial.bytesize = 8
# use only one of the 3 lines below to set the parity, and remark the other two lines
powermeter.serial.parity = minimalmodbus.serial.PARITY_EVEN
powermeter.serial.stopbits = 1
powermeter.serial.timeout = 1 # seconds
print "Details of connection:\n "
print powermeter
print "\n "
powermeter.debug = True
print "Read 'Individual Parameter Address' (line to line avg voltage)register from slave:\n "
print powermeter.read_register(3903, 2)
</pre>
The relevant parts of the response:
<pre>
Writing to instrument: '\x02\x03\x0f?\00\x01\xb7!' (02 03 0F 3F 00 01 B7 21)
Response from instrument: '\x02\x83\x020\xf1' (02 83 03 30 F1)
</pre>
What could be the problem? If it is the USB-RS485 stick, why we get the response at all?
Has anybody an idea?