2024-04-25 01:34 AM
I have been trying to see how fast can I toggle the pins on STM32H7 MCU. I'm using a nucleo-H723zg board.
the clock configs are at the highest (550Mhz for CPU, 275 for APB and AHB), the pins are configured as very high speed.
But still with a simple while loop such as
while (1) {
GPIOE->BSRR = (uint32_t) GPIO_PIN_2;
GPIOE->BSRR = (uint32_t) GPIO_PIN_2 << 16U;
}
the frequency of the PWM I see on the oscilloscope is 7.3 MHz max. Ofcourse the PWM is not the final goal
but I wanted to see how fast this mcu can implemnet the bit toggling.
Am I doing something wrong here?
2024-04-25 10:58 PM
Hello,
I do agree with what others said regarding the architecture and H7 family is not intended to do that kind of job due to the complexity of its architecture. And I add, if you are not using ITCM memories and using cache, the execution will risk to be not deterministic.
2024-04-25 11:48 PM - edited 2024-04-25 11:50 PM
From my tests :
20 MHz can get from H743 , at 480MHz , -O2, : 25ns hi or lo time ;
compared to cpu with "better" = direct access to port/bus : H563 , at 250MHz :
4ns pin access, 16ns with while-loop : 82MHz output by pin toggling - not bad , i would say...
see: