This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM5728: McASP configuration questions

Part Number: AM5728
Other Parts Discussed in Thread: PCM5102A

Tool/software: Linux

Hi, 

i am using a Beagleboard x15 with an AM5728. I want to connect 8 Microphones to the BBx15 via the Expansion Headers on the back of the board and McASP2. 

McASP2 is not configured in the default linux kernel  under /arch/arm/boot/dts/am57xx-beagle-x15.dts, therefore I am trying to configure and built my own linux kernel. 

I am having trouble figuring out how to configure McASP2 correctly, additionaly i will have to choose an audio codec that supports 8 channels. 

  1. How can i correctly configure the dts file to use McASP2?
  2. What other files need configuration ? 
  3. Which audio codec should I use? Any suggestions? 

  • What Linux version are you using?

    Note that this forum supports only the Sitara processor family. We cannot help on codec selection.
  • Not exactly sure.

    I cloned git://git.ti.com/ti-linux-kernel/ti-linux-kernel.git yesterday and I am looking at the files in the master branch
  • Also I would recommend you to work with the kernel coming with latest AM57x PSDK:

    software-dl.ti.com/.../index_FDS.html

    Regards,
    Pavel
  • Thanks for the help.

    A little update:

    I am using the am57xx Processor SDK and the Kernel coming with it. I want to get it up and running as fast as possible so I reduced the number of microphone to 1 with the option to later add more microphones.

    I tried following the instructions from this Guide and adapting the changes to the AM5728:

    www.ti.com/.../sprac97.pdf

    this is the audio codec file:

    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
    	}
    };

    I verified that pcm5102a is included in the Makefile, I added pcm5102a to Kconfig and selected it via Menuconfig and built the Kernel.

    Device Tree Modifications:

    I used sound2 instead of sound1 because sound1 is already used by the hdmi codec of the beagleboard

    pcm5102a:pcm5102a {
    	#sound-dai-cells = <0>;
    	compatible = "ti,pcm5102a";
    	status = "okay";
    };
    
    sound2: sound2 {
    	compatible = "simple-audio-card";
    	simple-audio-card,name = "PCM5102a";
    	simple-audio-card,format = "i2s";
    	simple-audio-card,bitclock-master = <&sound2_master>;
    	simple-audio-card,frame-master = <&sound2_master>;
    	simple-audio-card,bitclock-inversion;
    	simple-audio-card,cpu {
    		sound-dai = <&mcasp2>;
    	};
    	sound2_master: simple-audio-card,codec {
    		#sound-dai-cells = <0>;
    		sound-dai = <&pcm5102a>;
    		clocks = <&clkout2_clk>;
    		clock-names = "mclk";
    	};
    };
    &mcasp2 {
    	#sound-dai-cells = <0>;
    	pinctrl-names = "default";
    	pinctrl-0 = <&mcasp2_pins>; 
    	/*	
    	assigned-clocks = <&mcasp2_ahclkr_mux>;
    	assigned-clock-parents = <&sys_clkin2>;
    	*/
    	status = "okay";
    	op-mode = <0>;	/* MCASP_IIS_MODE */
    	tdm-slots = <2>;
    	num-serializer = <4>;
    	serial-dir = <	/* 0: INACTIVE, 1: TX, 2: RX */
    		2 0 0 0
    	>;
    	rx-num-evt = <32>;
    	tx-num-evt = <32>;
    };

    &dra7_pmx_core {
    	mcasp2_pins: mcasp2_pins{
    		pinctrl-single,pins = <
    			0x2fc (PIN_INPUT_PULLDOWN | MUX_MODE0)
    			0x300 (PIN_INPUT_PULLDOWN | MUX_MODE0)
    			0x304 (PIN_OUTPUT_PULLDOWN | MUX_MODE0)
    			0x308 (PIN_OUTPUT_PULLDOWN | MUX_MODE0)
    		>;
    	}

    mcasp2_pins is located under dra7_pmx core since am33xx_pinmux or am57xx_pinmux do not exist and previously (older kernel versions) pinmux config was located here. The pinmux config was done with the help of https://docs.google.com/spreadsheets/d/1mSqEpV_BAUHfeNApytxHcGhgTZwypy564GyOr66Nphs/edit#gid=0

    The pinmux syntax used in the guide caused compilation errors (Syntax Errors), therefore I tried different kinds of syntaxes i found in various forum posts and documentation. This is the only one that did not cause Syntax errors.

    The ALSA Configuration was copy pasted from the Guide.

    --> Unfortunately McASP2 with PCM5102a does not appear in the kernel logs, something causes the linux kernel either not to load the linux driver or aborts loading it.

    What could have caused the issue of not loading the linux driver?

  • Ewald,

    Pinmuxing (other than MMC) in linux kernel is not supported, refer to the below e2e threads for details:

    e2e.ti.com/.../661048

    You should make your McASP2 pinmux in u-boot, similar to McASP3:

    u-boot/board/ti/am57xx/mux_data.h

    Regards,
    Pavel
  • Part Number: AM5728

    Tool/software: Linux

    Hi,

    i tried setting up my Beagleboard x15 with the AM5728 up connect various microphones to the McASP2 Pins on Expansion Header P17 (see https://github.com/beagleboard/beagleboard-x15/blob/B1/BEAGLEBOARD_X15_REV_B1.pdf?raw=true).

    I have modified the Linux Kernel in the Processor SDK Linux  for the AM57xx. Making these changes, I was able to add a sound card to the linux kernel and using "aplay -l" it also shows up.

    When i try to use this sound card, i get an error message

    aplay: pcm_write:1939: write error: Input/output error

    This happens after playing a file through either of those:

    aplay -Dhw:2,0 soundfile.wav

    Using a different soundcard, for example the standard soundcard referenced by hw:0,0 gives perfect output.

    There must be something wrong with the configuration of the soundcard. Probing the McASP2 pins with an oscilloscope shows no signal or clock output.

    What could cause this issue?

  • Ewald Rode said:
    i tried setting up my Beagleboard x15 with the AM5728 up connect various microphones to the McASP2 Pins on Expansion Header P17

    Ewald Rode said:
    aplay -Dhw:2,0 soundfile.wav

    Are you trying to play audio file on external microphone? From what I understand, external microphone can be used to capture/record audio, not to play.

    Ewald Rode said:

    When i try to use this sound card, i get an error message

    aplay: pcm_write:1939: write error: Input/output error

    The input and output error typically happens when the ALSA PCM device is not consuming any data. ALSA times out after 10 secs of inactivity. See below pointer for details:

    6.3 Input/Output Error During Audio Playback

    Regards,
    Pavel

  • I set McASP2 up as a Playback device so i could probe the mcasp2 pins with an oscilloscope, just to see if the bitclock and frame sync were configured right.

    Thanks, I now solved this issue. Yes, the ALSA pcm device timed out.

    Still have to look into the clock and frame sync...