STM32 Timer Operations: PWM Generation and Input Capture
Pulse Width Modulation (PWM) Overview
PWM is a technique used to simulate analog signal levels by modulating the width of digital pulses. In control applications, such as motor speed regulation, the duty cycle dictates the average power delivered to the load. By rapidly swithcing the output state, the system effectively manages the average volt ...
Posted on Sat, 16 May 2026 22:57:28 +0000 by Pezmc
STM32 Development Techniques and Best Practices
KEIL Configuration
System Reset Implementation
__set_FAULTMASK(1);
NVIC_SystemReset();
Crystal Oscillator Configuration
In the stm32f10x.h file, modify the system clock setup:
static void ConfigureSystemClockTo72MHz(void)
{
__IO uint32_t startupCounter = 0, hseStatus = 0;
/*!< Enable the High Speed External oscillator (HSE) */
...
Posted on Wed, 13 May 2026 05:54:23 +0000 by simpli
Understanding GPIO, LED, and Buzzer Control in Microcontrollers
GPIO (General Purpose Input/Output)
GPIO pins are versatile pins on microcontrollers that can be configured as either inputs or outputs to interface with various electronic components.
GPIO Configuration Modes
Floating Input: The pin is left unconnected, which can lead to unpredictable states due to noise. Not recommended for practical applica ...
Posted on Sun, 10 May 2026 16:15:03 +0000 by spivey
Voltage Tracking, UART Control and Temperature-Based PWM Regulation Implementation for STM32
Periodic Voltage Sampling
ADC voltage sampling is triggered every 100ms via timer interrutp:
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
if(htim->Instance == TIM1)
{
read_adc_voltage();
}
}
ADC configuration is omitted here, the sampling function witth averaging filtering is implemented as follows:
uint32_t adc_sample ...
Posted on Sat, 09 May 2026 08:16:01 +0000 by j.smith1981
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
STM32 RTC Programming Guide with HAL Library for F103 and F407
Time Fundamentals
Unix Timestamps
A Unix timestamp is the total number of seconds elapsed since 00:00:00 UTC on January 1, 1970, ignoring leap seconds. It is stored as a 32-bit or 64-bit integer. All time zones use the same timestamp value, with local time calculated by adding a timezone offset.
UTC/GMT
GMT (Greenwich Mean Time) is a timekeepin ...
Posted on Fri, 08 May 2026 08:49:02 +0000 by iHack