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 https://github.com/RobertCNelson/ti-linux-kernel-dev ./kernelbuildscripts
cd kernelbuildscripts/
4- change branch to kernel version 5.10.x build:
#~/kernelbuildscripts/
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:
#user@localhost:~/kernelbuildscripts$
./build_kernel.sh
6- Change line 221 and 222 of the build kernel script and save as “build_kernel_custom.sh”, 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:
unset FULL_REBUILD
#FULL_REBUILD=1
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- http://www.ti.com/
*
* 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>;
simple-audio-card,bitclock-inversion;
sound1_master: simple-audio-card,cpu {
sound-dai = <&mcasp1>;
system-clock-direction = "out";
system-clock-frequency = <24576000>;
clocks = <&clk_mcasp1>;
};
simple-audio-card,codec{
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 |
SNDRV_PCM_FMTBIT_S32_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 |
SNDRV_PCM_FMTBIT_S32_LE
},
};
10- Build using the custom script:
#user@localhost:~/kernelbuildscripts$
./build_kernel_custom.sh
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
eewiki.net: [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
#user@localhost:~$
sudo sh -c "echo 'uname_r=${kernel_version}' >> /media/rootfs/boot/uEnv.txt"
Copy Kernel Image
Kernel Image:
#user@localhost:~$
sudo cp -v ./kernelbuildscripts/deploy/${kernel_version}.zImage /media/rootfs/boot/vmlinuz-${kernel_version}
Copy Kernel Device Tree Binaries
#user@localhost:~$
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
#user@localhost:~$
sudo tar xfv ./kernelbuildscripts/deploy/${kernel_version}-modules.tar.gz -C /media/rootfs/
Networking
Edit: /etc/network/interfaces
sudo nano /media/rootfs/etc/network/interfaces
Add:
#/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.