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.

PCMD3180: Channel selection and configuration with linux driver

Part Number: PCMD3180
Other Parts Discussed in Thread: TLV320ADC3140

We are testing a new PCB prototype using the PCMD3180 codec and 4 digital PDM microphones. Each microphone is connected to one of the GPI inputs as shown in our schematic:

We are using the shared upstreamed linux driver for TLV320ADCx140, following the details from this forum post: https://e2e.ti.com/support/audio-group/audio/f/audio-forum/954542/faq-pcmd3180-is-there-a-linux-driver-for-the-pcmd3180-devices

Our host is a raspberry PI 4 compute module.

We have had some initial success and are able to record sound through one of our microphone channels, channel 1, and the quality appears to be good. We have not been able to record sound through any of the other channels however. We're use I2S for dai format / protocol.

We have the following questions:

1. For our configuration where we have one PDM microphone on each GPI input, does this correlate to using channels 1,3,5,7? Channels 2,4,6,8 are unused?

2. The linux driver indicates support for sampling rates of 44.1kHz and 48kHz, can that driver also be used for 96kHz and 192kHz sample rates?

3. Assuming the use of I2S can only handle 2 channels for left and right for the rPI by default, how do we select which 2 digital microphones are used for the left and right channel of the I2S stream?

We've been using amixer for testing different combinations of channels, but have only gotten audio from channel 1 so far. Here is an example of trying to configure for channels 1 and 3:

amixer cset numid=29,iface=MIXER,name='CH1_ASI_EN Switch' On
amixer cset numid=30,iface=MIXER,name='CH2_ASI_EN Switch' Off
amixer cset numid=31,iface=MIXER,name='CH3_ASI_EN Switch' On
amixer cset numid=32,iface=MIXER,name='CH4_ASI_EN Switch' Off
amixer cset numid=33,iface=MIXER,name='CH5_ASI_EN Switch' Off
amixer cset numid=34,iface=MIXER,name='CH6_ASI_EN Switch' Off
amixer cset numid=35,iface=MIXER,name='CH7_ASI_EN Switch' Off
amixer cset numid=36,iface=MIXER,name='CH8_ASI_EN Switch' Off

amixer cset numid=25,iface=MIXER,name='MIC1M Input Mux' 2 # 0x3C, ADCX140_CH1_CFG0, sets the channel 1 to a digital microphone input
amixer cset numid=26,iface=MIXER,name='MIC2M Input Mux' 2 # 0x41, ADCX140_CH2_CFG0, sets the channel 2 to a digital microphone input
amixer cset numid=27,iface=MIXER,name='MIC3M Input Mux' 2
amixer cset numid=28,iface=MIXER,name='MIC4M Input Mux' 2

amixer cset numid=17,iface=MIXER,name='MIC4P Input Mux' 2
amixer cset numid=18,iface=MIXER,name='MIC4P Input Mux' 2
amixer cset numid=19,iface=MIXER,name='MIC4P Input Mux' 2
amixer cset numid=20,iface=MIXER,name='MIC4P Input Mux' 2

amixer cset numid=46,iface=MIXER,name='PDM Clk Div Select' 0

We've also tried several other combinations of channels using the 'CHX_ASI_EN Switch' which I think should correlate to which channels we have enabled. Our assumption is that if we enable two channels, they will be slotted into the left and right channels of our I2S stream. Is there something we're missing here?

Our device tree is setup as follows, we are are using simple-audio-card for the sound card right now:

/dts-v1/;
/plugin/;

/ {
compatible = "brcm,bcm2708";

fragment@0 {
target = <&i2s>;
__overlay__ {
#sound-dai-cells = <0>;
status = "okay";
};
};

fragment@1 {
target-path = "/";
__overlay__ {
pcmd3180_mclk: codec-mclk {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <24000000>;
};
};
};

fragment@2 {
target = <&i2c1>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";

pcmd3180_a: pcmd3180@4C{
compatible = "ti,tlv320adc3140";
reg = <0x4C>;
data-protocol = <0>;
ti,mic-bias-source = <0>;
ti,pdm-edge-select = <1 1 1 1>;
ti,gpi-config = <4 5 6 7>;
ti,gpo-config-1 = <4 1>;
ti,gpo-config-2 = <4 1>;
ti,gpo-config-3 = <4 1>;
ti,gpo-config-4 = <4 1>;
ti,asi-tx-drive = <1>;
ti,gpio-config = <0 0>;
};
};
};


fragment@3 {
target = <&sound>;

sound_overlay: __overlay__ {
compatible = "simple-audio-card";
simple-audio-card,format = "i2s";
simple-audio-card,name = "pcmd3180-soundcard";
status = "okay";

simple-audio-card,bitclock-master = <&dailink0_master>;
simple-audio-card,frame-master = <&dailink0_master>;

dailink0_master: simple-audio-card,cpu {
sound-dai = <&i2s>;
clocks = <&pcmd3180_mclk>;
};
simple-audio-card,codec {
sound-dai = <&pcmd3180_a>;
};
};
};

__overrides__ {
card-name = <&sound_overlay>,"simple-audio-card,name";
};
};

Thank you,

~Jeremy

  • Hello Jeremy,

    Thank you for your patience, I will need time to review your questions and I will get back to you within 48 hours.

    Best Regards,

    Carson

  • Hello Jeremy,

    Your assumption is correct about what channels would output given you only have 4 mics attached. In the TDM mode it allows you to select what channel goes into what slot including into either the left or right side of the same I2S slot.

    You should be able to run at any capable Fs rate.

    Cannot really help with actual linux specifics as we are not currently supporting linux debug problems until our Applications team is ramped up from prior team responsible for these parts about linux, which has no timetable unfortunately.

    Best Regards,

    Carson 

  • Okay, thanks for taking a look, we'll keep investigating. I should be able to trace down how the linux driver configurations map to what register settings are on the codec. If needed, If we're able to formulate questions in terms of register settings on the PCMD3180, scope traces, etc. Is that something that would be appropriate to get feedback on this forum?

  • Hello Jeremy,

    That would be more viable for feedback.

    Closing this thread, pls post with further questions in new thread.

    Thanks,

    Carson