Skip to main content
skill CX Codex

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

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add mohitmishra786/low-level-dev-skills --skill dma-baremetal -a claude-code
Open on GitHub

What 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-code

2Manually: put the files in place

~/.claude/skills/dma-baremetal/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/dma-baremetal/

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

Similar skills

All skills for Programming languages →

From the same set140

The whole set →
kernel-debugging This Claude Code skill guides Linux kernel debugging with tracing, debuggers, and crash-dump analysis. It activates for questions about kgdb, kdb, ftrace, kprobes, dyndbg, kdump, or dmesg levels. CX Codex +1 395installs qemu-kvm qemu-kvm walks the agent through QEMU VMs with KVM acceleration: flags, virtio devices, VFIO passthrough and booting custom kernels. CX Codex +1 395installs baremetal-startup baremetal-startup is a Claude Code skill that guides coding agents through Cortex-M and RISC-V initialization from reset to main(). CX Codex +1 394installs mmio-and-bit-manipulation mmio-and-bit-manipulation — a skill for safe peripheral memory access: volatile semantics, read-modify-write patterns, bit masks, and alignment. Essential when writing bare-metal drivers without a HAL. CX Codex +1 392installs bus-drivers-i2c-spi bus-drivers-i2c-spi walks an agent through Linux client drivers for I2C and SPI sensors and PMICs: registration, regmap, device tree binding. CX Codex +1 392installs uart-serial-baremetal uart-serial-baremetal configures bare-metal UART and USART drivers for serial debug consoles, baud calculation, and interrupt I/O. CX Codex +1 391installs kernel-concurrency kernel-concurrency is a Claude Code skill that helps select a Linux kernel synchronization primitive: spinlock, mutex, RCU, seqlock, or completion. CX Codex +1 391installs gpu-memory-model gpu-memory-model explains GPU execution and memory hierarchy under SIMT. Helps debug warp divergence, bank conflicts, and coalescing issues in compute kernels. CX Codex +1 391installs

Project sponsors

Companies that keep this analytics open