Getting Started with a custom Audio Cape

Hello,

I’m a somewhat experienced Linux user, C++ programmer but I have never dealt with the kernel nor device tree myself. In order to learn a bit about it, I’ve decided to build my own cape and plug it onto the Pocket Beagle that I had lying around. The cape is a ripoff designed based on the popular Bela Mini, an audio plugin for Beagles. It contains a standard part TLV320AIC codec that are supported in the BeagleBone device tree. By that I mean, there are existing device tree overlays that should “somehow” be invoked and the CPU will recognise the codec it’s being connected to. This should make my add-on PCB a standard ALSA sound card. I don’t know much about the DTOs, but hopefully, this will be a nice learning process.

So I got my Belamini board and I plugged it onto my PocketBeagle. Nothing burned. Now, I needed to figure out how to make my AM3358 CPU talk to the audio codec on the Bela. I learned that I need to load the Device Tree Overlay, BB-BONE-AUDI-02-00A0.dtbo. I followed the instructions from the BB Kernel maintainer and set my /boot/uEnv.txt file to containt following lines:

enable_uboot_overlays=1
...
uboot_overlay_addr4=/lib/firmware/BB-BONE-AUDI-02-00A0.dtbo

and rebooted the device.
Upon the reboot, the kernel messaged that DTO has been loaded, but aplay -l didnt list any sound cards. So, it means that CPU still cant talk to the codec. Under the assumption that HW is all fine, what to do to fix this and make the sound out?

Hi @WesPeros , that old overlay: bb.org-overlays/BB-BONE-AUDI-02-00A0.dts at master · beagleboard/bb.org-overlays · GitHub was written for an old Audio cape: AudioCape Rev B…

I very much doubt it’s been tested since 3.8.13…

Do you know which overlay Bela is using?

Regards,

Hello, thanks for the response. They have their own very fancy Xenomai kernel to interface the codec. However, this is what they wrote me when I asked about building the custom board some months ago:

You need a Xenomai kernel for Bela to work. By the way, if you don’t care about Bela’s low latency and toolchain and you prefer to work closer to BB’s mainline image, you could just load the BB-AUDI-02 overlay (which we tested and works, but we do not support, so if anything has stopped working you are on you own).

So, I assume BB-AUDI-02 should do the job. And, also, both my cape, and the Bela are based on the same old Audio Cape device, with the same chip and interface. Do you think it might not work now, for some reason?

So Bela should be using 4.19.94-ti-xenomai-r66, if they are using that overlay, double test that 4.19.94-ti-r68 works with that overlay…

Once you get to v5.4.x+ there’s been a lot of Device Tree ABI changes that have made things fun on ‘mainline’ for BeagleBoard.org’s overlays…

Regards,

1 Like

ok, so you’re suspicious that my cape might work with my kernel? If it doesnt, what would be the best course of action? Downgrade to 3.8.x and use the discontinued capemanager?

i would first test, our production: 4.19.94-ti-r68 kernel to validate the overlay…

Regards,

Not sure if there is any standard testing procedure, but I started this thread after my test failed. The test being: modifying the /boot/uEnv.txt and rebooting the board. If there is something more needed, being a newcomer, I’m not aware of it.

That’s pretty much the test…

But you have not stated which kernel you actually booted or posted a dmesg log so we can see what’s going on…

Start with:

sudo /opt/scripts/tools/version.sh

Regards,

All right, thanks for the tip. This is the script output:

debian@beaglebone:~$ sudo /opt/scripts/tools/version.sh
git:/opt/scripts/:[b39ec679648a6be8f25f48bd1c9784c1fc5a0c46]
eeprom:[A335PBGL00A21749GPB42108]
model:[TI_AM335x_PocketBeagle]
dogtag:[BeagleBoard.org Debian Buster IoT Image 2020-04-06]
bootloader:[microSD]:[/dev/mmcblk0]:[U-Boot 2019.04-00002-g07d5700e21]:[location: dd MBR]
UBOOT: Booted Device-Tree:[am335x-pocketbeagle.dts]
UBOOT: Loaded Overlay:[AM335X-PRU-RPROC-4-19-TI-00A0]
UBOOT: Loaded Overlay:[BB-ADC-00A0]
UBOOT: Loaded Overlay:[BB-BONE-AUDI-02-00A0]
kernel:[4.19.94-ti-r42]
nodejs:[v10.15.2]
/boot/uEnv.txt Settings:
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_addr4=/lib/firmware/BB-BONE-AUDI-02-00A0.dtbo]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]
pkg:[bb-cape-overlays]:[4.14.20200403.0-0rcnee0~buster+20200403]
pkg:[bb-wl18xx-firmware]:[1.20200322.0-0rcnee0~buster+20200322]
pkg:[kmod]:[26-1]
pkg:[librobotcontrol]:[1.0.4-git20190227.1-0rcnee0~buster+20190327]
pkg:[firmware-ti-connectivity]:[20190717-2rcnee1~buster+20200305]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal bluetooth netdev i2c gpio pwm eqep remoteproc admin spi iio docker tisdk weston-launch xenomai cloud9ide]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet]
dmesg | grep remote
[   49.580093] remoteproc remoteproc0: wkup_m3 is available
[   49.825564] remoteproc remoteproc0: powering up wkup_m3
[   49.825593] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217168
[   49.825859] remoteproc remoteproc0: remote processor wkup_m3 is now up
[   51.528725] remoteproc remoteproc1: 4a334000.pru is available
[   51.549182] remoteproc remoteproc2: 4a338000.pru is available
dmesg | grep pru
[   51.528725] remoteproc remoteproc1: 4a334000.pru is available
[   51.528907] pru-rproc 4a334000.pru: PRU rproc node pru@4a334000 probed successfully
[   51.549182] remoteproc remoteproc2: 4a338000.pru is available
[   51.549336] pru-rproc 4a338000.pru: PRU rproc node pru@4a338000 probed successfully
dmesg | grep pinctrl-single
[    0.898273] pinctrl-single 44e10800.pinmux: 142 pins, size 568
[    1.119722] pinctrl-single 44e10800.pinmux: pin PIN100 already requested by ocp:P1_36_pinmux; cannot claim for 48038000.mcasp
[    1.131382] pinctrl-single 44e10800.pinmux: pin-100 (48038000.mcasp) status -22
[    1.138819] pinctrl-single 44e10800.pinmux: could not request pin 100 (PIN100) from group pinmux_bone_audio_cape_audio_pins  on device pinctrl-single
dmesg | grep gpio-of-helper
[    0.907220] gpio-of-helper ocp:cape-universal: ready
lsusb
Bus 002 Device 002: ID 0bda:8179 Realtek Semiconductor Corp. RTL8188EUS 802.11n Wireless Network Adapter
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
END

Okay, there’s one bug:

[    0.898273] pinctrl-single 44e10800.pinmux: 142 pins, size 568
[    1.119722] pinctrl-single 44e10800.pinmux: pin PIN100 already requested by ocp:P1_36_pinmux; cannot claim for 48038000.mcasp
[    1.131382] pinctrl-single 44e10800.pinmux: pin-100 (48038000.mcasp) status -22
[    1.138819] pinctrl-single 44e10800.pinmux: could not request pin 100 (PIN100) from group pinmux_bone_audio_cape_audio_pins  on device pinctrl-single
d

Let’s get a few things updated:

update your kernel:

sudo apt update
sudo apt install bbb.io-kernel-4.19-ti-am335x

Then update the overlays:

sudo apt update
sudo apt install --only-upgrade bb-cape-overlays

Then reboot, and then let’s see if anything changed…

Regards,

Hello again, I’m back home and back on track. I did the kernel update as per your advice, but cant see any differences in the script outputs. The kernel is now 4.19.94-ti-r68, but the bug

could not request pin 100 (PIN100) from group pinmux_bone_audio_cape_audio_pins on device pinctrl-single
still persists.

Best regards

Please run:

sudo /opt/scripts/tools/version.sh

again.

ok, here it goes again:

debian@beaglebone:~$ sudo /opt/scripts/tools/version.sh
git:/opt/scripts/:[b39ec679648a6be8f25f48bd1c9784c1fc5a0c46]
eeprom:[A335PBGL00A21749GPB42108]
model:[TI_AM335x_PocketBeagle]
dogtag:[BeagleBoard.org Debian Buster IoT Image 2020-04-06]
bootloader:[microSD]:[/dev/mmcblk0]:[U-Boot 2019.04-00002-g07d5700e21]:[location: dd MBR]
UBOOT: Booted Device-Tree:[am335x-pocketbeagle.dts]
UBOOT: Loaded Overlay:[AM335X-PRU-RPROC-4-19-TI-00A0]
UBOOT: Loaded Overlay:[BB-ADC-00A0.bb.org-overlays]
UBOOT: Loaded Overlay:[BB-BONE-AUDI-02-00A0]
kernel:[4.19.94-ti-r68]
nodejs:[v10.15.2]
/boot/uEnv.txt Settings:
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_addr4=/lib/firmware/BB-BONE-AUDI-02-00A0.dtbo]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]
pkg:[bb-cape-overlays]:[4.14.20210821.0-0~buster+20210821]
pkg:[bb-wl18xx-firmware]:[1.20200322.0-0rcnee0~buster+20200322]
pkg:[kmod]:[26-1]
pkg:[librobotcontrol]:[1.0.4-git20190227.1-0rcnee0~buster+20190327]
pkg:[firmware-ti-connectivity]:[20190717-2rcnee1~buster+20200305]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal bluetooth netdev i2c gpio pwm eqep remoteproc admin spi iio docker tisdk weston-launch xenomai cloud9ide]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet]
dmesg | grep remote
[   49.096022] remoteproc remoteproc0: wkup_m3 is available
[   49.273916] remoteproc remoteproc0: powering up wkup_m3
[   49.273948] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217148
[   49.274218] remoteproc remoteproc0: remote processor wkup_m3 is now up
[   50.533770] remoteproc remoteproc1: 4a334000.pru is available
[   50.543530] remoteproc remoteproc2: 4a338000.pru is available
dmesg | grep pru
[   50.533770] remoteproc remoteproc1: 4a334000.pru is available
[   50.533952] pru-rproc 4a334000.pru: PRU rproc node pru@4a334000 probed successfully
[   50.543530] remoteproc remoteproc2: 4a338000.pru is available
[   50.543669] pru-rproc 4a338000.pru: PRU rproc node pru@4a338000 probed successfully
dmesg | grep pinctrl-single
[    0.925592] pinctrl-single 44e10800.pinmux: 142 pins, size 568
[    1.150702] pinctrl-single 44e10800.pinmux: pin PIN100 already requested by ocp:P1_36_pinmux; cannot claim for 48038000.mcasp
[    1.162345] pinctrl-single 44e10800.pinmux: pin-100 (48038000.mcasp) status -22
[    1.169773] pinctrl-single 44e10800.pinmux: could not request pin 100 (PIN100) from group pinmux_bone_audio_cape_audio_pins  on device pinctrl-single
dmesg | grep gpio-of-helper
[    0.934551] gpio-of-helper ocp:cape-universal: ready
lsusb
Bus 002 Device 002: ID 0bda:8179 Realtek Semiconductor Corp. RTL8188EUS 802.11n Wireless Network Adapter
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
END

Okay pushed:

Please run on your PocketBeagle:

git clone https://github.com/beagleboard/bb.org-overlays
cd ./bb.org-overlays
make
sudo make install

and change /boot/uEnv.txt

/lib/firmware/BB-BONE-AUDI-02-00A0.dtbo

to

PB-BONE-AUDI-02-00A0.dtbo

(/lib/firmware/ isn’t needed)

it’ll fail again, but it’ll give us a nother pin to add to this list:

Regards,

1 Like

thanks for the effort. Here’s my latest output:

debian@beaglebone:~$ sudo /opt/scripts/tools/version.sh
git:/opt/scripts/:[b39ec679648a6be8f25f48bd1c9784c1fc5a0c46]
eeprom:[A335PBGL00A21749GPB42108]
model:[TI_AM335x_PocketBeagle]
dogtag:[BeagleBoard.org Debian Buster IoT Image 2020-04-06]
bootloader:[microSD]:[/dev/mmcblk0]:[U-Boot 2019.04-00002-g07d5700e21]:[location: dd MBR]
UBOOT: Booted Device-Tree:[am335x-pocketbeagle.dts]
UBOOT: Loaded Overlay:[AM335X-PRU-RPROC-4-19-TI-00A0.bb.org-overlays]
UBOOT: Loaded Overlay:[BB-ADC-00A0.bb.org-overlays]
UBOOT: Loaded Overlay:[BB-BONE-AUDI-02-00A0.bb.org-overlays]
kernel:[4.19.94-ti-r68]
nodejs:[v10.15.2]
/boot/uEnv.txt Settings:
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_addr4=/lib/firmware/PB-BONE-AUDI-02-00A0.dtbo]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]
pkg:[bb-cape-overlays]:[4.14.20210821.0-0~buster+20210821]
pkg:[bb-wl18xx-firmware]:[1.20200322.0-0rcnee0~buster+20200322]
pkg:[kmod]:[26-1]
pkg:[librobotcontrol]:[1.0.4-git20190227.1-0rcnee0~buster+20190327]
pkg:[firmware-ti-connectivity]:[20190717-2rcnee1~buster+20200305]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal bluetooth netdev i2c gpio pwm eqep remoteproc admin spi iio docker tisdk weston-launch xenomai cloud9ide]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet]
dmesg | grep remote
[   48.897257] remoteproc remoteproc0: wkup_m3 is available
[   49.062160] remoteproc remoteproc0: powering up wkup_m3
[   49.062192] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217148
[   49.062460] remoteproc remoteproc0: remote processor wkup_m3 is now up
[   50.439313] remoteproc remoteproc1: 4a334000.pru is available
[   50.451596] remoteproc remoteproc2: 4a338000.pru is available
dmesg | grep pru
[   50.439313] remoteproc remoteproc1: 4a334000.pru is available
[   50.439467] pru-rproc 4a334000.pru: PRU rproc node pru@4a334000 probed successfully
[   50.451596] remoteproc remoteproc2: 4a338000.pru is available
[   50.451770] pru-rproc 4a338000.pru: PRU rproc node pru@4a338000 probed successfully
dmesg | grep pinctrl-single
[    0.921287] pinctrl-single 44e10800.pinmux: 142 pins, size 568
[    1.143118] pinctrl-single 44e10800.pinmux: pin PIN101 already requested by ocp:P1_33_pinmux; cannot claim for 48038000.mcasp
[    1.154766] pinctrl-single 44e10800.pinmux: pin-101 (48038000.mcasp) status -22
[    1.162199] pinctrl-single 44e10800.pinmux: could not request pin 101 (PIN101) from group pinmux_bone_audio_cape_audio_pins  on device pinctrl-single
dmesg | grep gpio-of-helper
[    0.930296] gpio-of-helper ocp:cape-universal: ready
lsusb
Bus 002 Device 002: ID 0bda:8179 Realtek Semiconductor Corp. RTL8188EUS 802.11n Wireless Network Adapter
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
END

Oh, and by the way this is the output after I set my uEnv.txt to /lib/firmware/PB-BONE-AUDI-02-00A0.dtbo . WIthout /lib/firmware/ it didnt show the pin mux, nor the
UBOOT: Loaded Overlay:[BB-BONE-AUDI-02-00A0.bb.org-overlays]
line.

One down:

(4 more to go).

i forget how old 2020-04-06 is! :wink:

fixed!

okay:

cd ./bb.org-overlays/
git pull
make
sudo make install

Regards,

thanks for the effort man, here’s the latest outptut, only important bits:

dmesg | grep pinctrl-single
[    0.921150] pinctrl-single 44e10800.pinmux: 142 pins, size 568
[    1.139459] pinctrl-single 44e10800.pinmux: pin PIN102 already requested by ocp:P2_32_pinmux; cannot claim for 48038000.mcasp
[    1.151118] pinctrl-single 44e10800.pinmux: pin-102 (48038000.mcasp) status -22
[    1.158563] pinctrl-single 44e10800.pinmux: could not request pin 102 (PIN102) from group pinmux_bone_audio_cape_audio_pins  on device pinctrl-single

and pushed:

cd ./bb.org-overlays/
git pull
make
sudo make install

Regards,

thanks! I am starting to see a pattern here:

dmesg | grep pinctrl-single
[    0.921244] pinctrl-single 44e10800.pinmux: 142 pins, size 568
[    1.135664] pinctrl-single 44e10800.pinmux: pin PIN103 already requested by ocp:P2_30_pinmux; cannot claim for 48038000.mcasp
[    1.147330] pinctrl-single 44e10800.pinmux: pin-103 (48038000.mcasp) status -22
[    1.154771] pinctrl-single 44e10800.pinmux: could not request pin 103 (PIN103) from group pinmux_bone_audio_cape_audio_pins  on device pinctrl-single

and fixed!

Yeah, we are just locking the pins to a local use instead of global option it was set to…

Regards,