3

Is there any way to know the resolution of micros() for the Arduino Portenta H7. I have checked for other boards e.g. Nano which is mentioned as 4 uS. However, I couldn't find one for Portenta H7.

Is there any way to measure or look for that

9
  • Maybe grab the value in a tight loop and compute the shortest difference you find?
    – PMF
    Commented Feb 23, 2021 at 12:21
  • @PMF: That would only give an upper boundary: the resolution could conceivably be smaller than the time taken by a loop iteration. Commented Feb 23, 2021 at 13:50
  • I agree, but it would be a first hint.
    – PMF
    Commented Feb 23, 2021 at 16:02
  • 2
    A Protenta is completely different from a standard AVR Arduino. It is built with a M7/M4 dual core ARM mcu running on 480/240 MHz. There is also an OS installed on the board (mbed OS). The sketches run on top of this OS. I don't know the actuall status but ~2015 (?) I followed a discussion about using a 'millis()' resolution of 50µs Arduino_mbed core. Unbelievable I know, but the reason was: The OS runs tasks and a timer irq with a call frequency of a MHz would slow down the scheduler and the tasks. Commented Feb 23, 2021 at 18:46
  • 1
    So the discussion was seriously about a 50µs resolution that leads to 20kHz Timer IRQs. I'm not sure if this is still the truth. But if they still use a 50µs resolution you could follow the idea of @PMF and see if the difference between two micros() calls is dividable by 50 or 30 or whatever. Commented Feb 23, 2021 at 18:47

1 Answer 1

1

The micros() language reference states that, "[The micros() function] returns the number of microseconds since the Arduino board began running the current program. This number will overflow (go back to zero), after approximately 70 minutes. On the boards from the Arduino Portenta family this function has a resolution of one microsecond on all cores. On 16 MHz Arduino boards (e.g. Duemilanove and Nano), this function has a resolution of four microseconds (i.e. the value returned is always a multiple of four). On 8 MHz Arduino boards (e.g. the LilyPad), this function has a resolution of eight microseconds.

It seems likely that the doco was updated some time after the OP posted the question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.