Hello This is Ethan from pilz korea.
I've been encountering problems when using this product.
[Background]
I'm using an Industrial Pi 4 (based on Revolution Pi) with CODESYS Control for Linux ARM64 SL.
My goal is to control a G100C inverter via Modbus RTU over RS485.
I’ve already tested everything using Python (with pymodbus 3.1.1), and communication through /dev/ttyAMA5 works fine.
I can successfully send run commands and set the frequency on the inverter using that port.
However, when I try the same setup in CODESYS, using the same port and parameters, I can't get any response from the inverter.
I’ve checked the official documentation, tutorials, and several forum threads, but none of them helped. I’m stuck and could really use some technical support.
[System Setup]
Device: Industrial Pi 4 (Revolution Pi based)
OS: Raspberry Pi OS 64-bit
CODESYS runtime: CODESYS Control for Linux ARM64 SL (demo version)
RS485 port: /dev/ttyAMA5 (confirmed using dmesg)
Modbus slave: G100C inverter (slave ID 1)
[Modbus Settings]
Baudrate: 19200
Parity: Even
Stop bits: 1
Data bits: 8
Inverter addresses used:
0x0004: Frequency setting (value like 3000 means 300.0 Hz)
0x0005: Run command (0x0042 for forward, 0x0001 for stop)
[CODESYS Configuration]
Inside the device tree, I added both Modbus_Client_COM_Port and Modbus_Server_COM_Port under Modbus_COM.
I mapped COM port 6 to /dev/ttyAMA5 using this entry in CODESYSControl_User.cfg:
Linux.Devicefile.6=/dev/ttyAMA5
In Modbus_Server_COM_Port, I created two channels:
Channel 0 → address 0x0004
Channel 1 → address 0x0005
Both are configured to write single register (function code 6)
I/O mapping is done like this:
Channel 0 is linked to freq
Channel 1 is linked to runCmd
The PLC program runs and updates those variables, but I don’t get any Modbus communication. The slave doesn’t respond at all.
[Questions]
Modbus just isn’t working in CODESYS even though the exact same setup works in Python.
So I have a few questions that I hope someone can help with:
Is it correct to map /dev/ttyAMA5 to COM port 6 in CODESYS? I want to make sure the mapping is actually working the way I expect.
Do I really need to add Modbus_Server_COM_Port just to create channels? I’m only trying to use CODESYS as a Modbus master, and I’m not sure if having a server port could interfere somehow.
Are there any permission issues I should check on the OS side? Like, does the CODESYS runtime need to be in a specific group to access /dev/ttyAMA5?
Since I don’t have a /dev/serial/by-id path, what’s the recommended way to know which COM number maps to which device file?
Modebus RTU Master with CODESYS
-
Ethan Sangwook Park
- Posts: 1
- Joined: 05 Aug 2025, 08:54
Modebus RTU Master with CODESYS
You do not have the required permissions to view the files attached to this post.
-
Amar
- KUNBUS
- Posts: 200
- Joined: 15 Jul 2019, 10:58
Re: Modebus RTU Master with CODESYS
Hello Ethan,
Yes CODESYS project, the COM port 6, is correct for the Industrial Pi 4.
Can you confirm if you are running Bullseye or the latest Bookworm image?
/etc/codesyscontrol/CODESYSControl_User.cfg should include
It can be verified with ModbusRTU_Connect4 project attached in the thread.
viewtopic.php?t=4345
You can perhaps first get the ModbusRTU_Connect4 project running at your side
https://revolutionpi.com/en/tutorial/co ... tu-master
Apart from that i am not sure if you have the correct sequence for Modbus master and slave in the CODESYS device tree.
Modbus COM -> Modbus Master COM Port -> Modbus Slave COM Port
Best regards,
Amar
Yes CODESYS project, the COM port 6, is correct for the Industrial Pi 4.
Can you confirm if you are running Bullseye or the latest Bookworm image?
/etc/codesyscontrol/CODESYSControl_User.cfg should include
Code: Select all
[SysCom]
Linux.Devicefile=/dev/ttyAMAIt can be verified with ModbusRTU_Connect4 project attached in the thread.
viewtopic.php?t=4345
You can perhaps first get the ModbusRTU_Connect4 project running at your side
https://revolutionpi.com/en/tutorial/co ... tu-master
Apart from that i am not sure if you have the correct sequence for Modbus master and slave in the CODESYS device tree.
Modbus COM -> Modbus Master COM Port -> Modbus Slave COM Port
Best regards,
Amar
You do not have the required permissions to view the files attached to this post.
KUNBUS