cancel
Showing results for 
Search instead for 
Did you mean: 

Maximum speed of toggle of GPIO in STM32F0103 or STM32F746ZG

Yshar.1
Associate II

i am having STM32F0103 discovery board and STM32F746ZG Nucleo. i want to check maximum speed on which i can toggle GPIO. When i select 48 MHz in STM32F0 i am getting maximum 1.25 uSec which is around 800 KHz Max.

in case of STM32F7 i am running at 216 MHz - then i am getting maximum .254 uSec, that is also very low as 4-5 MHz.

can any one sugget how get maximum speed of GPIO toggle. currently i am working on display panel.

Let me know if more clarity required. on this community few people asked same question but no body answered correctly.

1 ACCEPTED SOLUTION

Accepted Solutions
Piranha
Chief II

It's simple - using HAL and talking about maximum speed, minimum size or stability is just nonsense.

View solution in original post

8 REPLIES 8
KnarfB
Principal III

How did you do your tests, register level using BSRR (Bit Set Reset Register) ?

Yshar.1
Associate II

i have logic analyzer, i am toggling port using HAL_GPIO_TogglePin() API

KnarfB
Principal III
while (1)
{
  GPIOB->BSRR = GPIO_BSRR_BS_3;
  GPIOB->BSRR = GPIO_BSRR_BR_3;
}

For LED on PB3 one loop takes about 166ns on my F042 @ 48Mhz at -O3 including the branch.

08000232:   movs    r2, #128        ; 0x80
08000234:   movs    r1, #8
08000236:   ldr     r3, [pc, #8]    ; (0x8000240 <main+32>)
08000238:   lsls    r2, r2, #12
0800023a:   str     r1, [r3, #24]
0800023c:   str     r2, [r3, #24]
0800023e:   b.n     0x800023a <main+26>

Piranha
Chief II

It's simple - using HAL and talking about maximum speed, minimum size or stability is just nonsense.

thanks, i will check this and update.:D

Thanks😊

@KnarfB​ ,

where's the loop targer in that disasm? Why are there odd address labels there?

Sorry for the OT.

JW

Thanks for spotting that. Sometimes the disasm shows garbage, blame STM32CubeIDE for it. Corrected.