Hello:
Is there any way to know the resolution of micros() for the Arduino Portenta H7 (which employs STM32H747)? I have checked for other boards e.g. Arduino 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
micros() Resolution
Re: micros() Resolution
I am not aware of the H7 Arduino library implementation. You should get 1 us resolution. If you need 5 nanosecond resolution (with 400 MHz clock) then you can use the following two macros
These macros do work on all STM32 processors and I have been using them for many years.
Code: Select all
#define initCycleCounter() \
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk; \
DWT->CYCCNT = 0; \
DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk
#define readCycleCounter() (DWT->CYCCNT)
Re: micros() Resolution
@Ali I think here is your answer: https://www.arduino.cc/reference/en/lan ... me/micros/
[...]
On the boards from the Arduino Portenta family this function has a resolution of one microsecond on all cores.
[...]
Re: micros() Resolution
I think some lower end chips don't have dwt.These macros do work on all STM32 processors
In those cases you can use a free running timer. Like systick
Re: micros() Resolution
STM32 mcu based on cortex-M0 does not have DWT.
Good article:
https://www.carminenoviello.com/2015/09 ... nds-stm32/
Good article:
https://www.carminenoviello.com/2015/09 ... nds-stm32/