Cloud-Automation / node-modbus

Modbus TCP Client/Server implementation for Node.JS
465 stars 174 forks source link

Wrong CRC calculation in RTU serial mode #215

Closed svobodb closed 6 years ago

svobodb commented 6 years ago

CRC calculation of serial RTU requests seems to be implemented incorrectly. Client address (first byte) should be included in the calculation (it is skipped currently) and the CRC should be transmitted as little endian (it is transmitted as big endian currently).

I have noticed this because my devices do not respond to the current node-modbus implementation-generated requests.

You can find the fixed rtu-request.js in the attachment: rtu-request.js.txt

Note that the same problem is in CRC check of the received responses.

stefanpoeter commented 6 years ago

Alread fixed in branch v3.1-dev. Will be released soon.