Skip to main content
skill CX Codex

adc-dac-baremetal — Claude Code skill: ADC and DAC on microcontrollers

adc-dac-baremetal — a skill for bare-metal ADC and DAC setup on MCUs: channel selection, sampling time, calibration, DMA buffers, and voltage output. Essential when working with analog sensors, audio signals, or control voltages.

MIT 378 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 adc-dac-baremetal -a claude-code
Open on GitHub

What adc-dac-baremetal does

Activates on queries about ADC bare-metal configuration, sampling intervals, DMA-driven conversion, or DAC channel setup. Includes examples for STM32: single conversion with clock enable and stabilization delay, circular DMA buffers for continuous sampling with half-transfer and transfer-complete interrupts, static or dynamic DAC output.

The skill addresses common issues: noisy readings resolved by increasing sample-time bits, EOC stuck due to missing clock enable, incorrect voltage from unchecked VDDA, DMA corruption from unaligned buffers. Code uses STM32F1/F4 registers, but the configuration logic applies to other families via their datasheets.

Expects familiarity with microcontroller registers, DMA mechanics, peripheral clocking, and analog signal levels. Relates to other bare-metal skills covering DMA streams, timers/PWM for external ADC triggers, and GPIO configuration for analog pin modes.

What it helps with

  • Set up ADC with single or continuous conversion and DMA
  • Choose sampling time and channel for an analog sensor
  • Run ADC calibration on STM32 after reset
  • Output an analog signal via DAC
  • Debug ADC noise and EOC timeout

Example prompts for the agent

  • Configure ADC1 channel 0 with circular 64-sample DMA buffer
  • Show ADC calibration steps for STM32F4 before conversions start
  • Output 2048 (mid-scale) on DAC with 3.3V VDDA

How to install adc-dac-baremetal

1Skills CLI (Vercel)

npx skills add mohitmishra786/low-level-dev-skills --skill adc-dac-baremetal -a claude-code

2Manually: put the files in place

~/.claude/skills/adc-dac-baremetal/SKILL.md

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

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about adc-dac-baremetal

How do I install adc-dac-baremetal in Claude Code?

Run npx skills add mohitmishra786/low-level-dev-skills --skill adc-dac-baremetal -a claude-code, then ~/.claude/skills/adc-dac-baremetal/SKILL.md.

What does the adc-dac-baremetal skill provide?

Code examples and troubleshooting for bare-metal ADC and DAC on microcontrollers: channel selection, sampling time, DMA circular buffers, calibration sequences, and voltage output. Covers analog sensor reading, audio output, and continuous DMA-driven sampling.

Does this skill work on all microcontrollers?

Examples target STM32 (F1, F4 families), but the ADC and DAC setup patterns apply to other MCUs; adapt register names and offsets using your chip's reference manual.

Source text

SKILL.md · MIT
---
name: adc-dac-baremetal
description: Bare-metal ADC and DAC skill. Use when configuring analog sampling, DMA-driven ADC, calibration, or DAC output on MCUs. Activates on queries about ADC bare-metal, sampling time, DMA ADC, or DAC channel setup.
---

# ADC and DAC (Bare-Metal)

## Purpose

Configure ADC and DAC peripherals: channel selection, sampling times, calibration sequences, DMA circular buffers, and DAC static/dynamic output.

## When to Use

- Reading analog sensors (temperature, voltage)
- Audio or control voltage output via DAC
- Continuous sampling with DMA
- Post-reset ADC calibration on STM32

## Workflow

### 1. STM32 ADC single conversion

```c
/* Enable ADC1 and GPIOA clock; PA0 analog mode */
ADC1->CR2 |= ADC_CR2_ADON;
for (volatile int i = 0; i < 10000; i++);  /* stabilization — RM value */

ADC1->SMPR2 |= ADC_SMPR2_SMP0_2;  /* 84 cycles sample time ch0 */
ADC1->SQR3   = 0;                 /* channel 0, 1 conversion */
ADC1->CR2   |= ADC_CR2_SWSTART;

while (!(ADC1->SR & ADC_SR_EOC))
    ;
uint16_t sample = ADC1->DR;
```

Run `ADC_Calibration()` / `ADC_CR2_RSTCAL/CAL` per RM on F1/F4 families.

### 2. DMA circular ADC

```c
/* ADC1 → DMA2 Stream0, circular mode into buffer[64] */
/* Configure DMA: periph-to-mem, halfword, increment mem, circular */
ADC1->CR2 |= ADC_CR2_DMA | ADC_CR2_CONT;
DMA2_Stream0->CR |= DMA_SxCR_EN;
```

Half-transfer / transfer-complete IRQs for double buffering.

### 3. DAC output (STM32)

```c
RCC->APB1ENR |= RCC_APB1ENR_DACEN;
DAC->CR |= DAC_CR_EN1;
DAC->DHR12R1 = 2048;  /* mid-scale 3.3V reference */
```

### 4. Agent usage

```
/adc-dac-baremetal Set up ADC1 channel 0 with DMA circular buffer
```

## Common Problems

| Symptom | Cause | Fix |
|---------|-------|-----|
| Noisy readings | Short sample time | Increase SMP bits |
| Stuck EOC | Clock not enabled | RCC ADC enable |
| Wrong voltage | Vref not 3.3V | Measure VDDA; calibrate |
| DMA corrupt | Buffer alignment | Use `uint16_t` aligned buffer |

## Related Skills

- `skills/baremetal/dma-baremetal` — ADC DMA streams
- `skills/baremetal/timers-pwm-baremetal` — ADC external trigger
- `skills/baremetal/gpio-baremetal` — analog pin mode

© mohitmishra786 · MIT · mohitmishra786/low-level-dev-skills

Similar skills

All skills for DevOps and infrastructure →

From the same set140

The whole set →
kernel-security kernel-security — a skill for SELinux and AppArmor policies, seccomp-bpf sandboxing, KASLR, Intel CET, ARM PAC and BTI. Write LSM rules, triage kernel CVEs, and configure kernel mitigations. CX Codex +1 381installs peripherals-from-datasheet peripherals-from-datasheet guides driver development directly from MCU reference manuals. Helpful when writing bare-metal register code without a vendor HAL or migrating peripherals across chips. CX Codex +1 380installs platform-device-model The platform-device-model skill explains Linux platform-driver binding, probe and remove, sysfs, device properties, and deferred probing for kernel work. CX Codex +1 378installs writing-char-drivers writing-char-drivers — a skill for writing Linux character drivers: cdev registration, file_operations implementation, safe userspace copies, ioctl and mmap. CX Codex +1 378installs resource-optimization-lowend The resource-optimization-lowend skill helps trim flash and RAM use in MCU firmware, inspect linker maps, and measure stack depth when embedded resources are tight. CX Codex +1 376installs llvm-passes llvm-passes guides coding agents in creating, building, and verifying LLVM optimization passes with the New Pass Manager. CX Codex +1 373installs openmp Teaches the agent to write and fix OpenMP code: parallel loops, reductions, tasks, SIMD hints and GPU offload. CX Codex +1 371installs numa-programming Skill teaches the agent NUMA programming: detect topology with numactl and lstopo, bind processes to local memory, use libnuma API, build per-node data structures, and diagnose remote access penalties. CX Codex +1 369installs

Project sponsors

Companies that keep this analytics open