Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The freemodbus stack does not support bulk payload of 150 registers for write request with function code(16) 0x10 (IDFGH-12811) #13787

Open
3 tasks done
BestBot7 opened this issue May 13, 2024 · 1 comment
Assignees
Labels
Awaiting Response awaiting a response from the author Status: Opened Issue is new

Comments

@BestBot7
Copy link

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

I have a slave device which supports writing 150 registers at once which is around 300 bytes. I have framed a modbus request which is greater than 300 bytes including slave ID, function code, register start address, number of registers, number of bytes, data and CRC and sent it to the modbus slave device using standard modbus master template code. In standard documentations it is mentioned that the modbus can support writing multiple registers of 123 registers at once. Is there any way to that can support the bulk and huge payload of writing multiple registers?

@espressif-bot espressif-bot added the Status: Opened Issue is new label May 13, 2024
@github-actions github-actions bot changed the title The freemodbus stack does not support bulk payload of 150 registers for write request with function code(16) 0x10 The freemodbus stack does not support bulk payload of 150 registers for write request with function code(16) 0x10 (IDFGH-12811) May 13, 2024
@alisitsyn
Copy link
Collaborator

alisitsyn commented May 13, 2024

The maximum buffer for the frame is 256 bytes = absolute maximum is 128 registers but the max number of holding registers to read/write is not 128. From the spec:

"The quantity of registers to be read, combined with all the other fields in the expected response, must not exceed the allowable length of Modbus messages: 256 bytes.".
If we take into account the standard fields of Modbus the maximum number of register to read with FC=0x03 drops to 125 registers.

The limitations is hard coded in the stack and for now it is not planned to extend the limit of registers to support non standard slaves. However, it is pretty simple to override in your custom project. This feature will be part of esp-modbus stack v2.

@alisitsyn alisitsyn self-assigned this May 13, 2024
@espressif-bot espressif-bot assigned alisitsyn and unassigned alisitsyn May 14, 2024
@espressif-bot espressif-bot added the Awaiting Response awaiting a response from the author label May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Response awaiting a response from the author Status: Opened Issue is new
Projects
None yet
Development

No branches or pull requests

3 participants