-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
Freemodbus serial slave allow to access one extra register beyond data area (IDFGH-4768) #6571
Comments
Thank you for your issue.
came from the stack which calls the callback function with address parameter already increased by one. It is better to fix it in |
The line 66 of esp_modbus_slave.c is a body of mbc_slave_find_reg_descriptor(...) function, so does it mean the fix is in right place? |
Yes, the fix above looks correct to me. The MR is actual and will be merged ASAP. I do not have any expectation when it will be merged. |
Any updates on this? The commit ID above cannot be found. |
The fix has been merged two weeks ago with commit #60dfb09122f079af4e513a87e3778a5de252e6ca. If I understood you correctly you register two continous areas and try to read them in one transaction. This case is not supported for now. You can define it as a whole one area instead if you need to read it in one transaction. The feature with definition of multiple modbus areas is designed to define several address spaces with the gaps between them. |
Fixes espressif/esp-idf#6571 * Original commit: espressif/esp-idf@0d3f19b
If you defined area descriptor with size let's say 4 byte (2 modbus registers), the slave modbus will react without error
on requests up to 3 registers, returning unknown value for 3rd one.
I think the problem is in 'esp_modbus_slave.c: 66'
&& ((addr + regs) <= (it->start_offset + reg_size +1)) // <-- why +1 is here?
if removed, modbus slave works as expected.
It is checked in 0-based modbus addressing.
The text was updated successfully, but these errors were encountered: