dma-baremetal — Claude Code skill: what it does, how to install
dma-baremetal is a Claude Code skill that assists with register-level DMA setup for bare-metal microcontrollers, moving UART, SPI, or ADC data away from the CPU.
MIT 392 installs ★ 298 updated 2026-06-27
npx skills add mohitmishra786/low-level-dev-skills --skill dma-baremetal -a claude-codeWhat dma-baremetal does
The skill provides patterns for low-level DMA controller configuration on microcontrollers such as STM32. It covers stream selection, memory increment flags, transfer complete interrupts, and setting up circular mode with automatic NDTR reloads.
It handles peripheral-to-memory transfers like USART reception and double-buffering using half-transfer and full-transfer flags. On Cortex-M7 targets, DMA transfers will read stale or corrupted data unless D-Cache operations like SCB_InvalidateDCache_by_Addr are called after completion.
The skill also troubleshoots common hardware issues, including forgotten peripheral DMA request bits in registers like USART_CR3 and uncleared flags in DMA_LISR or HIFCR.
What it helps with
- configure a circular DMA buffer for UART RX on bare metal
- offload bulk ADC and SPI transfers from the main core
- fix D-Cache coherency corruption on Cortex-M7 devices
- clear DMA status flags properly inside the interrupt handler
Example prompts for the agent
- /dma-baremetal Configure UART RX DMA circular buffer on STM32F4
- /dma-baremetal Add D-Cache invalidate calls for Cortex-M7 RX DMA
- /dma-baremetal Debug stuck NDTR counter on USART2 DMA transfer
How to install dma-baremetal
1Skills CLI (Vercel)
npx skills add mohitmishra786/low-level-dev-skills --skill dma-baremetal -a claude-code2Manually: put the files in place
~/.claude/skills/dma-baremetal/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/dma-baremetal/
1Skills CLI (Vercel)
npx skills add mohitmishra786/low-level-dev-skills --skill dma-baremetal -a codex2Manually: put the files in place
.agents/skills/dma-baremetal/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add mohitmishra786/low-level-dev-skills --skill dma-baremetal -a cursor2Manually: put the files in place
.cursor/skills/dma-baremetal/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install mohitmishra786/low-level-dev-skills skills/baremetal/dma-baremetal2Manually: put the files in place
.github/skills/dma-baremetal/SKILL.md1Skills CLI (Vercel)
npx skills add mohitmishra786/low-level-dev-skills --skill dma-baremetal -a gemini-cli2Platform CLI
gemini skills install https://github.com/mohitmishra786/low-level-dev-skills --path skills/baremetal/dma-baremetalManually: put the files in place
.devin/skills/dma-baremetal/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add mohitmishra786/low-level-dev-skills --skill dma-baremetal -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about dma-baremetal
How to install dma-baremetal in Claude Code?
Run npx skills add mohitmishra786/low-level-dev-skills --skill dma-baremetal -a claude-code in your terminal.
What does dma-baremetal do?
It guides coding agents through configuring DMA streams, channels, circular buffers, and interrupt flags directly on bare-metal hardware.
How does it handle cache coherency on Cortex-M7?
It directs buffers to non-cacheable RAM or inserts SCB_CleanDCache_by_Addr before TX and SCB_InvalidateDCache_by_Addr after RX.
Source text
SKILL.md · MIT
---
name: dma-baremetal
description: Bare-metal DMA skill for memory-peripheral transfers. Use when configuring DMA channels, circular mode, double buffering, or DMA IRQ completion. Activates on queries about DMA bare-metal, circular buffer, memory-to-peripheral, or DMA stream configuration.
---
# DMA (Bare-Metal)
## Purpose
Configure DMA controllers for memory-to-peripheral and peripheral-to-memory transfers: channel/stream setup, burst sizes, circular mode, half-transfer interrupts, and cache coherency on Cortex-M7.
## When to Use
- Offloading UART/SPI/ADC bulk transfers from CPU
- Audio/streaming double buffers
- Debugging DMA not triggering or corrupt data
## Workflow
### 1. STM32 DMA2 stream (periph→mem)
```c
/* UART2 RX DMA — Stream5, Channel 4 (verify RM matrix) */
RCC->AHB1ENR |= RCC_AHB1ENR_DMA1EN;
DMA1_Stream5->PAR = (uint32_t)&USART2->DR;
DMA1_Stream5->M0AR = (uint32_t)rx_buf;
DMA1_Stream5->NDTR = sizeof(rx_buf);
DMA1_Stream5->CR = DMA_SxCR_MINC /* mem increment */
| DMA_SxCR_TCIE /* transfer complete IRQ */
| DMA_SxCR_CHSEL_2 /* channel 4 */
| DMA_SxCR_EN;
USART2->CR3 |= USART_CR3_DMAR;
```
### 2. Circular / double buffer
```c
DMA1_Stream5->CR |= DMA_SxCR_CIRC; /* auto-reload NDTR */
/* HTIF = first half, TCIF = second half — process in IRQ */
```
### 3. Cortex-M7 cache (H7)
DMA buffer in non-cacheable region or clean/invalidate D-Cache:
```c
SCB_CleanDCache_by_Addr((void*)tx_buf, len);
/* after DMA TX */
SCB_InvalidateDCache_by_Addr((void*)rx_buf, len);
```
### 4. Agent usage
```
/dma-baremetal Configure UART RX DMA circular buffer on STM32F4
```
## Common Problems
| Symptom | Cause | Fix |
|---------|-------|-----|
| DMA no start | Stream/channel mismatch | RM DMA request mapping table |
| Corrupt RX | Cache coherency (M7) | Invalidate after RX complete |
| NDTR stuck | Peripheral DMA enable missing | USART_CR3 DMAR/DMAT |
| IRQ flood | Clear flags in ISR | `DMA_LISR`/`HIFCR` |
## Related Skills
- `skills/baremetal/uart-serial-baremetal` — USART DMA enable
- `skills/baremetal/adc-dac-baremetal` — ADC DMA mode
- `skills/low-level-programming/cpu-cache-opt` — cache line concepts
© mohitmishra786 · MIT · mohitmishra786/low-level-dev-skills