-
Notifications
You must be signed in to change notification settings - Fork 55
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
mbc_master_send_request() doesn't work properly (IDFGH-10848) #32
Comments
Hi @Asanga-Viraj, Thank you for the issue. I think more information from you is required to reproduce this issue. The application:
The log of test application:
host software log (RS485 interface):
If you are sure that it works incorrectly please send your code to reproduce this issue, log of your application with debug verbosity enabled in kconfig and log of the host application (RS485 bus log). Thank you. |
Any update on this issue? Could you please let me know which version of esp-idf and esp-modbus component you are using? |
Hi, I am running complex system in ESP32 with idf 5.0.2 (release) and modbus 1.0.11 (latest) . I extracted what I did for ModBus write to replicate the issue in a single file. I couldn't replicate the issue. Tried many ways, I couldn't. So, may be some fault in my side which I didn't recognized. Thank you for your help. |
Hi @Asanga-Viraj, Could you try to describe your complex system? For example: which active objects (tasks, interrupts) you have and how they dependent to each other and their priorities compare to Modbus priorities, Modbus settings in sdkconfig, etc. Do you have the tasks with priority >= 20 in your system.The modbus uses esp-timer and its task priority is 21, and higher priority tasks can apply to its functionality as well. Other components (wifi, bluethooth, lwip related) are also apply to the functionality of the whole system with their high priority tasks (prio up to 23). Does the issue exist only when you use the Thanks. |
Hi @alisitsyn , I will try to explain the system as much as I can.
Let me know any more information you may want. Thanks. |
Hi @Asanga-Viraj, Thank you for update. Could you share the sdkconfig file as well? Your logging information can also help to improve your system.
Please include the tasks priority for most of your tasks including the tasks which do Modbus read data and comparison. This will help to find solutions for your case.
I would suggest to increase the
My suggestion is to change affinity setting to CPU1. This is required because your LWIP related services (WIFI, ethernet, PPP) use high priority tasks and process data intensively. This allows to increase the reliability of Modbus data procesisng due to deterministic aspects of protocol. In this case it is recommended to move deterministic protocols to other CPU. This will significantly increase the reliability of data reading/writing in highly loaded system.
I recommend to set Please try the suggestions above and report the results. Thank you. |
Hi, Thank you for the support. I updated the values as requested and did testing. Still got the issue. It is not happening all the times, but randomly occurs. I updated the code to handle this ModBus mis-writing. As a information, I added sdkconfig file here. |
Hi @Asanga-Viraj , It is very strange. I need to reproduce this, but could not do it yet. Let me know if you have any update for this. |
I am using ESP32 RTU ModBus master. The reading registers are working fine.
But, writing register doesn't work properly. I am using mbc_master_send_request() function to write register. This function writes value of previous call each time for a specific reg_start address. An example code is below.
This issue can overcome by calling
mbc_master_send_request(&req, (void *)&temp);
with zero value before writing actual value. It seems to be calling this function release resources allocated for reg_start address.What should I do? Am I making invalid requests?
The text was updated successfully, but these errors were encountered: