-
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
Custom MODBUS read/write handlers (IDFGH-4907) #6700
Comments
Thanks for raising this feature request. |
Thank you for your proposals which sound useful. The feature to add the option to change the core affinity of the modbus tasks will be useful and will be implemented. |
@alisitsyn |
I prepare and check the example for you. I will share it as soon as possible (could be today). |
The example to override the callback function in Modbus stack is here: https://github.com/alisitsyn/modbus_support/tree/mb_support/mb_override_callbacks/mb_override_slave The folder components/freemodbus in this example contains the files required to override the modbus controller object represented in the freemodbus component folder of ESP-IDF. The special CMakeLists.txt is used to override the private files in the component folder. This technique can be used to allow definition of custom read/write callbacks for Modbus stack in your project and not limited only for this purpose. Below is the patch to add affinity kconfig option for modbus tasks: Please check the example project and let me know the results. |
@alisitsyn Thanks, I got it working. Do you want me to close this issue, or keep it open until the affinity patch is added to the master branch? |
Good to know it helps. Please leave the issue opened. Once the affinity MR is merged the issue will be closed automatically. Please be patient because merging of these fixes usually delayed. Thanks. |
@alisitsyn The affinity patch works, but when I create a serial slave the "uart_queue_task" created in |
@allard-potma, Thank you for this reminder. I missed one commit and updated this patch again: |
Closes espressif/esp-idf#6700 * Original commit: espressif/esp-idf@dfcc434
The mb_override_slave example is no longer available. Could you please upload it again or point to the file? Thank you in advance. |
@thiagoprati , I think you are looking for this mb_override_slave project or this one. Please let me know if you need further help. |
I would like to write my own modbus slave register callbacks. The stack and the Espressif port already allows this, see the slave interface in mbc_slave.h :
If i'm correct the **handler in
esp_err_t mbc_slave_init(mb_port_type_t port_type, void **handler)
points to a mb_slave_interface_t object, but i'm not able to cast the void pointer to this type because the type is defined in a private h file.My suggestion is to move mb_slave_interface_t to a public h file, or provide a function to edit the register callback function pointers.
The second feature request is to add the option the change the core affinity of the modbus tasks when initializing the stack, inline with other ESP-IDF components that allow this.
The text was updated successfully, but these errors were encountered: