Arduino-SDI-12 icon indicating copy to clipboard operation
Arduino-SDI-12 copied to clipboard

Examples Will Now Compile For Arduino R4 And Communicate (With Some Modifications)

Open electromechpro opened this issue 1 year ago • 2 comments

Thank you for the work last week with micros() on trying to get the Renesas platform 48 MHz Arduino R4 boards to run the SDI-12 library. When we updated the SDI12 library, the examples would compile for an Arduino R4, but we could not get it to send or receive data to/from an EnviroPro EP100G moisture probe. The earlier R3 Arduinos will communicate ok.

I do not know what the cause is, but here are some observations we made:

1: The resolution of micros does not appear to be 1 microsecond for the 48 MHz R4.

  • It may be 2, 3, 4, etc. Some test code we used seemed to put it between 2 and 3, but the code was minimal. Any sketch running other functions may cause micros to be even more.

2: The "TICKS_PER_BIT 833UL" line looks different from the other ticks per bit lines that have just a number after "BIT ".

3: Around line 205 in SDI12_boards.h, for the case "F_CPU >= 48000000L", that does not have "PRESCALE_IN_USE_STR" with some kind of string after it.

I hope the above are helpful. We would really like to upgrade the R3 UNOs to R4s and have more functionality. I can imagine it would not be possible to test if the library works with an UNO R4 without having one on hand. Can I help by testing out some code ideas with the R4 boards we have here and carefully describing any errors we get? I regret I do not have the knowledge to adapt the library myself, but would be glad to assist you.

electromechpro avatar Aug 21 '24 20:08 electromechpro