STM32 HAL/LL Skill
Overview
This skill provides expert-level support for STMicroelectronics STM32 microcontrollers, including HAL driver usage, Low-Level (LL) driver optimization, and STM32CubeMX integration.
Capabilities
STM32CubeMX Integration
- Configuration file interpretation
- Code generation customization
- Pin and peripheral assignment
- Clock tree configuration
- Middleware integration
HAL Driver Usage
- HAL initialization and configuration
- Callback registration and handling
- DMA integration with HAL
- Interrupt mode operations
- Polling mode operations
- HAL timeout handling
Low-Level (LL) Drivers
- LL driver optimization
- Direct register access patterns
- HAL to LL migration
- Mixed HAL/LL usage
- Performance-critical implementations
Clock Configuration
- Clock tree setup and optimization
- PLL configuration
- Peripheral clock gating
- Clock source selection
- HSE/HSI/LSE/LSI configuration
DMA Configuration
- DMA stream/channel selection
- Circular and normal modes
- Double buffer configuration
- DMA interrupt handling
- Memory-to-memory transfers
Peripheral Configuration
- GPIO configuration and modes
- Timer configuration (PWM, input capture)
- ADC/DAC setup and calibration
- Communication peripherals (UART, SPI, I2C)
- USB device/host configuration
Power Management
- Sleep and stop mode entry
- Standby mode configuration
- Low-power run mode
- Wake-up source configuration
- Voltage scaling
Target Processes
bsp-development.js - STM32 BSP implementation
device-driver-development.js - STM32 driver development
dma-optimization.js - DMA configuration and tuning
low-power-design.js - STM32 power optimization
hardware-bring-up.js - STM32 board bring-up
Dependencies
- STM32CubeMX
- STM32 HAL/LL libraries
- STM32CubeIDE (optional)
- Device-specific firmware package
Usage Context
This skill is invoked when tasks require:
- STM32 peripheral configuration
- HAL/LL driver implementation
- Clock tree optimization
- DMA setup and tuning
- Power mode configuration
Family Support
- STM32F0, F1, F2, F3, F4, F7
- STM32G0, G4
- STM32H5, H7
- STM32L0, L1, L4, L4+, L5
- STM32U5
- STM32WB, WL
Example Configurations
UART with DMA
huart1.Instance = USART1;
huart1.Init.BaudRate = 115200;
huart1.Init.WordLength = UART_WORDLENGTH_8B;
huart1.Init.StopBits = UART_STOPBITS_1;
huart1.Init.Parity = UART_PARITY_NONE;
huart1.Init.Mode = UART_MODE_TX_RX;
huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;
HAL_UART_Init(&huart1);
HAL_UART_Receive_DMA(&huart1, rx_buffer, RX_SIZE);
LL GPIO Toggle
LL_GPIO_SetOutputPin(GPIOA, LL_GPIO_PIN_5);
LL_GPIO_ResetOutputPin(GPIOA, LL_GPIO_PIN_5);
LL_GPIO_TogglePin(GPIOA, LL_GPIO_PIN_5);
1---2name: stm32-hal3description: STMicroelectronics STM32 HAL and Low-Level driver expertise4---5
6# STM32 HAL/LL Skill
7
8## Overview
9
10This skill provides expert-level support for STMicroelectronics STM32 microcontrollers, including HAL driver usage, Low-Level (LL) driver optimization, and STM32CubeMX integration.
11
12## Capabilities
13
14### STM32CubeMX Integration
15- Configuration file interpretation
16- Code generation customization
17- Pin and peripheral assignment
18- Clock tree configuration
19- Middleware integration
20
21### HAL Driver Usage
22- HAL initialization and configuration
23- Callback registration and handling
24- DMA integration with HAL
25- Interrupt mode operations
26- Polling mode operations
27- HAL timeout handling
28
29### Low-Level (LL) Drivers
30- LL driver optimization
31- Direct register access patterns
32- HAL to LL migration
33- Mixed HAL/LL usage
34- Performance-critical implementations
35
36### Clock Configuration
37- Clock tree setup and optimization
38- PLL configuration
39- Peripheral clock gating
40- Clock source selection
41- HSE/HSI/LSE/LSI configuration
42
43### DMA Configuration
44- DMA stream/channel selection
45- Circular and normal modes
46- Double buffer configuration
47- DMA interrupt handling
48- Memory-to-memory transfers
49
50### Peripheral Configuration
51- GPIO configuration and modes
52- Timer configuration (PWM, input capture)
53- ADC/DAC setup and calibration
54- Communication peripherals (UART, SPI, I2C)
55- USB device/host configuration
56
57### Power Management
58- Sleep and stop mode entry
59- Standby mode configuration
60- Low-power run mode
61- Wake-up source configuration
62- Voltage scaling
63
64## Target Processes
65
66- `bsp-development.js` - STM32 BSP implementation
67- `device-driver-development.js` - STM32 driver development
68- `dma-optimization.js` - DMA configuration and tuning
69- `low-power-design.js` - STM32 power optimization
70- `hardware-bring-up.js` - STM32 board bring-up
71
72## Dependencies
73
74- STM32CubeMX
75- STM32 HAL/LL libraries
76- STM32CubeIDE (optional)
77- Device-specific firmware package
78
79## Usage Context
80
81This skill is invoked when tasks require:
82- STM32 peripheral configuration
83- HAL/LL driver implementation
84- Clock tree optimization
85- DMA setup and tuning
86- Power mode configuration
87
88## Family Support
89
90- STM32F0, F1, F2, F3, F4, F7
91- STM32G0, G4
92- STM32H5, H7
93- STM32L0, L1, L4, L4+, L5
94- STM32U5
95- STM32WB, WL
96
97## Example Configurations
98
99### UART with DMA
100```c
101huart1.Instance = USART1;
102huart1.Init.BaudRate = 115200;
103huart1.Init.WordLength = UART_WORDLENGTH_8B;
104huart1.Init.StopBits = UART_STOPBITS_1;
105huart1.Init.Parity = UART_PARITY_NONE;
106huart1.Init.Mode = UART_MODE_TX_RX;
107huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;
108HAL_UART_Init(&huart1);
109HAL_UART_Receive_DMA(&huart1, rx_buffer, RX_SIZE);
110```
111
112### LL GPIO Toggle
113```c
114LL_GPIO_SetOutputPin(GPIOA, LL_GPIO_PIN_5);
115LL_GPIO_ResetOutputPin(GPIOA, LL_GPIO_PIN_5);
116LL_GPIO_TogglePin(GPIOA, LL_GPIO_PIN_5);
117```