pablofsmelo
I'm trying to connect a Modbus client to OpenPLCV3 but I'm having difficulties. There appears to be a permission error on the connection socket. As I use both on my Raspberry  (V2 and V3) to compare the tests, I eventually have problems with the server's runtime. I always use some command to kill that port and everything works fine.

When I connect my Modbus Client to OpenPLC v2, I can connect perfectly. Using this same client to connect to V3, I can not establish the connection. It is worth mentioning that v2 and v3 are not running simultaneously, this is, time I test with one version, time with another. I have already tried to kill the server's execution port, Modbus port, re-install all packages from scratch and test another Modbus client, but I did not succeed.

Can you tell me if Modbus is working perfectly for Raspberry PI in OpenPLC version 3? If so, what could be happening?

Thank you.
Quote 0 0
thiagoralves
It should work better on v3 actually. The code is much more polished. What is the error you’re getting?
Quote 0 0
pablofsmelo
Here is the error
Quote 0 0
thiagoralves
It looks like you're running v3 without sudo (root) permissions. Linux OS forbids any application to open any socket below port 1024 if they're not running as root. If you don't want to elevate OpenPLC v3 permissions, just go to settings and change the port to 5020 (instead of 502).
Quote 0 0
Tekeff
Hello,

I have similar question. I'm try connect some device via the Modbus and I'm get the error for read/write like 'Illegal function', see the logs:

OpenPLC Runtime starting...
Interactive Server: Listening on port 43628
Device ISS-T5_Sun-sensor is disconnected. Attempting to reconnect...
Connected to MB device ISS-T5_Sun-sensor
Modbus Read Discrete Input Registers failed on MB device ISS-T5_Sun-sensor: Illegal function
Modbus Write Coils failed on MB device ISS-T5_Sun-sensor: Illegal function
Modbus Read Input Registers failed on MB device ISS-T5_Sun-sensor: Illegal function
Modbus Read Holding Registers failed on MB device ISS-T5_Sun-sensor: Illegal data address
Modbus Write Holding Registers failed on MB device ISS-T5_Sun-sensor: Connection timed out
Issued start_modbus() command to start on port: 502
Modbus Server: Listening on port 502
Modbus Server: waiting for new client...
Modbus Read Discrete Input Registers failed on MB device ISS-T5_Sun-sensor: Illegal function
Modbus Write Coils failed on MB device ISS-T5_Sun-sensor: Illegal function
Modbus Read Input Registers failed on MB device ISS-T5_Sun-sensor: Illegal function
Modbus Read Holding Registers failed on MB device ISS-T5_Sun-sensor: Illegal data address
Issued start_dnp3() command to start on port: 20000
DNP3 ID manager: Starting thread (0)
DNP3 ID DNP3_Server: Listening on: 0.0.0.0:20000
Modbus Write Holding Registers failed on MB device ISS-T5_Sun-sensor: Connection timed out
Modbus Read Discrete Input Registers failed on MB device ISS-T5_Sun-sensor: Illegal function
Modbus Write Coils failed on MB device ISS-T5_Sun-sensor: Illegal function
Modbus Read Input Registers failed on MB device ISS-T5_Sun-sensor: Illegal function
Modbus Read Holding Registers failed on MB device ISS-T5_Sun-sensor: Illegal data address
Modbus Write Holding Registers failed on MB device ISS-T5_Sun-sensor: Connection timed out
...

How is the probable issues? Should the device work with a specific (accuracy) start address setting?

Thank you
Quote 0 0
thiagoralves
You're using wrong addresses and wrong functions. The logs doesn't show which addresses you're trying to use, but I can guess from the errors that your device doesn't support input status, coils or input registers. The only thing it seems to support is holding registers, however, the addresses you're trying to use are still out of range for your device.
Quote 0 0