2020-03-18 01:09 AM
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.
Solved! Go to Solution.
2020-03-18 02:26 AM
It's simple - using HAL and talking about maximum speed, minimum size or stability is just nonsense.
2020-03-18 01:33 AM
How did you do your tests, register level using BSRR (Bit Set Reset Register) ?
2020-03-18 01:59 AM
i have logic analyzer, i am toggling port using HAL_GPIO_TogglePin() API
2020-03-18 02:08 AM
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>
2020-03-18 02:26 AM
It's simple - using HAL and talking about maximum speed, minimum size or stability is just nonsense.
2020-03-18 02:45 AM
thanks, i will check this and update.:D
2020-03-18 02:47 AM
Thanks:smiling_face_with_smiling_eyes:
2020-03-19 10:28 AM
@KnarfB ,
where's the loop targer in that disasm? Why are there odd address labels there?
Sorry for the OT.
JW
2020-03-19 10:51 AM
Thanks for spotting that. Sometimes the disasm shows garbage, blame STM32CubeIDE for it. Corrected.