cancel
Showing results for 
Search instead for 
Did you mean: 

Fast pin toggling on STMH723

Mazz
Associate II

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?

 

11 REPLIES 11

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.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

From my tests :

AScha3_0-1714113705274.png

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:

https://community.st.com/t5/stm32-mcus-products/which-is-best-stm32-mcu-for-fast-driving-of-gpio/m-p/632729#M233727

 

If you feel a post has answered your question, please click "Accept as Solution".