![]() Named pipes – An IPC channel that appears as a file in the filesystem. There are several options for building a serial port adapter. The other side would be the module that handles the SPI / RS-485 driver chip. In this case one side of the adapter would be the serial-port-like interface that libmodbus could use. ![]() In software pattern jargon, an adapter is a module that connects two different interfaces. Instead, we took a step back and considered building an adapter. We were wary of this temptation though things tend to look much simpler than they really are. Modbus is not very complicated and we would only need the subset of the protocol used by our peripherals. The obvious option was simply to drop libmodbus and implement our own Modbus library. The project was being developed for a hard deadline and pragmatic solutions were required. On the other hand, this is a proof of concept embedded device already doing plenty of low level hardware control in the user application. The library expects to talk to a serial port but we were using an RS-485 driver chip with an SPI interface, like this:Īrguably the ‘proper’ thing to do would be to write a device driver that provided a serial-port-like interface. This looked good, except for one problem. Not wanting to re-implement a standard protocol, we found libmodbus, a free software library. ![]() We were working on an embedded Linux project with a need to communicate with a sensor that uses the Modbus RTU protocol over RS-485. Sometimes a project presents an assortment of constraints that leads to an unusual problem. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |