You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Race condition: ModbusRTUServer.begin() sometimes quietly rejects config #135
I was experiencing a very difficult to debug issue with this library on my RP2040 wherein seemingly very similar code produced a different result. Ultimately this proved to be a race condition, in which ModbusRTUServer.begin() sometimes was not accurately loading in my provided serial format and instead used the default.
Device ignoring provided argument provided as argument config above, instead just using the default, SERIAL_8N1
Temporary resolution to issue:
Call ModbusRTUServerClass.begin() multiple times (I put mine in a for loop of 100 times). This is an extremely hacky solution and not guaranteed to work 100% of times, but it proves the issue exists in the wild.
Proposed resolution:
Root cause the race condition / issue with successfully setting this config in all situations, and add functionality to check that the config has successfully been loaded, possibly with a set + get combo with a delay for the loading to take effect.
Details:
RP2040
Latest ArduinoModbus release
Easiest to replicate at high baud rates (115200 and above)
Activity