Skip to the content
2 layers98 × 48 mmAVR128DA48, the printed circuit board in 3D

AVR128DA48

mjhagen/dap

Firmware for a portable DAP using a AVR128DA48 and VS1063 chip.

Size
98 × 48 mm
Copper layers
2
Thickness
1.6 mm
Parts
72
Nets
99
Pads
329
Tracks, vias
427, 111
Pours
19
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
28 Jan 2026
Updated
30 Mar 2026

Overview

AVR128DA48 is an open-source printed circuit board by mjhagen, from the mjhagen/dap repository on GitHub. It is a 2-layer board of 98 × 48 mm with 72 parts on 99 nets, routed with 427 tracks and 111 vias.

It is built around the TPS7A2033PDBVR-TP, MAMK2520H2R2M and MAMK2520T4R7M. Its parts include 38 capacitors, 14 resistors, 6 ICs, 5 connectors and 3 switches.

Main components

3

README

README.md

AVR128DA48 Portable Audio Player Firmware

Firmware for a distraction‑free portable audio player built around AVR128DA48.

Render of the PCB

Scope

  • VS1163A audio decoder (SPI)
    • Project policy: firmware playback support is constrained to MP3, FLAC, and ALAC.
  • microSD card with FAT filesystem (SPI)
  • SSD1333 176×176 display (SPI)
  • Buttons + rotary encoder (menu, playback, jog dial)
  • Instant boot to playback screen

No networking. No background services. Boot fast, play audio.

Toolchain (macOS)

  • VSCode + PlatformIO (editing, build, flash)
  • MPLAB X IDE + MPLAB SIM (device simulator)
  • XC8 (required by MPLAB tooling, not necessarily for builds)

Build & Flash

The primary development environment is curiosity_nano, which targets the Microchip Curiosity Nano board and uses UPDI for flashing.

bash
pio run -e curiosity_nano
pio run -e curiosity_nano -t upload

Available environments:

  • curiosity_nano (Main Development) - Curiosity Nano target with UPDI upload
  • avr128da48 - generic AVR128DA48 build
  • curiosity_nano_ssd1333_minimal - controller smoke test for the SSD1333 panel

Current hardware baseline:

  • microSD and SSD1333 share SPI1 on PC0..PC3 (MOSI/MISO/SCK/CS)
  • VS1163A uses PD5 (XCS) and PD6 (XDCS) for control chip-selects
  • SPI0 is reserved for VS1163A data/control traffic

Current microSD pin map:

  • PC0 -> microSD DI / breakout MOSI
  • PC1 -> microSD DO / breakout MISO
  • PC2 -> microSD CLK / breakout SCK
  • PC3 -> microSD CS

Emulator / Simulator

  • Build firmware with PlatformIO → .elf
  • Open MPLAB X
  • Select device: AVR128DA48
  • Debug tool: Simulator
  • Load the .elf and step through execution

Note: PlatformIO does not provide a simulator for AVR‑DA devices.

Project Structure

text
src/
  main.c
  board/        clocks, pin mapping
  drivers/      spi, gpio, timers, ssd1333
  display/      panel binding for the current 176x176 target
  middleware/   sdcard, fatfs
  app/          ui, input, player

Firmware Documentation

Detailed firmware documentation now lives in docs/firmware/. Start there for architecture, runtime scheduling, UI behavior, driver boundaries, and build/debug notes.

Firmware SRAM Usage

Current SRAM map from the built ELF:

  • .data: 1104 B at 0x804000 to 0x804450
  • .bss: 10255 B at 0x804450 to 0x806C5F
  • total static SRAM used: 11359 B / 16384 B (69.3%)
  • remaining stack/runtime headroom: about 5025 B
  • SRAM top: 0x808000

Largest SRAM consumers:

  • player_rb: 4096 B
  • dir_window: 1680 B
  • dir_sort_index: 1280 B
  • sd_fs_obj: 554 B
  • s_flat_subdir_names: 512 B
  • linebuf: 352 B
  • scene: 277 B
  • current_track: 262 B
  • duration_job: 134 B
  • LfnBuf: 130 B
  • playback_full_path: 128 B
  • last_footer_title: 128 B
  • header_marquee_title: 96 B
  • player_preload_rb: 1024 B

A few smaller but still relevant items:

  • browse_row_cache_display_name: 64 B
  • dir_scan_raw_indices: 48 B
  • last_snapshot: 34 B
  • toast_msg: 32 B
  • sd_file_pool: 58 B
  • art_refresh_path_hash: 4 B
  • current_path_ref: 2 B
  • playback_is_flat: 1 B

Browse limits and the 4096-byte player ring buffer were re-evaluated after the structural SRAM cleanup and intentionally left unchanged. With about 4.9 KB of remaining static headroom, further cuts would trade UI breadth or decoder margin for little practical benefit.

Boot Sequence (target)

  1. Clock + GPIO init
  2. Display init (SSD1333 176×176)
  3. SD mount (timeout guarded)
  4. VS1163A init
  5. Start playback
  6. Enter UI loop

Non‑Goals

  • No RTOS
  • No dynamic allocation during playback
  • No feature creep

VU Meter Findings

A dedicated boot-time probe was added to hammer vuMeter during playback, keep the timing statistics in RAM, and show the results on the OLED after a fixed capture window.

Measured on hardware over 10.001 s with fallback playback of Alabama Shakes - Sound & Color/02. Don't Wanna Fight.flac:

  • 2406 successful VU reads, about 240 Hz average successful read rate
  • best observed valid-read spacing: 517 us, about 1.9 kHz
  • best observed distinct VU-word change spacing: 1813 us, about 552 Hz
  • average distinct VU-word change spacing on program material: 94.1 ms

Practical conclusion:

  • VS1163A VU readback is not the limiting factor for 30 fps or 60 fps meters
  • OLED + SD contention on shared SPI1 is the real limiter for visual update rate
  • change-rate numbers from music are content-dependent because the VS VU result is quantized in 3 dB steps

Development Log

✅ Complete

  • Clock init: 24 MHz internal oscillator (OSCHF) on AVR-DA
  • GPIO: Buttons (PD0), Encoder (PC0/PC1)
  • MPLAB X integration: Simulator-based register inspection and boot-flow debugging
  • SD card abstraction: SD card mount, file/directory listing (path-based API), file read/seek
  • SD card driver: SPI-based driver for AVR-DA supporting SDHC/SDXC initialization
  • FatFS integration: Full filesystem support for hardware with FatFs library
  • Input handler: Cleaned up debounce and rotary encoder state machine
  • File browser UI: Directory navigation with track numbering, alphabetical sorting, and scrolling
  • VS1163A decoder: SPI control path (SCI), reset logic, and register configuration
  • Status display: Persistent top bar with 5-segment battery graphic, playback status, and time remaining
  • Miniature Font: Custom 3x5 pixel Geneva-style font for better legibility
  • UI Navigation: Multi-level browsing with long-press support and playback path persistence
  • 176 UI renderer: Scanline renderer for SSD1333 176×176 single-panel layout

🔄 In Progress

  • Gapless Playback: Optimizing ISR-driven data pump to eliminate buffer underruns

📋 To Do

  • Gapless Playback: implement a "next track" handover within the player_refill logic itself, avoiding the codec reset and feeding the transitions continuously into the ring buffer.
  • Soft power off/on: implement a deep sleep mode as much as possible, at long press menu (>3s) switch off VS, amp.
  • Add resistors to SD pins

Current State

Core playback engine and UI are functional on the SSD1333 176×176 single-panel hardware. Current focus is stable playback and responsive controls under real device load.

Parts

72
QtyValueFootprintReferences
16100 nFCapacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolderC1, C3, C13, C15, C16, C17, C18, C21, C22, C23, C25, C27, C29, C30, C32, C38
40kΩResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR10, R14, R15, R16
41µFCapacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolderC2, C9, C31, C33
310 kΩResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR2, R3, R4
310 µFCapacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolderC24, C28, C39
310µFCapacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolderC34, C35, C36
21 µFCapacitor_SMD:C_2220_5750Metric_Pad1.97x5.40mm_HandSolderC7, C8
218 pFCapacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolderC19, C20
24.7µFCapacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolderC4, C5
2470µFCapacitor_SMD:CP_Elec_6.3x5.8C10, C12
10.1µFCapacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolderC26
11 µFCapacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolderC14
1100 kΩResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR5
1100nFCapacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolderC6
1100ΩResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR13
110µFCapacitor_SMD:C_2220_5750Metric_Pad1.97x5.40mm_HandSolderC11
112.288 MHzCrystal:Crystal_SMD_3225-4Pin_3.2x2.5mm_HandSolderingY2
120 kΩResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR6
120kΩResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR7
133 kΩResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR8
1330 ΩResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR1
133kΩResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR9
1AVR128DA48x-xPTPackage_QFP:TQFP-48_7x7mm_P0.5mmU1
1BatteryConnector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_VerticalJ1
1Conn_02x10_Odd_EvenConnector_PinSocket_2.54mm:PinSocket_2x10_P2.54mm_VerticalJ2
1FerriteBead_SmallInductor_SMD:L_0805_2012Metric_Pad1.05x1.20mm_HandSolderFB1
1HeadphonesConnector_Audio:SWITCHCRAFT_35RAPC3BH3J4
1MAMK2520H2R2MMAMK2520H2R2M:INDC2520X120NL1
1MAMK2520T4R7MMAMK2520H2R2M:INDC2520X120NL2
1MCP1603LPackage_TO_SOT_SMD:TSOT-23-5U5
1MEM2061-01-188-00-A_REVAMEM2061-01-188-00-A_REVA:GCT_MEM2061-01-188-00-A_REVAJ3
1NetTie_2NetTie:NetTie-2_SMD_Pad2.0mmNT1
1PLSJ-1Button_Switch_SMD:Knitter_PLSJ-1SW1
1ProgrammingConnector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalJ5
1R_Potentiometer_Dual_MountingPinPotentiometer_THT:Potentiometer_Alps_RK097_Dual_HorizontalRV1
1SW_PushButton_Switch_SMD:SW_Push_1P1T_NO_CK_KMR2SW3
1SW_PushButton_Switch_SMD:SW_SPST_EVQP7ASW2
1TPA6111A2DRPackage_SO:Texas_HTSOP-8-1EP_3.9x4.9mm_P1.27mm_EP2.95x4.9mm_Mask2.4x3.1mm_ThermalViasU3
1TPS63001DRCTPackage_SON:Texas_DRC0010J_ThermalViasU4
1TPS7A2033PDBVRPackage_TO_SOT_SMD:SOT-23-5U6
1VS1163APackage_QFP:LQFP-48_7x7mm_P0.5mmU2

More from mjhagen/dap

3
  • 2 layers98 × 48 mmAVR128DA48, the printed circuit board in 3D

    AVR128DA48

    mjhagen/dap

    Firmware for a portable DAP using a AVR128DA48 and VS1063 chip.

    66 parts
  • 2 layers42.2 × 42.2 mmVS1163A breakout, the printed circuit board in 3D

    VS1163A breakout

    mjhagen/dap

    Firmware for a portable DAP using a AVR128DA48 and VS1063 chip.

    29 parts
  • 2 layers37 × 24.5 mmTPA6111A2-breakout, the printed circuit board in 3D

    TPA6111A2-breakout

    mjhagen/dap

    Firmware for a portable DAP using a AVR128DA48 and VS1063 chip.

    14 parts

Similar boards

  • 2 layers135.5 × 93 mmSpectrum display, the printed circuit board in 3D

    Spectrum display

    nathaniel-fargo/audio-spectrum-vibes

    A fun little display piece for vibing to the audio spectrum. Inspired by Apple's iOS media player 5 bar spectrum analyzer.

    223 partsMIT
  • 2 layers120 × 85 mmLaunch it, the printed circuit board in 3D

    Launch it

    nathaniel-fargo/presentinator

    A fun Christmas PCB game

    100 partsMIT
  • 2 layers35 × 17 mmMicrokey, the printed circuit board in 3D

    Microkey

    Badbird5907/microkey

    43 parts46
  • 2 layers80.7 × 38.5 mmTEF6687, the printed circuit board in 3D

    TEF6687

    FMDX-org/tef668x-headless-usb-tuner

    TEF668X Headless USB Tuner

    112 parts31CERN-OHL-W-2.0
  • 2 layers100 × 100 mmZxevo1010 main, the printed circuit board in 3D

    Zxevo1010 main

    UzixLS/zxevo1010-board

    10x10cm PCB variant of ZX-Evolution project for G738/G706 enclosure

    252 parts26
  • 2 layers100 × 100 mmZxuno1010, the printed circuit board in 3D

    Zxuno1010

    UzixLS/zxuno1010-board

    10x10cm PCB variant of ZX-UNO project for G738/G706 enclosure

    233 parts23MIT
  • 2 layers91.3 × 57.5 mmThermEX26, the printed circuit board in 3D

    ThermEX26

    comradef191/ThermEX

    OSHW Thermistor expansion board for Klipper

    113 parts17CERN-OHL-S-2.0
  • 4 layers144 × 127 mmFrothfet, the printed circuit board in 3D

    Frothfet

    hoeken/frothfet

    Yarrboard load controller board with current sense, volt sense, fuses, and sender support.

    394 parts14GPL-3.0

Questions

How big is the AVR128DA48 PCB?

It measures 98 × 48 mm and has 2 copper layers, 1.6 mm thick.

What parts does the AVR128DA48 use?

72 parts, built around the TPS7A2033PDBVR-TP, MAMK2520H2R2M and MAMK2520T4R7M. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the AVR128DA48 KiCad files?

From the mjhagen/dap repository on GitHub, at the commit this page was made from: the board is Hardware-v2/AVR128DA48.kicad_pcb and its schematic AVR128DA48/AVR128DA48.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the AVR128DA48 design in my own project?

Its repository states no licence, so its author keeps all rights: ask mjhagen before reusing the design.