Skip to content

Communication problem in Modbus RTU #35

@rickypid

Description

@rickypid

Good morning,

I tried to establish Modbus RTU communication between Arduino Portenta Machine Control and a device, but without success. I wanted to follow the example given here to the letter: https://docs.arduino.cc/tutorials/portenta-machine-control/user-manual/#modbus-rtu

I ran the tests in both half and full duplex without success. I don't understand where the problem lies. Following the example I gave above, I noticed an error:

MachineControl_RS485Comm.begin(baudrate, preDelay, postDelay);

Following your library, MachineControl_RS485Comm.begin should have the config parameter, so it should be (#27):

MachineControl_RS485Comm.begin(baudrate, SERIAL_8N1, preDelay, postDelay);

This is the error:

- Writing coil values ... - Failed! Error code: Connection timed out
- Writing coil values ... - Failed! Error code: Connection timed out
- Writing coil values ... - Failed! Error code: Connection timed out
- Writing coil values ... - Failed! Error code: Connection timed out

However, even with this correction, the problem persists. We have purchased many Machine Controls for this purpose, so if it does not work, we need to figure out how to solve the problem.

This is my Platform.io ini

[env:portenta_h7_m7]
platform = ststm32@~19.4.0
board = portenta_h7_m7
framework = arduino
build_flags = -Os -flto
lib_deps = 
	arduino-libraries/ArduinoBLE@^1.4.1
	bblanchon/ArduinoJson@^7.4.2
	arduino-libraries/ArduinoRS485@^1.1.1
	arduino-libraries/Arduino_PortentaMachineControl@^1.0.4
	arduino-libraries/ArduinoMqttClient@^0.1.8
	mobizt/ESP_SSLClient@^2.2.3
	arduino-libraries/ArduinoModbus@^1.0.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions