Skip to content

Conversation

@hamiltonkibbe
Copy link

Changed _rtu_frame_size from 3 to 7 to match Modbus spec.

The incorrect frame size prevented the RTU framer from decoding these requests.

A Read Device Identification request is a total of 7 bytes when using the RTU protocol:

Byte Field Description Example
0 Slave Address 0x00
1 MEI Function Code 0x2B
2 MEI Type 0x0E
3 Read Device ID Code 0x02
4 Object ID 0x00
5 CRC-16 LSB 0x4D
6 CRC-16 MSB 0x47

I've added a test case to the mei_message tests to cover this, and fixed a typo in one of the other mei_message tests which was causing it to fail

This fix has been tested against pymodbus server, as I don't have any devices that implement the MEI functions. I've verified that the data on the wire matches the expected data per the spec.

Hamilton Kibbe added 2 commits February 23, 2016 23:41
Read Device Identification request PDU is 4 bytes: function code (0x2B), MEI type (0x0E), Read Device ID Code(0x01-0x04), and an Object ID (0x00-0xFF)
RTU adds 3 bytes: 1-byte slave address, and 2-byte CRC for a total of 7 bytes on the wire.

Tested against pymodbus server, as I don't have any devices that implement this code, but the data on the wire matches the expected data per the spec.
@bashwork bashwork merged commit 4dcd54c into pymodbus-dev:master Jun 6, 2016
ccatterina pushed a commit to ccatterina/pymodbus that referenced this pull request Apr 17, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants