COM PORT Modbus RTU master issues

Topics about the Software of Revolution Pi
Post Reply
Latassan
Posts: 2
Joined: 06 Sep 2024, 15:05

COM PORT Modbus RTU master issues

Post by Latassan »

I want to use my Revolution Pi Core S as a Modbus master.
My configuration: ARM64 Linux runtime, baudrate 19200, parity EVEN, 8 data bits and 1 stop bit.
I first followed this tutorial to configure the revolution pi via Pictory: https://youtu.be/gaJ6-D4Vd6A

First problem: in Pictory, after adding the ModbusRTU Master module and configuring (screenshot 1), I do “Save as start config.” then “Reset driver”. However, when I return later to PiCtory, sometimes the Modbus Master is still present, sometimes it has disappeared. I haven't been able to identify why it sometimes disappears.

I followed this guide for Codesys: https://revolutionpi.com/en/beispiel-mo ... u-master-2
When I connect to my Revolution Pi, the bus has never worked despite my various tests. (screenshot 2).
I use an external USB-RS485 converter, it's COM Port 4 when I use it with my computer. So I modified the CODESYSControl.cfg and CODESYSControl_User.cfg files by adding :
[SysCom]
Linux.Devicefile=/dev/ttyUSB3
And I've configured the COM Port in modbus as follows: (screenshot 3)


I doubt the addition of the “Linux.Devicefile=/dev/ttyUSB3” lines in the configuration files, because when I connect to the Revolution Pi via SSH and execute the command “echo ‘HELLO’ > /dev/ttyUSB0”, I receive a message on my computer (architecture: Revolution Pi => USB/RS485 => RS485/USB => computer).

So I also tried writing to the configuration files:
[SysCom]
Linux.Devicefile=/dev/ttyUSB0

With these tests, the serial port never worked either.

This is my first use of the Revolution Pi. I'd like to know why configurations made via PiCtory don't register correctly?
Why does the serial port remain inactive?
Attachments
SerialPort_not_running.png
PiCtory.png
Config_COM_port.png
User avatar
dirk
KUNBUS
Posts: 2174
Joined: 15 Dec 2016, 13:19

Re: COM PORT Modbus RTU master issues

Post by dirk »

Hello Latassan thanks for the comprehensive bug report and the setup of your system.
CODESYS overwrites the PiCtory configuration.
Find external USB-RS485 interface via

Code: Select all

ls /dev/ttyUSB*
Configure CODESYS i.e. /dev/ttyUSB3 equals Dropdown "COM port 4"
chrome_wlqkcw0G2Q.png
Regards
Latassan
Posts: 2
Joined: 06 Sep 2024, 15:05

Re: COM PORT Modbus RTU master issues

Post by Latassan »

Hello dirk, thank you for your reply.

The interface of my USB - RS485 interface is ttyUSB0
ttyUSB0.png
.
In codesys I configure the COM PORT as follows:
portCODESYS.png
.
I've added the necessary lines to CODESYSControl.cfg:
[SysCom]
Linux.Devicefile=/dev/ttyUSB0

By the way, this file is located in /etc/codesyscontrol/CODESYSControl.cfg in my revolution pi, and I've added these lines at the end of the file, does it matter?
However, the bus remains in the “not running” state.
not_running_2.png
I still tried to run my code by listening to my computer's com port, but no reception.
(same architecture as above: Revolution Pi => USB/RS485 => RS485/USB => computer).

Regards,
Last edited by Latassan on 10 Sep 2024, 11:48, edited 1 time in total.
Latassan
Posts: 2
Joined: 06 Sep 2024, 15:05

Re: COM PORT Modbus RTU master issues

Post by Latassan »

Hello,

For those who are interested, I have found the source of the problem. My mistake was to add the following lines to the CODESYSControl.cfg file:
[SysCom]
Linux.Devicefile=/dev/ttyUSB0

instead of the lines :
[SysCom]
Linux.Devicefile=/dev/ttyUSB

Regards,
User avatar
dirk
KUNBUS
Posts: 2174
Joined: 15 Dec 2016, 13:19

Re: COM PORT Modbus RTU master issues

Post by dirk »

Hello Latassan, thank you for your positive reply and your explanations. That helps us to understand this better, great.
Post Reply