Skip to content

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

@winnieXY

Description

@winnieXY

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions