April-28th-2020, 07:53 AM
Hello,
I use NIOT-E-NPI3-51-EN-RE with RS485 Interface NIOT-E-NPIX-RS485 Rev#2
The basic software on the netPI is balena with debian container and python3.
For enabling the RS485 interface GPIO17 is set to '1'.
I used the following python script for checking the communication:
Now I have the problem that the communication with the device (in this case a temperature sensor) is not stable. Only every 3rd-5th read out is successful.
See attachment.
check_client_S0.txt (Size: 14.2 KB / Downloads: 5)
To check the correct operation of the installation, I checked the communication with the device using a normal USB-Modbus-Adapter on the same netPI.
In this case every read out is successful.
check_client_usb0.txt (Size: 11.67 KB / Downloads: 2)
May be someone has an idea, why the communication with the internal RS485 interface is not stable?
I checked the orginal node-red image for the nedPI. In this case 'rtu-buffered' must be used to get stable values. Otherwise the same problem occurs.
Thanks.
Peter
I use NIOT-E-NPI3-51-EN-RE with RS485 Interface NIOT-E-NPIX-RS485 Rev#2
The basic software on the netPI is balena with debian container and python3.
For enabling the RS485 interface GPIO17 is set to '1'.
I used the following python script for checking the communication:
Code:
import logging
from pymodbus.client.sync import ModbusSerialClient as ModbusClient #initialize a serial RTU client instance
client= ModbusClient(method = "RTU", port = "/dev/ttyS0", stopbits = 1, bytesize = 8, parity = 'N', baudrate = 9600, timeout=0.1)
connection = client.connect()
FORMAT = ('%(asctime)-15s %(threadName)-15s'
' %(levelname)-8s %(module)-15s:%(lineno)-8s %(message)s')
logging.basicConfig(format=FORMAT)
log = logging.getLogger()
log.setLevel(logging.DEBUG)
def processResponse(result):
log.debug(result)
rr = client.read_holding_registers(0, 1, unit=0x01)
assert(not rr.isError()) # test that we are not an error
log.debug(rr)
client.close()
Now I have the problem that the communication with the device (in this case a temperature sensor) is not stable. Only every 3rd-5th read out is successful.
See attachment.
![Text Document .txt](https://forum.hilscher.com/images/attachtypes/txt.png)
To check the correct operation of the installation, I checked the communication with the device using a normal USB-Modbus-Adapter on the same netPI.
In this case every read out is successful.
![Text Document .txt](https://forum.hilscher.com/images/attachtypes/txt.png)
May be someone has an idea, why the communication with the internal RS485 interface is not stable?
I checked the orginal node-red image for the nedPI. In this case 'rtu-buffered' must be used to get stable values. Otherwise the same problem occurs.
Thanks.
Peter