Capturing Dual Encoder Waveforms with STM32F407 Timer 5 Input Capture

This document details a method for capturing and processing waveforms from two digital quadrature encoders using the STM32F407ZGT6 microcontroller. The approach leverages the four input capture channels of Timer 5 (TIM5) to track the rotational position and direction of each encoder. System Overview The system utilizes the STM32F407's Cortex-M4 ...

Posted on Wed, 03 Jun 2026 18:13:14 +0000 by mattd123

Button Scan Routine with Release Detection for MCU Sleep Control

This button scanning routine is designed to manage a power-saving feature: a long press of the button triggers a shutdown of all MCU peripherals (simulated by turning off an LED), but the actual sleep mode is only entered after the button is released. This prevents accidental wake-ups by ensuring the user intentional completes the press-and-rel ...

Posted on Fri, 15 May 2026 11:36:59 +0000 by stylefrog

Handling Internal Flash Memory Operations on STM32 Devices

The internal flash memory integrated into STM32 microcontrollers provides non-volatile storage for both executable code and user data. While reading from this memory is as straightforward as dereferencing a pointer, modifying its contents requires strict adherence to hardware protection mechanisms. Write and erase cycles must be guarded by unlo ...

Posted on Fri, 08 May 2026 16:14:18 +0000 by AsianGuyJTran