I’m using a RAK4630 with Arduino BSP and I need a reference to elapsed time. I’m trying to use micros() but the resolution seems to be about 1ms. I created a loop that waits for micros to update and then prints the time, and here is the result: 976 1952 2929 3906 4882 5859 6835 7812
. As you can see, the resolution is about 976uS. I need something at least an order of magnitude more precise, ideally down to about 4 or 8 uS resolution (which is typical on an AVR-based Arduino.
How can I get an equivalent to micros() that is actually usable?
As an alternative, what timer functionality is available without interfering with BLE, LORA, or other systems (USB, UART, I2C, etc.)?
I don’t specifically need the value to be represented in uS units, I would be fine with a different unit, as long as it’s precise to a similar level as described above. For example, if the system clock is 32MHz, I would be okay with a clock source that is divided by 64 (each unit would be 2uS) or 256 (125kHz = 8uS) or for this application even 1024 (31,250Hz = 32uS).
I need precise timing because I’m interfacing with hardware that requires it.
I look forward to any advice and suggestions offered.