Speed Up your IO !!
Posted: Mon Oct 23, 2023 3:33 pm
Hello all,
just a small example to illustrate how to speed up your IO.
STM32 Arduino core use HAL interface to write or read IO. HAL is know to be very slow.. but how mutch slow?
Here a test, made on STM32F108C:
Look at that !! 396 Khz with standards Arduino procedure (using STM32 HAL interface), it is a pity !
But 3.22 MHz (yes!) with direct GPIO access !
So common guys, speed up your IO !

just a small example to illustrate how to speed up your IO.
STM32 Arduino core use HAL interface to write or read IO. HAL is know to be very slow.. but how mutch slow?
Here a test, made on STM32F108C:
Code: Select all
//Here a classical arduino write -> use STM32 HAL interface -> F = 396 KHz
do
{
digitalWrite(PC13, LOW);
digitalWrite(PC13, HIGH);
} while (1);
// Here a direct access to STM32 GPIO -> F = 3.22 MHz !!!!
do
{
GPIOC->ODR |= (1 << 13);
GPIOC->ODR &= ~(1 << 13);
}while (1);

But 3.22 MHz (yes!) with direct GPIO access !

So common guys, speed up your IO !

