elehobica/pico_audio_i2s_32b
32bit I2S DAC library for Raspberry Pi Pico / Pico 2
Featured achievements
The project's latest awards
#1 Repository of the month
#1 Repository of the month
#1 Repository of the month
32bit I2S DAC Library for Raspberry Pi Pico / Pico 2
Overview
This library is for Raspberry Pi Pico / Pico 2 to support 32bit/Stereo I2S DAC.
- Channels: 2ch (Stereo)
- Bit resolution: 32bit
- Sampling Frequency: up to 192 KHz
Supported Board and Peripheral Devices
- Raspberry Pi Pico
- Raspberry Pi Pico 2
- PCM5102 32bit I2S Audio DAC
- ES9023 24bit I2S Audio DAC
Pin Assignment
In addition to original connection
| Pico Pin # | GPIO | Function | Connection |
|---|---|---|---|
| 21 | GP16 | BCK | to PCM5102 BCK (13) / to ES9024 BCK (1) |
| 22 | GP17 | LRCK | to PCM5102 LRCK (15) / to ES9023 LRCK (2) |
| 23 | GND | GND | GND |
| 24 | GP18 | SDO | to PCM5102 DIN (14) / to ES9023 SDI (3) |
| 40 | VBUS | VCC | to VIN of DAC board (5V) |

PCM5102 Board Setting
- tie PCM5102 SCK (12) to low (bridge short land)
- H1L (FLT) = L
- H2L (DEMP) = L
- H3L (XSMT) = H
- H4L (FMT) = L
How to build with docker image
- Builds the firmware inside pico-sdk-dev-docker:sdk-2.3.0 (same image used by CI). Requires Docker; no local Pico SDK setup is needed.
samples/build_docker.shdrives the container build. The sample to build is taken from the current directory, so run it from inside the sample folder you want to build (samples/xxxx).
$ git clone -b main https://github.com/elehobica/pico_audio_i2s_32b.git
$ cd pico_audio_i2s_32b/samples/xxxx
$ ../build_docker.sh # build both targets (default)
$ ../build_docker.sh pico # build only Pico -> build/xxxx.uf2
$ ../build_docker.sh pico2 # build only Pico 2 -> build2/xxxx.uf2
- Outputs:
build/xxxx.uf2(Pico),build2/xxxx.uf2(Pico 2) - Download "*.uf2" on RPI-RP2 or RP2350 drive
How to build in local
- See "Getting started with Raspberry Pi Pico"
- Put "pico-sdk", "pico-examples" and "pico-extras" on the same level with this project folder.
- Set environmental variables for PICO_SDK_PATH, PICO_EXTRAS_PATH and PICO_EXAMPLES_PATH
- Confirmed with Pico SDK 2.3.0
> git clone -b 2.3.0 https://github.com/raspberrypi/pico-sdk.git
> cd pico-sdk
> git submodule update -i
> cd ..
> git clone -b sdk-2.3.0 https://github.com/raspberrypi/pico-examples.git
>
> git clone -b sdk-2.3.0 https://github.com/raspberrypi/pico-extras.git
>
> git clone -b main https://github.com/elehobica/pico_audio_i2s_32b.git
Windows
- Build is confirmed in Developer Command Prompt for VS 2022 and Visual Studio Code on Windows environment
- Confirmed with cmake-3.27.2-windows-x86_64 and gcc-arm-none-eabi-10.3-2021.10-win32
- Lanuch "Developer Command Prompt for VS 2022"
> cd pico_audio_i2s_32b\samples\xxxx
> mkdir build && cd build
> cmake -G "NMake Makefiles" .. ; (for Raspberry Pi Pico 1 series)
> cmake -G "NMake Makefiles" -DPICO_PLATFORM=rp2350 -DPICO_BOARD=pico2 .. ; (for Raspberry Pi Pico 2)
> nmake
- Put "*.uf2" on RPI-RP2 or RP2350 drive
Linux
- Build is confirmed with pico-sdk-dev-docker:sdk-2.3.0
- Confirmed with cmake-3.22.1 and arm-none-eabi-gcc (15:10.3-2021.07-4) 10.3.1
$ cd pico_audio_i2s_32b/samples/xxxx
$ mkdir build && cd build
$ cmake .. # (for Raspberry Pi Pico 1 series)
$ cmake -DPICO_PLATFORM=rp2350 -DPICO_BOARD=pico2 .. # (for Raspberry Pi Pico 2)
$ make -j4
- Download "*.uf2" on RPI-RP2 or RP2350 drive
Macro Definitions in audio_i2s.c
CORE1_PROCESS_I2S_CALLBACK
If defined, i2s_callback_func is processed at Core 1 while main routine and DMA IRQ handler is processed at Core 0. It will be efficient when generating audio data needs computing power. It does not contribute to reduce bus load and even make slightly worse when Core 1 is activated.
Application Example
Similar Projects
Discover other similar projects and AI models.
Libraries and examples to support Pimoroni Pico add-ons in C++ and MicroPython.
Emulation of ISA sound cards and CD-ROM on Raspberry Pi Pico (GUS, SB/Adlib, MPU-401, Tandy, CMS, Panasonic CD-ROM) with USB mouse/joystick support
Production-ready Snapcast client for ESP32. Reliable, synchronous multiroom audio playback.