Skip to main content
Yshar.1
Associate
Mar 18, 2020 8:09 AM UTC
Solved

Maximum speed of toggle of GPIO in STM32F0103 or STM32F746ZG

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.
Piranha
PiranhaBest answer
Principal III
Mar 18, 2020 9:26 AM UTC

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

8 replies

KnarfB
Super User
Mar 18, 2020 8:33 AM UTC

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

Yshar.1
Yshar.1Author
Associate
Mar 18, 2020 8:59 AM UTC

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

KnarfB
Super User
Mar 18, 2020 9:08 AM UTC
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
Mar 18, 2020 9:45 AM UTC

thanks, i will check this and update.:D

Piranha
PiranhaBest answer
Principal III
Mar 18, 2020 9:26 AM UTC

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

Yshar.1
Yshar.1Author
Associate
Mar 18, 2020 9:47 AM UTC

Thanks:smiling_face_with_smiling_eyes:

waclawek.jan
Super User
Mar 19, 2020 5:28 PM UTC

@KnarfB​ ,

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

Sorry for the OT.

JW

KnarfB
Super User
Mar 19, 2020 5:51 PM UTC

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