I have a python program that works fine with Raspberry Pi 3 and with an older Jessie version.
I've tested Jessie 4.4 version and I got the following error:
p1 = request1.registers
AttributeError: 'NoneType' object has no attribute 'registers'
The code is simple:
import pymodbus
import serial
import time
from pymodbus.pdu import ModbusRequest
from pymodbus.client.sync import ModbusSerialClient as ModbusClient
from pymodbus.transaction import ModbusRtuFramer
client1 = ModbusClient(method = "rtu", port="/dev/ttyAMA0",stopbits = 1, bytesize = 8, parity = 'E', baudrate= 115200)
connection = client1.connect()
request1 = client1.read_holding_registers(0x500B,0x02,unit=1)
p1 = request1.registers
print p1
The UART pins are in state ALT0:
8 | 1 | ALT0 | TxD | 15 | 14 |
10 | 1 | ALT0 | RxD | 16 | 15 |
The /boot/cmdline.txt
file was modified
also the serial interface was disabled.
Any idea what is happening?