One of the very first examples for an MCU or SoC usually involves the famous ‘Blinky‘ example, where an LED is pulsed on and off with a fixed delay. This is actually a lot more complicated than the ‘Pushy‘ example which we looked at in the first installment of this series. The reason for this is that there’s actually quite a story behind a simple call to delay()
or its equivalent.
The reason for this is that there are many ways to implement a delay function on a microcontroller (MCU), each of which comes with their own advantages and disadvantages. On an STM32 MCU, we get to choose between essentially an active delay (while
loop), one implemented using the SysTick timer and using one of the peripheral timers. In the latter two cases we also have to use interrupts.
In this article we’ll take a look at all three approaches, along with their advantages and disadvantages.
Continue reading “Bare-Metal STM32: Blinky And The Secret Of Delay Functions”