Real-time MEMS microphone audio capture on the STM32H725, streamed over UART and visualised on a host PC.
| Item | Value |
|---|---|
| MCU | STM32H725 (Cortex-M7, 550 MHz) |
| Microphone | IM69D120 (PDM, 1.8 V I/O) |
| Interface | DFSDM (digital filter), DMA → UART4 |
| Baud rate | 921 600 |
| Sample rate | 32 kHz (DFSDM clock 3.2 MHz / OSR 50 / IntOSR 2) |
| Sample format | int16 little-endian, mono |
Wire format per DMA half/full callback:
[0xAA 0x55 0xAA 0x55] 4-byte sync word
[1024 × int16 LE] 2048 bytes of audio samples
| Tool | Version | Notes |
|---|---|---|
| ARM GCC | 10.3-2021.10 | bundled in toolchain/ (Linux) and toolchain_win/ (Windows) |
| CMake | ≥ 3.22 | |
| Ninja | any |
The bundled toolchains are excluded from git (.gitignore). Download from
developer.arm.com and unpack
into toolchain/ (Linux) or toolchain_win/ (Windows) at the repo root.
Expected layout:
toolchain/
bin/
arm-none-eabi-gcc
arm-none-eabi-objcopy
...
# Add the toolchain to PATH for this shell session
export PATH="$(pwd)/toolchain/bin:$PATH"
# Configure (generates build/Debug/)
cmake --preset Debug
# Compile (36 translation units, ~4 seconds)
cmake --build --preset DebugOutputs in build/Debug/:
| File | Description |
|---|---|
dfsdm-audio.elf |
ELF with full debug info (for GDB / STM32CubeIDE) |
dfsdm-audio.hex |
Intel HEX — flash this to the board |
Release build (size-optimised, -Os):
cmake --preset Release && cmake --build --preset ReleaseUse STM32CubeProgrammer (GUI or CLI):
STM32_Programmer_CLI -c port=SWD -w build/Debug/dfsdm-audio.hex -v -rstOr drag-and-drop the .hex onto the ST-LINK virtual mass-storage drive if
your board supports it.
A Rust/egui desktop app that connects to the board over UART and shows:
- Live scrolling waveform — Raw (cyan) and/or HPF-filtered (amber)
- WAV recording with timestamped filenames
- Signal toolbox: Welch PSD, STFT spectrogram, statistics, autocorrelation, RMS envelope + ZCR
| Tool | Notes |
|---|---|
| Docker | used for cross-compilation; no local Rust install required |
cd tools/dfsdm-viz
./build_cross.shThe script builds a Docker image on first run (~30 s), then compiles both targets in release mode.
Outputs:
| File | Platform |
|---|---|
target/x86_64-unknown-linux-gnu/release/dfsdm-viz |
Linux x86-64 |
target/x86_64-pc-windows-gnu/release/dfsdm-viz.exe |
Windows x86-64 |
Linux:
./target/x86_64-unknown-linux-gnu/release/dfsdm-vizWindows — double-click dfsdm-viz.exe or run from a terminal:
dfsdm-viz.exeThe port can be selected from the toolbar ComboBox after launch, or passed on the command line:
dfsdm-viz --port /dev/ttyUSB0 # Linux
dfsdm-viz.exe --port COM3 # WindowsAll CLI options:
Options:
-p, --port <PORT> Serial port (optional; pick in GUI if omitted)
-b, --baud <BAUD> Baud rate [default: 921600]
-s, --sample-rate <HZ> Audio sample rate [default: 32000]
--width <PX> Window width [default: 1400]
--height <PX> Window height [default: 650]
cd tools/dfsdm-viz
# Ubuntu / Debian
sudo apt install libudev-dev libdbus-1-dev
cargo build # debug
cargo build --release