Raspberry Pi 2 Model B (以下RPi)
Raspbian Jessie
pySerial 2.6-1.1
Python 2.7.9
RPiでMODBUS通信を行う場合、どういうライブラリが必要か?
下記を見つけた。
HOW TO USE MODBUS WITH RASPBERRY PI
上記で紹介されているのがMinimalModbus
http://minimalmodbus.readthedocs.io/en/master/index.html
pipでのインストール
http://minimalmodbus.readthedocs.io/en/master/installation.html
API
http://minimalmodbus.readthedocs.io/en/master/apiminimalmodbus.html
Manual testing of Modbus equipment
http://minimalmodbus.readthedocs.io/en/master/modbusdetails.html#manual-testing-of-modbus-equipment
setup
上記ドキュメントに基づきインストールできた。
$ sudo pip install minimalmodbus
MODBUS製品との通信
MODBUS製品と通信をしてみたが応答がない。
一方で、Windows 10でRS232Cテストツール(NonSoft様)で通信をするとデータシート通りの応答がある。
RPi + MinimalModbus + USBシリアル + pySerial
の組合せの問題だろうか。
MinimalModbus を使わない通信でも失敗した。
別途、とある組込み基板での実装を試したところ、応答を確認できた。
使用ラインはTX, RX, GNDのみ。
(調査は保留)。