1

I am trying to connect to an existing network of devices communicating via RS485 (HMI + PLC, the communication protocol is Fatek's own protocol). I have no problem connecting directly to the PLC (I can read and write registers), but I have to leave the HMI<>PLC connection. When connecting directly to the line between HMI and PLC (via an FTDI USB<>RS485 adapter) I can't read or write registers from the PLC (I don't receive proper responses).

From I've gathered, it's possible to connect multiple devices on one RS485 line, provided they have their addresses set. And here's the problem: I can't see where to set this address. Is it included in every "frame" sent? Is it set somewhere in the driver of the USB<>RS485 adapter? Is it hardcoded in the adapter?

Thank you in advance,

Michał

mpnowacki
  • 33
  • 5
  • Are you using the rs485 ioctls described in the Linux [kernel doc](https://www.kernel.org/doc/Documentation/serial/serial-rs485.txt)? Or does the ftdi adapter provide you with some other api? – meuh Jun 08 '20 at 15:17

3 Answers3

1

Usually in serial communications, either 1:1 or 1:N, there can only be one master (in your case the HMI is the master) and one or more slaves that respond to requests from the master, and the master must always wait to receive the response before submitting a new request.

If you connect a second master you are creating collisions on the network, RS-485 has no way to manage those collisions.

Only one master can exist on the serial network.

If you want to overcome these limitations think about replacing that network with Ethernet and TCP/IP

from56
  • 3,976
  • 2
  • 13
  • 23
0

As the Wikipedia article below, RS485 is an electrical specification with no default software or protocol.
The mechanism for handling the device address must be created by yourself or by selecting a protocol having such a function and applying it.

RS-485 - Wikipedia

RS-485 only specifies electrical characteristics of the generator and the receiver: the physical layer. It does not specify or recommend any communications protocol; Other standards define the protocols for communication over an RS-485 link. The foreword to the standard references The Telecommunications Systems Bulletin TSB-89 which contains application guidelines, including data signaling rate vs. cable length, stub length, and configurations.

For example, isn't Modbus often used?
Modbus -Wikipedia

Modbus is a data communications protocol originally published by Modicon (now Schneider Electric) in 1979 for use with its programmable logic controllers (PLCs). Modbus has become a de facto standard communication protocol and is now a commonly available means of connecting industrial electronic devices. Modbus is popular in industrial environments because it is openly published and royalty-free.

There are also some python packages.
minimalmodbus 1.0.2
pymodbus 2.3.0

How to set the device address will need to be done according to the specifications of the package to be adopted.


In Addition:

By the way, if you are using a manufacturer's proprietary protocol for a PLC device, it is likely that you will be using such multi-drop for that device and protocol. It seems that the first way to do this is to contact the manufacturer's support desk.

Or even if this site is a manufacturer support location, you will need to add information such as what equipment you are trying to connect and in what configuration.

HMI_Support & PLC_Support
HMI_Products & PLC_Products

kunif
  • 4,060
  • 2
  • 10
  • 30
  • Thanks, changing the communication protocol is not an option for the moment. AFAIK these PLCs connected to these HMIs can do multipoint communication, but I can't see in the details of how it's implemented. – mpnowacki Jun 08 '20 at 05:28
0

It looks like your system is using "Fatek communication protocol" which is documented in Appendix 1 of the FB user manual. (Download here)

That protocol looks like many such protocols typical of industrial PLC controllers. However, it is a bit complicated by the number of message types. Without looking too deeply, it seems practical to implement the logic in a few days. Or there is likely an open source implementation somewhere (though I didn't search).

wallyk
  • 56,922
  • 16
  • 83
  • 148
  • I know that document, I used it to implement the communication. As stated in the question, I AM able to read and write registers. I don't see anything about senders address in the specification of this protocol, but RS485 is generally described as having such functionality, maybe it's on a different layer than the data transmission described in said document? – mpnowacki Jun 08 '20 at 05:24
  • @mpnowacki: All communication is between the master and each slave. As such, the master never has to send its own address, just the slave address.. Each slave's message contains its ID. This is described at the bottom of page 1-1. In the data frame the slave's ID is bytes 2 and 3 where the first byte is a STX (^A). Is that any clearer? – wallyk Jun 08 '20 at 14:37
  • yes, i see now, it's impossible to have two masters on one RS485 line – mpnowacki Jun 09 '20 at 15:12