REVISED MAY 2025
Warning
This guide is specifically for the ReSpeaker 2-Mics Pi HAT v2. To distinguish between v1 and v2 hardware, please refer to How to Distinguish ReSpeaker 2-Mics Pi HAT Hardware Revisions.
Hardware Overview
1. BeagleY-AI

BeagleY® AI is an open-source single board computer designed to simplify the process of building smart human machine interfaces (HMI), adding cameras and high-speed connectivity to a reliable embedded system. It features a quad-core A53 processor, AI accelerators, and modern connectivity.
2. ReSpeaker 2-Mics Pi HAT v2
Note
The ReSpeaker 2-Mics Pi HAT has been upgraded to version 2.0. The codec chip has been replaced from WM8960 to TLV320AIC3104, enabling support for Raspberry Pi 5 / BeagleY-AI and expanding the sampling rate range up to 96 kHz.

Setup Process
1. Bootable SD Card Preparation
Create a bootable microSD card with the latest OS image for BeagleY-AI. See the BeagleY-AI Quick Start for details.
2. Kernel Driver Compilation
Note
BeagleY-AI typically includes the tlv320aic31xx codec driver. Run sudo apt update && sudo apt upgrade first. If snd-soc-tlv320aic31xx.ko.xz is missing, you’ll need to build it from source.
cd linux
# default configurationmake distcleanmake ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bb.org_defconfig
# enable codec in menuconfigmake ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- menuconfig# -> Device Drivers -> Sound card support -> ALSA for SoC audio support -> CODEC drivers# Set "Texas Instruments TLV320AIC31xx CODECs" to module <M>
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image dtbs modules LOCALVERSION="-ti-arm64-r23" -j$(nproc)Install onto the SD card:
sudo cp arch/arm64/boot/Image /media/$(users)/BOOT/sudo cp arch/arm64/boot/dts/ti/*.dtbo /media/$(users)/BOOT/overlays/sudo cp -ra modules/lib/modules/$(make kernelversion)-ti-arm64-r23/ /media/$(users)/rootfs/lib/modules/syncDevice Tree Configuration
Get compiled Device Tree Source (DTS):
curl https://raw.githubusercontent.com/jaydon2020/ReSpeaker-2-Mics-Pi-HAT-v2-BeagleY-AI/refs/heads/main/overlays/k3-am67a-beagley-ai-respeaker.dtbo -o k3-am67a-beagley-ai-respeaker.dtbosudo mv k3-am67a-beagley-ai-respeaker.dtbo /boot/firmware/overlays/Load Device Tree Configuration:
Edit /boot/firmware/extlinux/extlinux.conf:
label microSD (default) kernel /Image append console=ttyS2,115200n8 root=/dev/mmcblk1p3 ro rootfstype=ext4 resume=/dev/mmcblk1p2 rootwait net.ifnames=0 quiet fdtdir / fdt /ti/k3-am67a-beagley-ai.dtb fdtoverlays /overlays/k3-am67a-beagley-ai-respeaker.dtbo /overlays/k3-am67a-beagley-ai-spidev0.dtbo initrd /initrd.imgsudo reboot -fBasic Recording & Playback
Helpful commands for testing:
# Record mono (plughw handles stereo-to-mono conversion)arecord -D plughw:0,0 --format S16_LE --rate 16000 --channels 1 --duration 5 test_mono.wav
# Record stereoarecord -D hw:0,0 --format S16_LE --rate 48000 --channels 2 --duration 5 test_stereo.wav
# Playbackaplay -D hw:0,0 test_stereo.wavRecord Sound with Python
git clone https://github.com/jaydon2020/ReSpeaker-2-Mics-Pi-HAT-v2-BeagleY-AI.gitcd ReSpeaker-2-Mics-Pi-HAT-v2-BeagleY-AIsudo apt-get install portaudio19-dev libatlas-base-devpython3 recordings/detect_microphone.py# Set RESPEAKER_INDEX in your script, then:python3 recordings/record_stereo.pyOn-board User LEDs and Button
sudo apt updatesudo apt install python3-libgpiod python3-spidevpython interfaces/pixels.py # Test LEDspython interfaces/button.py # Test button