Beaglebone AI Kernel 5.10 - McASP configuration to interface INMP microphone through ALSA layer

Hi everyone!

I’m currently working with a Beaglebone AI board, with has a AM5729 processor, as a voice record device for an IoT based project. To do so, my team choose the INMP441 MEMS I2S microphone as a baseline for our first insight about recording voice in a Linux environment, as it have a digital interface that get better signal/noise ratio than analog interfaces.

There are many how-to-do McASP configuration tutorials for AM3358, processor of the Beaglebone Black, but don’t find any official tutorial for AM5729.

I would like to configure the McASP of AM5729 as a master I2S to interface the INMP441 microphone and transfer data to my applications through ALSA layer.

I was able to download 5.10 kernel files from beaglebone git and insert the modifications necessary to create a dummy codec in order to create a simple sound card to interface the microphone with ALSA, as describe in the document:

Sitara™ Linux ALSA DSP Microphone Array Voice Recognition

As the document refers to AM3358 processor and a master microphone, I modify the instructions to add the AM5729 PINMUX configuration in the file “KERNEL/arch/arm/boot/dts/am572x-boneai-inmp441.dtsi” (based on am335x-boneblack-pcm5102a.dtsi file):

 * 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.
//Beginning section, defining pin header on external port
#define P9_31b (0x3400 + 4 * 169) // PID is 169 //0x36A4 MCASP1_ACLKX
#define P9_29b (0x3400 + 4 * 170) // PID is 170 //0x36A8 MCASP1_FSX
#define P9_26a (0x3400 + 4 * 162) // PID is 162 //0x3688 MCASP1_AUR8

&dra7_pmx_core {
 mcasp1_pins: mcasp1 {
  pinctrl-single,pins = <
   DRA7XX_CORE_IOPAD( P9_31b, MUX_MODE0 ) // P9.31 mcasp1_aclkx
   DRA7XX_CORE_IOPAD( P9_29b, MUX_MODE0 ) // P9.29 mcasp1_fsx
   DRA7XX_CORE_IOPAD( P9_26a, PIN_INPUT_PULLUP | MUX_MODE1 ) // P9.26 mcasp1_aur8
&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 = <9>;
 serial-dir = < /* 1 TX 2 RX 0 unused */
  0 0 0 0 0 0 0 0 2
 rx-num-evt = <1>;
 tx-num-evt = <1>;

/ {
 inmp441: inmp441{
  #sound-dai-cells = <0>;
  compatible = "inmp441";
  status = "okay";
 sound1: sound@1 {
  compatible = "simple-audio-card";
  simple-audio-card,name = "INMP441";
  simple-audio-card,format = "i2s";
  simple-audio-card,bitclock-master = <&sound1_master>;
  simple-audio-card,frame-master = <&sound1_master>;
  simple-audio-card,cpu {
   sound-dai = <&mcasp1>;
  sound1_master: simple-audio-card,codec {
   #sound-dai-cells = <0>;
   sound-dai = <&inmp441>;

I followed this tutorial to built the kerner for Beaglebone AI, modifying a Debian 10 with LXQT desktop image, but change the default bb.org_defconfig to tisdk_am57xx-evm_defconfig:

The compilation process was successful, but when I install the custom kernel and boot the BB AI and run the command “arecord -l” I get:

debian@beaglebone:/var/lib/cloud9$ sudo arecord -l
arecord: device_list:272: no soundcards found...

Also, the HDMI does not working anymore, but I still can send commands through Cloud9 interface.

Can you give me some tips about what I’m missing in the configuration process?

inmp441 kernel (39,6,KB)

Inside the attachment there is the steps I followed to customize my Kernel, assuming you download the 5.10 source files to “~/FlimOS/” folder.

Best Regards,

Vítor Cruz.