Closed haveyouseenf closed 5 months ago
Thank you @haveyouseenf for reporting! We will investigate.
Potential fix is being tested. See https://github.com/arduino-libraries/Arduino_POSIXStorage/pull/21 @haveyouseenf If you like to help testing you would need to install the latest version of Arduino_POSIXStorage library from its main branch in the repository.
@sebromero sorry for the delay! I tested with the patched Arduino_POSIXStorage library and that indeed fixed the issue. I plan to close this issue once the updated library is officially available via arduino-cli, agreed?
I wrote a sketch for my Opta that reads periodically from the register of a device connected via Modbus, then writes the value in a text file stored on a USB device. Unfortunately, I noticed that when using this library I am no longer able to read from the device using the Modbus channel, as
ModbusRTUClient.read()
returns-1
which corresponds to an error.I suspect this happens because on the Opta the
Arduino_UnifiedStorage
library uses serialRS485
for debug purposes. I setdebuggingModeEnabled
to false in my code, but nothing changed. The only workaround I was able to find is to move theRS485
and Modbus initialization at the end of mysetup()
code, however it is error prone and I find it odd that theArduino_UnifiedStorage
would change my serial configuration when debugging is disabled. Furthermore, I could not find any documentation on this.I managed to reproduce the issue multiple times, so I will attach the
setup()
code below so you can see how moving the serial and Modbus init code changes the behavior of theModbusRTUClient.read()
:For completeness, I will also attach the full code of the sketch so you can take a look and try to reproduce the issue if you want:
Click to expand
```cpp #includeFor the record, I tried patching the library by changing
Boards.h
at line 24 like this:but the library would still change my serial configuration. If I can provide further details or assistance just let me know!