brainelectronics / micropython-modbus

MicroPython Modbus RTU Slave/Master and TCP Server/Slave library
GNU General Public License v3.0
104 stars 45 forks source link

TypeError: extra keyword arguments given while trying to create a ModbusRTU instance #95

Open winnieXY opened 1 month ago

winnieXY commented 1 month ago

Description

I'm failing to create a ModbusRTU object on a blackpill device. See below for a minimal working example.

I would be more than happy to get some advice what's wrong here.

Reproduction steps

  1. Include umodbus as extmod within micropython
  2. Load it (working flawlessly)
  3. Try to execute the code below ...

MicroPython version

v.1.24.0

MicroPython board

other

MicroPython Modbus version

# e.g. v2.3.3
# use the following command to get the used version
import os
from umodbus import version
print('MicroPython infos:', os.uname())
print('Used micropthon-modbus version:', version.__version__))

MicroPython infos: (sysname='pyboard', nodename='pyboard', release='1.24.0-preview', version='v1.24.0-preview.100.g358e501e7.dirty on 2024-07-16', machine='WeAct_Core with STM32F411CE')
Used micropthon-modbus version: 2.3.7

Relevant log output

>>> ModbusRTU(addr=1, pins=(MODBUS_TX_PIN, MODBUS_RX_PIN))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "umodbus/serial.py", line 1, in __init__
  File "umodbus/serial.py", line 1, in __init__

User code

from umodbus.serial import ModbusRTU
import pyb

MODBUS_TX_PIN = pyb.Pin.board.PA15
MODBUS_RX_PIN = pyb.Pin.board.PB3

#also fails
from machine import Pin
MODBUS_TX_PIN = Pin('PA15')
MODBUS_RX_PIN = Pin('PB3')

foo = ModbusRTU(  
            addr=1,  
            pins=(MODBUS_TX_PIN, MODBUS_RX_PIN)
     )

Additional informations

No response