Skip to main content
Yshar.1
Associate
March 18, 2020
Solved

Maximum speed of toggle of GPIO in STM32F0103 or STM32F746ZG

  • March 18, 2020
  • 8 replies
  • 2015 views

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.

This topic has been closed for replies.
Best answer by Piranha

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

8 replies

KnarfB
Super User
March 18, 2020

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

Yshar.1
Yshar.1Author
Associate
March 18, 2020

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

KnarfB
Super User
March 18, 2020
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>

Yshar.1
Yshar.1Author
Associate
March 18, 2020

thanks, i will check this and update.:D

Piranha
PiranhaBest answer
Principal III
March 18, 2020

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

Yshar.1
Yshar.1Author
Associate
March 18, 2020

Thanks:smiling_face_with_smiling_eyes:

waclawek.jan
Super User
March 19, 2020

@KnarfB​ ,

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

Sorry for the OT.

JW

KnarfB
Super User
March 19, 2020

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