問題タブ [banana-pi]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
2 に答える
5938 参照

python - Modbus Error: [Invalid Message] Incomplete message received, expected at least 2 bytes (0 received)

Problem

pymodbus master/client can send a request to the slave/server. The slave/server make the things to return ready and is waiting for the master/client to pick them up. Despite the readiness of the server/slave, the master/client just returns the error "Modbus Error: [Input/Output] Modbus Error: [Invalid Message] Incomplete message received, expected at least 2 bytes (0 received)".

Setup

I use the laptop as server/slave with this adapter: https://www.amazon.com/dp/B076WVFXN8/ref=twister_B076X1BS4H?_encoding=UTF8&psc=1

I have an Raspberry Pi 3 / BananaPi as master/client with this adapter attached: https://www.aliexpress.com/item/32781613765.html?spm=a2g0s.9042311.0.0.1aec4c4d0EXx8M

I am following most of this tutorial for the setup, except for the Arduino is swapped with the laptop adapter: https://circuitdigest.com/microcontroller-projects/rs485-serial-communication-between-arduino-and-raspberry-pi - pin connections for the Raspberry is as in the tutorial.

I have this program as server/slave on my laptop:

The python version on server/slave is:

And I start it with this command:

I have the following as master/client on the Raspberry Pi 3 / BananaPi:

Test and analyse

I have tried Raspberry Pi 3 as well as BananaPi. Same results.

I have tried baudrate= 9600, 38400 and now 115200.

timeout is already high as you can see in the code.

Logs for server/slave:

The above server/slave just waits with a blinking curser after this last log line...

Logs for master/client:

The python version on master/client is:

And I start it with this command:

The rights for the /dev's on the Raspberry/BananaPi are:

And on the server/slave on the laptop:

I have tried to send simple numbers with RS485 protocol. They can be send from master/Raspberry/BananaPi to the laptop, but not the other way around.

Have I the wrong rights settings for the devices?...

What am I doing wrong?...

What am I missing?...

As RS485 only works in the one way, I do not think that pymodbus is the problem (?)... (My logic says that pymodbus builds in the RS485 standard, and if that underlying layer of RS485 does not work, pymodbus will not. Is that assumption correct?)

I know some people are talking about that the Raspberry Pi is 3.3V on the pins and does not work with 5V pin-units. Despite that does all tutorials seem to ignore that fact and work. - Or are they just faking that it works? The TTL specifications say that all above 2.5V will be accepted as HIGH. SO in THEORY, 3.3V should be OK, just as the tutorials suggest.

I have by purpose yet not attached any resistors on the tx/rx wires for pull up/down. The tutorials don't suggest them.

I have tested the RS85 adapter sitting on the laptop with a modbus temperature-humidity sensor. This seems to work flawless. So this fact points in direction of BananaPi/Raspberry Pi and the RS485 adapter combination + software + settings to be flawed somehow.