alejoseb / Modbus-STM32-HAL-FreeRTOS

Modbus TCP and RTU, Master and Slave for STM32 using Cube HAL and FreeRTOS
GNU Lesser General Public License v2.1
518 stars 182 forks source link

Task is suspended forever #77

Closed marnidRed closed 1 year ago

marnidRed commented 1 year ago

Hello,

I'm using your library with FreeRTOS. I configured several tasks - two of them are responsible for MODBUS-RTU communication: just two independent masters on two USARTs. Unfortunetly always after some hours of working, one of these two tasks get state "suspended" forever. "Suspended" is also task "TaskModbusMaster". Have you any idea, what's wrong? Of course I'll give more informations about system, but please tell me what is necesesery.

alejoseb commented 1 year ago

I am not sure what could be the issue, but this may not be directly related to the library. You need to check the semaphores and the way that you are handling that. Eventually you are blocking the semaphore, then the modbus task will get suspended till it is released.

marnidRed commented 1 year ago

Thank you for the answer. I see that that my problem in modbus.c is here - I never get notification, but I have to debug why. Przechwytywanie

alejoseb commented 1 year ago

You have to verify that the timeout timer is actually running. If you run-out of memory the timeout will be also suspended and, if the slave never answer the timeout will not be triggered and you will end up with the task suspended indefinitely.