Trouble getting ALSA layer work with PCM5102A codec - Card not listed in aplay soundcards

Hi everyone!

I’m trying to connect a sound device using beaglebone black Mcasp as a I2S peripheral. I followed this tutorial from Texas (Sitara™ Linux ALSA DSP Microphone Array Voice Recognition and other similar articles but without success. I downloaded the last Beagleboard Kernel as instructed in this article (Debian: Getting Started with the BeagleBone Black), made the necessary modifications and my build was completed successfully. I install as instructed but I get no call or any hint about the driver load during system init.

dmesg | grep pcm

return noting.

The aplay -l command only show the default Beaglebone black sound card.

cat /proc/asound/cards
0 [Black          ]: TI_BeagleBone_B - TI BeagleBone Black
                      TI BeagleBone Black

Could anyone help me?

Best regards,

Vítor Cruz.


I am reviewing the docs. now from the Linux ALSA Voice Recog. now. I think, like @RobertCNelson pointed out in another article on this forum, there are a bit of changes needing to be made in the .dts file.

I will research this idea and by the way, thank you for bringing this article to my attention. This is indeed a good article w/ a lot of work put into it.


P.S. W/ my lack of knowledge on the ALSA utilities and my thirst for making things work, who knows? We may just have a good time trying to get this to work.

I will be posting more in time.

More in Time

  1. at master · beagleboard/ · GitHub
  2. I still need to make time to use this .dts file on my BBB.
  3. This will take time. Holidays and things are in the way. Do not let me forget!

use p9.21 and p9.22 instead and change the source. That 19/20 on P9 is for Cape identification and communication. I saw that the kernel the Utility was using was 4.4.x. I think the newer kernels, esp. w/ building, will be a bit different in the requirements for building.

If you have time, post what you can get working and what does not work. I will do the same.


  1. Are you building the linux kernel from here: GitHub - beagleboard/linux: The official BeagleBoard and BeagleBone kernel repository ?
  2. When you use make menuconfig, exactly how are you using it, what kernel are you using, and…
  3. Are you building w/
    a. make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- tisdk_am335x-evm_defconfig
    b. make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- am335x_evm_defconfig

I am trying to get my bearings here, i.e. this way I will know your route instead of building blindly.

More Stuff to Think About!

  1. linux/pcm5102a.c at master · beagleboard/linux · GitHub
  2. Depending on your kernel that you checkout, mostly w/ git checkout -b YOUR_KERNEL, it will be in the make menuconfig build and the link you posted states where in fact it is located.
  3. I have not built the kernel you are building. Please let me know which one you are building, e.g. 4.4.x, 4.19.x, 5.4.x, and etc…

When you make time, please try to understand I am here and willing to work w/ you. I am not going to just start building a ton of kernels until I find the cure (for now).

If you are using a particular toolchain, which toolchain will also be helpful. Also, what u-boot version will help too. Outside of my recommendations, happy building and please try to relay any info. you are willing to give out.

An update (sort of):

  1. I have tried many different ideas so far. The file(s) do not want to cooperate. There is one file in /lib/modules/YOUR_KERNEL/ that seems like modprobe can help. It does not do anything so far for the pcm file(s).
  2. Okay…
    b. So, by the looks of the file, we need to unxz the file before using modprobe? I tried this too. No go.

I will check.

First off here, I cannot add the module for whatever reason. modprobe does not work nor does insmod.

I keep getting that the file does not exist even though I have unxz 'd the file and then tried to use it w/ modprobe. I think there is something in the way.

I have not gotten to the bottom of it yet! I will keep trying. I noticed one thing, though. Some SBC distributors and mfg. persons like to currently use devm outside of snd for building within the images they produce for their SBCs.

These particular boards w/ the am335x, BBB and similar boards from, show snd but actually use devm in the kernel. I do not know how this is all related so far. I keep on reading and I get nowhere.

Hopefully, this is helpful to you b/c I think the only way to handle it is to build your own image w/ snd available but I am not quite sure as I have not dug into it any further as of now.

@vitorengcruz ,

Hey man, Seth here. So, I found this in the build: $(CONFIG_SND_SOC_PCM5102A) += snd-soc-pcm5102a.o .

So, in fact, this is supposed to be built in the kernel when building your image.


P.S. I will try the makefile quickly. Also…

This may really help more:

dmesg | grep pcm_
[  651.754144] snd_dummy: Unknown symbol snd_pcm_new (err -2)
[  651.754238] snd_dummy: Unknown symbol snd_pcm_hw_constraint_minmax (err -2)
[  651.754461] snd_dummy: Unknown symbol snd_pcm_set_ops (err -2)
[  651.754494] snd_dummy: Unknown symbol snd_pcm_set_managed_buffer_all (err -2)
[  651.754550] snd_dummy: Unknown symbol snd_pcm_hw_constraint_integer (err -2)
[  651.754597] snd_dummy: Unknown symbol snd_pcm_period_elapsed (err -2)

Mostly that first line!

Hi Seth,

Thanks for the help. Sorry about the delay. I’ll detail step-by-step what I did:

1- I downloaded the DEBIAN 9.9 image with LXQT desktop available in beaglebord last images.

2- Flash it in an 32GB SD card using Balena Etcher.

3- I fetch the kernel from GitHub RobertCNelson TI BSP repository:

git clone ./kernelbuildscripts
cd kernelbuildscripts/

4- change branch to kernel version 5.10.x build:

git checkout origin/ti-linux-5.10.y -b tmp

5- Run the build script for the first time, leaving the “menu config” untouched. This command will download the kernel and apply all default patchs for beaglebone boards:


6- Change line 221 and 222 of the build kernel script and save as “”, this will prevent the script to pull the last kernel version from TI repository and apply patchs again, leaving the untouched work copy of KERNEL to be build:


Now is possible to change KERNEL files without risk of loosing local changes.

7- Following some articles, I find “How to interface an I2S microphone with Beaglebone Black(BBB)”, using a similar microphone that I buy (a INMP441 Slave I2S microphone). Parag Sharma create “KERNEL/arch/arm/boot/dts/am335x-boneblack-pcm5102a.dtsi” file and write it’s content:

* Copyright(C) 2016 Texas Instruments Incorporated-
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
&am33xx_pinmux {
 mcasp1_pins: mcasp1_pins{
  pinctrl-single,pins = <
   /* sink must enable receivers */
   AM33XX_IOPAD(0x9a0, PIN_INPUT_PULLDOWN | MUX_MODE3) /* P9_42 mcasp1_aclkx - bit clock */
   AM33XX_IOPAD(0x9a4, PIN_INPUT_PULLDOWN | MUX_MODE3) /* P9_27 mcasp1_fsx - frame sync */
   AM33XX_IOPAD(0x9a8, PIN_INPUT_PULLDOWN | MUX_MODE3) /* P9_41 mcasp1_axr0 - i2s input */
&mcasp1 {
 #sound-dai-cells = <0>;
 pinctrl-names = "default";
 pinctrl-0 = <&mcasp1_pins>;
 status = "okay";
 op-mode = <0>; /* MCASP_IIS_MODE */
 tdm-slots = <2>;
 num-serializer = <4>;
 serial-dir = < /* 1 TX 2 RX 0 unused */
  2 1 0 0
 rx-num-evt = <32>;
 tx-num-evt = <32>;
/ {
 pcm5102a: pcm5102a {
  #sound-dai-cells = <0>;
  compatible = "ti,pcm5102a";
  status = "okay";
clk_mcasp1_fixed: clk_mcasp1_fixed {
  #clock-cells = <0>;
  compatible = "fixed-clock";
  clock-frequency = <24576000>;
clk_mcasp1: clk_mcasp1 {
  #clock-cells = <0>;
  compatible = "gpio-gate-clock";
  clocks = <&clk_mcasp1_fixed>;
  enable-gpios = <&gpio1 27 0>; /* BeagleBone Black Clk enable on GPIO1_27 */
sound1:sound@1 {
  compatible = "simple-audio-card";
  simple-audio-card,name = "PCM5102a";
  simple-audio-card,format = "i2s";
  simple-audio-card,bitclock-master = <&sound1_master>;
  simple-audio-card,frame-master = <&sound1_master>;
sound1_master: simple-audio-card,cpu {
   sound-dai = <&mcasp1>;
   system-clock-direction = "out";
   system-clock-frequency = <24576000>;
   clocks = <&clk_mcasp1>;
   sound-dai = <&pcm5102a>;
   #sound-dai-cells = <0>;

8- Include this “am335x-boneblack-pcm5102a.dtsi” file in “am335x-boneblack.dts”. Just add this line at the end of “KERNEL/arch/arm/boot/dts/am335x-boneblack.dts”.

#include "am335x-boneblack-pcm5102a.dtsi"

9- Add the capture ability to PCM5102A codec, adding capture element code to the file “KERNEL/sound/soc/codec/pcm5102a.c”:

static struct snd_soc_dai_driver pcm5102a_dai = {
    .name = "pcm5102a-hifi",
    .playback = {
        .channels_min = 2,
        .channels_max = 2,
        .rates = SNDRV_PCM_RATE_8000_192000,
        .formats = SNDRV_PCM_FMTBIT_S16_LE |
                   SNDRV_PCM_FMTBIT_S24_LE |
    .capture = {
        .stream_name = "Capture",
        .channels_min = 1,
        .channels_max = 2,
        .rates = SNDRV_PCM_RATE_8000_192000,
        .formats = SNDRV_PCM_FMTBIT_S16_LE |
                   SNDRV_PCM_FMTBIT_S24_LE |

10- Build using the custom script:


11- As the script runs, it will open menu config. At this point, select the PCM5102A and necessary ALSA drivers to be included in the build.

> Device Drivers
    > [*] Sound card support
        > [*] Advanced Linux Sound Architecture
            > [*] ALSA for SoC audio support
                > Audio support for Texas Instruments SoCs
                    > [*] Multichannel Audio Serial Port (McASP) support
                > CODEC drivers
                    > [*] Texas Instruments PCM5102A CODEC

12- After build is finished, it will store all outputs inside “deploy” folder. From there, install this new kernel version on the flashed SD card, as instructed by RobertCNelson:

Install Kernel and Root File System

To help new users, since the kernel version can change on a daily basis. The kernel building scripts listed on this page will now give you a hint of what kernel version was built.

Script Complete [user@localhost:~$ export kernel_version=5.X.Y-Z]

Copy and paste that “export kernel_version=5.X.Y-Z” exactly as shown in your own build/desktop environment and hit enter to create an environment variable to be used later.

export kernel_version=5.X.Y-Z

Set uname_r in /boot/uEnv.txt

sudo sh -c "echo 'uname_r=${kernel_version}' >> /media/rootfs/boot/uEnv.txt"

Copy Kernel Image

Kernel Image:

sudo cp -v ./kernelbuildscripts/deploy/${kernel_version}.zImage /media/rootfs/boot/vmlinuz-${kernel_version}

Copy Kernel Device Tree Binaries

sudo mkdir -p /media/rootfs/boot/dtbs/${kernel_version}/
sudo tar xfv ./kernelbuildscripts/deploy/${kernel_version}-dtbs.tar.gz -C /media/rootfs/boot/dtbs/${kernel_version}/

Copy Kernel Modules

sudo tar xfv ./kernelbuildscripts/deploy/${kernel_version}-modules.tar.gz -C /media/rootfs/


Edit: /etc/network/interfaces

sudo nano /media/rootfs/etc/network/interfaces


auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp

Remove the SD card and boot it in a Beaglebone Black.

Best regards,

Vítor Cruz.

Hello @vitorengcruz ,

I am not familiar w/ building this way. That is neat. So, w/ the scripts that are already available, one could use make menuconfig. Nice.


P.S. I will try to duplicate your way and try my way. Give me time. I will try from scratch and see how far I get.

Hi @silver2row ,

I edit some of the steps, especially the last part (forgot to export variable with the kernel version)

Thanks Seth. Please share if you having trouble following my steps.

Vítor Cruz.

1 Like

Hello @vitorengcruz ,

Seth here. No issue. I will duplicate your steps now, i.e. as you have listed them. Then, I can say:

  1. Yay or nay on the output of sudo find | grep pcm_* and/or dmesg | grep pcm_* .
  2. If your building method works for me, thank you.

When I build, maybe in the next week or so, I will report back quickly following success or failure. Then, I can keep trying “my” way.


P.S. Oh and sir, do not fee like I am holding you back either. If my help is taking too long and you would like others to pitch in, just let me know or disregard my texts/posts. Trying here!

Also sir, I saw where the Arago project was used to handle this building of pcm_* w/ the specific driver you are requesting. So, I may have to dig some more in the Arago project. This will take some time, i.e. these days I do not mess w/ this project as much even though they have some nice projects.

So, you are NOT using this toolchain?


Hello @vitorengcruz ,

I think you need more. More drivers to handle pcm_* or anything pcm_. This is the issue so far I am seeing. You will have to look further in the kernel:

  1. I found some extra kernel modules relating to your query:
    a. linux/edma-pcm.h at master · beagleboard/linux · GitHub
    b. linux/davinci-mcasp.c at master · beagleboard/linux · GitHub

  2. I have to bow out now.
    a. I am sorry.
    b. I will keep trying to build.

  3. I think building those prerequisites may prove valuable on a hunch. Look at 1.b.


P.S. It is directly related to ALSA and pcm_. Also…

In your .pdf you linked, there is a method of adding the required Kconfig options: config SND_SOC_PCM5102A . If you look in the driver, is it SND or DEVM_SND? Although not tested, I still think it is more complicated than just using the ideas they have currently in the .pdf b/c of more files needing to be used plus the .dts needs the required additions.

Hello Again Sir,

@vitorengcruz , I think the build is looking for what is available in the Arago project /bin/ toolchain. They, the people, could have made all sorts of availabilities in the toolchain or could have taken some out.

I mean…I am sure they have gcc and other required files but I just do not know now what is offered w/ Arago Project builds. I saw your build advancements.

I am okay w/ these builds but…

The EDMA and DAVINCI modules may be needed. I will be testing this soon. But…the reason of me saying I could not help any longer is due to the .dts that may have to be written.

I understand about the base and offsets. But, I am not completely sure about syntax w/ the DTC as of now along w/ how the BBB or other am335x boards are reading these files.


P.S. Updates on the way…later in the day here after a bunch of hoopla at work!

Hi @silver2row ,

Thanks about the updates… the thing that is really grind my gears is the fact that the HDMI driver uses the McASP0, ALSA, I2S, DAVINCI… everything presumably I need to make the microphone works is there, as the aplay command return:

debian@beaglebone:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Black [TI BeagleBone Black], device 0: davinci-mcasp.0-i2s-hifi i2s-hifi-0 [davinci-mcasp.0-i2s-hifi i2s-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

I’m wondering this is all about the virtual link between the PCM5102A and the Card enumerator (How Black [TI Beaglebone Black], was assigned as card 0?).

Best Regards,

Vítor Cruz.

1 Like

Hello @vitorengcruz ,

Seth here again. No one else is jumping in and probably for a reason. I think utilizing playback is not easy.

Again, I am virtually terrible at .dts files. Really.

So, maybe commenting out the HDMI on a regular image may do the trick. I am clueless now.


P.S. Please forgive me. In your build, there is a section to create /boot/uEnv.txt and this file used to be responsible for using HDMI or commenting it out. Going back may help or moving forward may be better. It is hard to tell right now. I see what you are describing.

I used crosstool-ng to build a toolchain for kernel 5.x.x. I am going to try to build it and see how far I get. I may survive or hurt my back, i.e. either way, you will find out. Please give me some time. I am going to use make menuconfig as you did but from scratch. I know it is allowed but I do not know if it will go over well on my end.


I cannot test yet. The kernel w/ all the sound arch. built but the u-boot is givin’ me the willies so far.

Updates later in the week!


Hi @silver2row ,

Maybe it could be related to GPIO conflicts between McASP and another peripheral? How can I probe this situation?

Best regards and Happy New Year!!

Out of the Box on the BeagleBone Black, SPI1_SCLK, SPI1_CS0, and SPI1_D0 used for i2s audio are between the am335x and TDA19988.

You’ll need to disable the TDA19988 audio side in the device tree, and route those pins from the P8/P9 header to your device.


So and Yeppers,

Happy New Year! There, like @RobertCNelson , was stating is the effect of removing hdmi_audio from /boot/uEnv.txt.

This will free up your pins for use w/ i2s.


Hello @vitorengcruz ,

I kept replying to this one person. I thought that this one person was you but I probably scared off someone (as usual).


P.S. Sorry. My builds have been terrible so far. So, I have not built the correct advancement of ideas thus far. But…like @RobertCNelson was stating, it is as easy as placing the # mark (comment out) in front of the audio section for u-boot_overlays in /boot/uEnv.txt. (If that makes sense…)



That is what I have currently in my /boot/uEnv.txt file. It is on all the images (mostly).

The config-pin utility will do it:


config-pin p9.28 spi_cs && config-pin p9.22 spi
config-pin p9.31 spi_sclk

That may just do it…

@RobertCNelson ,

The only issue I have seen w/ using the SPI peripheral on the BBBW or other boards supported by the am335x is that the instructions are saying i2s and/or i2c for communication to the main board.


P.S. Leaning towards i2c AND i2s seems to be what the TI people were going for during their experiments. There was a file of ideas on how to incorporate the C5517 w/ the BBB.

@RobertCNelson : I do not know how long you followed the post but here:

This is the file @vitorengcruz is working w/ for now…

Okay…so. It seems that config-pin is looking for specific pins, we are looking for these pins, but I am catching negative feedback on output:

config-pin p9.31 spi
ERROR: write() to /sys/devices/platform/ocp/ocp:P9_31_pinmux/state failed, No such device

I could overwrite w/ a comment the enable_uboot_overlays=1 but then nothing would be available.

SPI1_SCLK, SPI1_CS0, and SPI1_D0 are the pins in question like @RobertCNelson stated. SPI1_SCLK is not registering but currently…

  1. I have kernel 4.19.x
  2. and image Bullseye IoT Image 2022-10-01

Hopefully, that helps a bit for now.

SPI1_SCLK, SPI1_CS0, and SPI1_D0 are the pins to use. If you use the config-pin utility to write the correct, or source or whatever, SPI types for those three pins, I think you will find some footholes.

For instance, config-pin -l p9.28, this command will give you all of what is available under the config-pin utility.

Then, when you see you correct SPI delegate, install it w/ config-pin p9.28 Your_Delegate .

config-pin p9.28 spi_cs
config-pin p9.29 spi
config-pin p9.31 spi_sclk

dmesg | grep pcm*

That is what works on my board.

@silver2row that is terrible advice…

SPI is not I2S, using config-pin to set the pins to SPI is not going to make I2S work…

config-pin does not export I2S for a reason, it’s requires much more configuration.

@vitorengcruz would like to configure the AM335X to talk to a PCM5102A device.

User needs to disable onboard HDMI-Audio, then write an overlay to wire up SPI1_SCLK, SPI1_CS0, and SPI1_DO configured in I2S mode to talk to the PCM5102A…

The best example, is how HDMI-Audio is wired up on the TDA19988 on the BeagleBone Black:


I understand a bit…

I thought the dmesg | grep pcm* command would have helped him a bit on his way. The TI docs. he listed has an older model .dts file.

I think you are right. The /arch/arm/boot/dts/am335x-boneblack-hdmi.dtsi is better than I can teach this idea.


P.S. Oh! So, once the SPI1’s in question are configured to handle such a peripheral, then one can move forward. Okay. No issue. I thought it was as simple as editing/commenting the audio in /boot/uEnv.txt and then jumping to SPI1’s for configuration. I am mistaken. But yes sir, i2s will need to be configured in the .dts/.dtsi file(s). Okay.


And sir, I have no clue what exact uname -a he is dealing w/ nor do I know his current image. This is an issue so far. I can do no replicating of issues on my side plus if the kernel .dtsi file located in the kernel has changed, then…bloopers.

@vitorengcruz : Sir, try to give out this info. if you can for replication.

uname -a

cat /etc/dogtag

Aw hell, who am I kidding? He can do that work. I keep thinking I am helping. I am more of a confusion instance anyways. I am sorry but I cannot let this go. I will try to explain something.

If you have TX && RX, use it unless you have a EEPROM onboard the EVM to handle the connection. I saw on the EVM, there was an opportunity to use it via jumpers.

// Partially made by and Seth

// SPDX-License-Identifier: GPL-2.0-only
 * Copyright (C) 2012 Texas Instruments Incorporated -

#include <dt-bindings/pcm5102a.h>
#include <dt-bindings/interrupt-controller/irq.h>

&am33xx_pinmux {
	pcm5102a_bone_pins:pcm5102a_bone_pins {
		pinctrl-single,pins = <

&i2c0 {
	pcm5102a: pcm5102a@23 {
		compatible = "ti,pcm5102a";
		reg = <0x23>;
		ti,calib-gpios = <&gpio1 25 0>;
		interrupts-extended = <&gpio1 25 IRQ_TYPE_LEVEL_LOW>;

		pinctrl-names = "default", "off";
		0x1a0 0x23 // P9_42 mcasp1_aclkx - bit clock
        0x1a4 0x23 // P9_27 mcasp1_fsx - frame sync
        0x1a8 0x23 // P9_41 mcasp1_axr0 - i2s input

		#sound-dai-cells = <0>;
		audio-ports = <PCA5102a 0x23>; 

&mcasp0	{
	#sound-dai-cells = <0>;
	pinctrl-names = "default";
	pinctrl-0 = <&mcasp0_pins>;
	status = "okay";
	op-mode = <0>;	/* MCASP_IIS_MODE */
	tdm-slots = <2>;
	serial-dir = <	/* 0: INACTIVE, 1: TX, 2: RX */
			0 0 1 2 // Try this idea...
	tx-num-evt = <2>;
	rx-num-evt = <1>;

/ {
	clk_mcasp0_fixed: clk_mcasp0_fixed {
		#clock-cells = <0>;
		compatible = "fixed-clock";
		clock-frequency = <24576000>;

	clk_mcasp0: clk_mcasp0 {
		#clock-cells = <0>;
		compatible = "gpio-gate-clock";
		clocks = <&clk_mcasp0_fixed>;
		enable-gpios = <&gpio1 27 0>; // BeagleBone Black Clk enable on GPIO1_27

	sound {
		compatible = "simple-audio-card";
		simple-audio-card,name = "TI BeagleBone Black";
		simple-audio-card,format = "i2s";
		simple-audio-card,bitclock-master = <&dailink0_master>;
		simple-audio-card,frame-master = <&dailink0_master>;

		dailink0_master: simple-audio-card,cpu {
			sound-dai = <&mcasp0>;
			clocks = <&clk_mcasp0>;

		simple-audio-card,codec {
			sound-dai = <&pcm5102a>;

This is far from workable. I want to give you a glimpse. I need to test but that is not going to happen. I do not have the EVM. Blah. I will keep trying if you are willing to test some.

More research in time. It is getting towards 10:00 p.m. I am not sure about what people think of using the forums later in the evening…


Too late for now but word of advice: driver-changes.rst « pcmcia « Documentation - kernel/git/torvalds/linux.git - Linux kernel source tree and work backwards until you see kernel 4.1.x or kernel 4.9.x and then work forwards to you get back to where you came from…No offense but I think this is outdated and respectful to the kernel if, and this is if you would still like my help, we would not jump and cause ruckus w/in and around or something.

Hi @silver2row and @RobertCNelson ,

Thanks about the advice. The thing is the McASP0 configuration can conflict with McASP1? The original article uses this pinmap:

With is using McASP1 instead of McASP0. The device TMDSC5517 is a DSP evaluate board that output audio by I2S bus, much the same parameters as my INMP441 microphone needs except the bit clock in my application must be output by Beaglebone Black.

So this last documentation that @silver2row share (driver-changes.rst « pcmcia « Documentation - kernel/git/torvalds/linux.git - Linux kernel source tree) could be related to this problem?