I found an issue where modbus_send_rtu would get stuck on waiting for the spin lock when it was called in the context of
|
packet->callbacks.on_rx_exception(ModBus_CRCError, packet->msg.context); |
This seemed to be related to having two sources calling modbus_send in rapid succession (Modbus RGB plugin and VFD plugin). I was able to work around it by releasing the spinlock around the callback, but I'm not sure this is the best solution:
spin_lock = false;
packet->callbacks.on_rx_exception(ModBus_CRCError, packet->msg.context);
spin_lock = true;
I have also put the same unlock around the rx_timeout callback.
I found an issue where modbus_send_rtu would get stuck on waiting for the spin lock when it was called in the context of
core/modbus_rtu.c
Line 223 in 1445a42
This seemed to be related to having two sources calling modbus_send in rapid succession (Modbus RGB plugin and VFD plugin). I was able to work around it by releasing the spinlock around the callback, but I'm not sure this is the best solution:
I have also put the same unlock around the rx_timeout callback.