Skip to content

Communication problem in Modbus RTU #35

@rickypid

Description

@rickypid

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 discovered that this line of the tutorial's code:

MachineControl_RS485Comm.begin(baudrate, preDelay, postDelay);

had not been updated to reflect the change made by #27.

I added the missing the config argument:

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

I submitted a correction for the tutorial: arduino/docs-content#2779

I ran the tests in both half and full duplex without success. Even with the correction, the problem persists. 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

I don't understand where the problem lies. We have purchased many Portenta Machine Controls for this purpose, so if it does not work, we need to figure out how to solve the problem.

This is my PlatformIO ini file:

[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

Additional context

Related discussion:

https://forum.arduino.cc/t/arduinomodbus-rs485-with-portenta-machine-control-basic-guide-updated-for-the-new-arduino-portentamachinecontrol-library/1030490/18

Metadata

Metadata

Labels

type: imperfectionPerceived defect in any part of project

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions