PFC300 - Serial port through linux with python

Hello,

I’m trying to use the serial ports on a PFC300 and a 750-652 in a Python script, but I’m unsure about the correct device path.

I’ve tried using /dev/serial and /dev/kbus, but both return an error when opening the port.

Which device path should I use? Are there any specific settings I need to previously configure?

Unfortunately, serial interfaces which are on the K-bus can’t be used as standard TTY interfaces.
You can use the embedded port which should be mapped to /dev/serial, but keep in mind this is a RS-485 interface only.
In order to use the 750-652, you’ll need to use CODESYS.

Thanks, Quentin.

I tried to read from the /dev/serial interface again, and it worked this time.

Since it’s not possible to use the K-bus TTY interface, we’re planning to use a PFC configured as a Modbus TCP/Modbus RTU gateway. Is it possible to use the K-bus in this scenario, or should we read the serial slave with the K-bus and store its data in the PFC’s memory?

Also, we had some difficulties using the K-bus in CODESYS. Are there any tutorials available?

WAGO France has developed a ready-to-use application for this purpose :

WagoAppModbusGateway_EN is a CODESYS 3 library for creating a Modbus TCP to Modbus serial (RTU) gateway on a controller equipped with a built-in serial port or one or more serial modules (part numbers 750-652 or 750-1652).

The FbMultiGateway function block can be used to create up to 3 gateways simultaneously. A gateway can support up to 5 simultaneous Modbus TCP connections and 31 serial Modbus slaves.

The function codes supported by the gateway are as follows:

Awesome, I’ll try applying this to our project.

Thanks a lot, I really appreciate it.

Or just add modbus tcp slave/server device and enable serial gateway…
Works perfectly with builtin, not 652 tho