air4
Hello

I am trying to connect with Siemens LOGO controller  with the use of Modbus TCP ( OpenPLC on RPi).
The error I got in logs:
Przechwytywanie.jpg Configuration:
Przechwytywanie.jpg
It is not possible to read/write configurated variables.
Do you have any suggestions how to solve the problem?
Regards  

Reply 0 0
thiagoralves
169.x.x.x is an invalid IP. Check the network settings on your LOGO PLC because with this IP it does not have access to your network and hence OpenPLC won’t be able to talk to it
Reply 0 0
air4
What IP should I have on my logo device?
169.x.x.x is my LOGO device IP, should I change it?
My RPi ehternet port IP is 169.254.197.185
I can ping LOGO from RPi
Reply 0 0
thiagoralves
From Google: "169.254. x.x: This is what's called an Automatic Private IP address. An IP in this range means that the computer cannot see the network. A computer using DHCP needs to have an external server tell it what IP address to use."

Any IP address starting with 169.254.x.x is invalid, which means that the device wasn't able to get an IP from the DHCP server. Please contact your network administrator to properly setup the connection between your Pi and your PLC.
Reply 0 0
air4
Ok, so if I change LOGO IP address e.g. 192.168.0.1 and I do not change RPi ethernet port IP address it should work? 
Reply 0 0
thiagoralves
No, because the Pi also has an invalid IP
Reply 0 0
air4
Thank You for answers. I have changed IP RPi to 192.168.0.10/24, gateway 192.168.0.1 and LOGO controller to 192.168.0.2/24, gateway 192.168.0.1. As a result I still get messege about bad file descriptor which I attached above.
Reply 0 0
thiagoralves
You either still have some networking issue that needs to be troubleshooted or Modbus service is not enabled in your LOGO PLC
Reply 0 0
air4
Ok, thank for your help. I will try to solve it.
I have another question about address mapping. If in my device modbus has reference for %Q01 equal to 1 I need to set a start address Coils 1 in openplc? 
If I want to get access to %R1, I need to set the start address 43001 for Holding Registers - Write in openplc? 
madbus.png 
Reply 0 0
thiagoralves
This "Traditional Modubs Reference" column is normally used with Modbus RTU Serial. For Modbus TCP you should work with the "Modbus Offset" instead. OpenPLC only references from Modbus offset. So on OpenPLC you should use address 3000 for %R1. Keep in mind that Holding Register - Read and Holding Register - Write are different. Even though they access the same registers on the slave device, you should use Holding Register - Read to map a slave register as input (it will go to %IW100 onward), and Holding Register - Write to map a slave register as output (it will go to %QW100 onward).
Reply 0 0
air4
Thank You very much for help. I still do not connect with LOGO PLC but I understand much more then before. If I find solution I will post it.
Reply 0 0
Johnny5
I have a similar problem. The coils read/write works fine. My device is a plain TCP modbus slave. 4 inputs (19990-3), 6 outputs (9990-3), 4 Analog inputs (39990-3) and 4 Analog outputs (49990-3). I configured a Blinky program to use %Q100.1 succesfully. The device has been tested with RADZIO and everything works. Here is an image of the boards I/O.
 
[203128%2F9680850%2Fmceclip0]
 
The openplc runtime Generic Modbus TCP Slave
 
[203128%2F9680860%2Fmceclip0]
 
The openplc runtime errors in the log...
 
OpenPLC Runtime starting...
Interactive Server: Listening on port 43628
Device ESP32C6_PLC-100 is disconnected. Attempting to reconnect...
Persistent Storage is empty
Connected to MB device ESP32C6_PLC-100
Issued start_modbus() command to start on port: 502
Server: Listening on port 502
Server: waiting for new client...
Issued stop_dnp3() command
Issued start_enip() command to start on port: 44818
Server: Listening on port 44818
Server: waiting for new client...
Issued stop_pstorage() command
Issued start_snap7() command
Snap7: 2026-02-15 20:19:29 Server started
Modbus Write Coils failed on MB device ESP32C6_PLC-100: Connection reset by peer
Modbus Read Input Registers failed on MB device ESP32C6_PLC-100: Bad file descriptor
Device ESP32C6_PLC-100 is disconnected. Attempting to reconnect...
Connected to MB device ESP32C6_PLC-100
Modbus Write Coils failed on MB device ESP32C6_PLC-100: Connection reset by peer
Modbus Read Input Registers failed on MB device ESP32C6_PLC-100: Bad file descriptor
Device ESP32C6_PLC-100 is disconnected. Attempting to reconnect...
Connected to MB device ESP32C6_PLC-100
Modbus Write Coils failed on MB device ESP32C6_PLC-100: Connection reset by peer
Modbus Read Input Registers failed on MB device ESP32C6_PLC-100: Bad file descriptor
Device ESP32C6_PLC-100 is disconnected. Attempting to reconnect...
Connected to MB device ESP32C6_PLC-100
 
Do you have an idea on what I am doing wrong?
Reply 0 0
thiagoralves
The addresses are all wrong. Use address base 0 (offset) instead of base 9990
Reply 1 0
Johnny5
Ok. I am moving all registers to base 0. Will show the result soon. Thanks for the response.
The RMMS RADZIO gives this with new MODBUS registers.
[203128%2F9681586%2Fmceclip0]
 
My web page ...
[203128%2F9681600%2Fmceclip0]
 
OpenPLC runtime on localhost:8080
[203128%2F9681617%2Fmceclip0]
 
The logs ...
OpenPLC Runtime starting...
Interactive Server: Listening on port 43628
Device ESP32C6_PLC-100 is disconnected. Attempting to reconnect...
Persistent Storage is empty
Connected to MB device ESP32C6_PLC-100
Modbus Read Discrete Input Registers failed on MB device ESP32C6_PLC-100: Illegal data value
Modbus Write Coils failed on MB device ESP32C6_PLC-100: Bad file descriptor
Modbus Read Input Registers failed on MB device ESP32C6_PLC-100: Bad file descriptor
Modbus Read Holding Registers failed on MB device ESP32C6_PLC-100: Bad file descriptor
Modbus Write Holding Registers failed on MB device ESP32C6_PLC-100: Bad file descriptor
Issued start_modbus() command to start on port: 502
Server: Listening on port 502
Server: waiting for new client...
Issued stop_dnp3() command
Device ESP32C6_PLC-100 is disconnected. Attempting to reconnect...
Issued start_enip() command to start on port: 44818
Server: Listening on port 44818
Server: waiting for new client...
Issued stop_pstorage() command
Issued start_snap7() command
Snap7: 2026-02-16 12:28:54 Server started
Connected to MB device ESP32C6_PLC-100
Modbus Read Discrete Input Registers failed on MB device ESP32C6_PLC-100: Illegal data value
Modbus Write Coils failed on MB device ESP32C6_PLC-100: Bad file descriptor
Modbus Read Input Registers failed on MB device ESP32C6_PLC-100: Bad file descriptor
Modbus Read Holding Registers failed on MB device ESP32C6_PLC-100: Bad file descriptor
Modbus Write Holding Registers failed on MB device ESP32C6_PLC-100: Bad file descriptor
Device ESP32C6_PLC-100 is disconnected. Attempting to reconnect...
Connected to MB device ESP32C6_PLC-100
Modbus Read Discrete Input Registers failed on MB device ESP32C6_PLC-100: Illegal data value
Modbus Write Coils failed on MB device ESP32C6_PLC-100: Bad file descriptor
Modbus Read Input Registers failed on MB device ESP32C6_PLC-100: Bad file descriptor
Modbus Read Holding Registers failed on MB device ESP32C6_PLC-100: Bad file descriptor
Modbus Write Holding Registers failed on MB device ESP32C6_PLC-100: Bad file descriptor
Device ESP32C6_PLC-100 is disconnected. Attempting to reconnect...
....
Connected to MB device ESP32C6_PLC-100
Modbus Read Discrete Input Registers failed on MB device ESP32C6_PLC-100: Illegal data value
Modbus Write Coils failed on MB device ESP32C6_PLC-100: Bad file descriptor
Modbus Read Input Registers failed on MB device ESP32C6_PLC-100: Bad file descriptor
Modbus Read Holding Registers failed on MB device ESP32C6_PLC-100: Bad file descriptor
Modbus Write Holding Registers failed on MB device ESP32C6_PLC-100: Bad file descriptor
Device ESP32C6_PLC-100 is disconnected. Attempting to reconnect...
 
Isn't this the correct way of configuring the OpenPLC runtime with remote IO using the Generic TCP MODBUS device? Could it be that my register size is too big?
Reply 0 0
thiagoralves
Most likely your device dos not support the Modbus functions runtime v3 is using. I suggest you switch to editor and runtime v4 which allows you to pick the Modbus functions individually
Reply 1 0
Reply