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: Output only from CH1 when more than 2 mics

Part Number: PCMD3180

Tool/software:

Hello,

Back with another question on the PCMD3180. I've previously had some issues with implementing the multiplexer in my circuit, described in the previous post. Since then, I've managed to get the I2S output to work. However, it only works with one or two microphones at a time. When I am trying to use 4 microphones, the I2S output reflects only the input from PDM channel 1. 

Circuit brief description: 

  • ESP32-S2 acts as I2S master sending PCMD initialisation registers, FSYNC and BCLK (48 kHz and 1.536 MHz). Signals are clean and stable.
  • I2S is set to right/left mode (stereo). 
  • PCMD3180 is set so slave mode. Drives SDO directly to ESP32. Can provide PDM clocks to microphones (0.768 or 1.536 MHz).
  • 4x PDM microphones set as L/R pairs on PDM_IN1 and PDM_IN2. They both return stable SDA.
  • All PCMD registers initialise as instructed and all voltages (AVDD, IOVDD, etc.) are clean and stable.

When initialising the PCMD registers for 1 microphone, left slot 0, and the ESP for I2S mono, the received I2S signal is clean. This works on any PDM_IN channel on the PCMD, regardless of left or right mic select.

When initialising the PCMD registers for 2 microphones, left slot 0 and right slot 0, and the ESP for I2S stereo, the received signal is clean, with clear L/R differences, albeit quieter compared to the mono version. Same here, this works for any PDM_IN channel, as long as they are set to occupy slots 0.

However, when initialising the PCMD registers for 4 microphones, slots left 0, right 0, left 1, right 1, the received output is only from PDM_IN channel 1, left slot 0, regardless of which PDM_IN channels were used. All the data on the right channel is the same as the data on the left channel. This was confirmed by tapping or speaking into the 4 mic capsules in order and then plotting the audio waveform. The plot shows the taps only on PDM_IN1, left slot 0. In the speech case, it can be clearly heard that the speaker is close only to the PDM_IN1 mic and the other 3 microphones are not proximity sensitive (contrary to the 2 microphone L/R case, where proximity was well represented). There seem to be no issues with the PDM microphones or channels themselves, as PDM_CLK is driven from the PCMD and the mics return stable PDM_SDA. 

I tried a different slot allocation, slots left 0, 1, 2, and 3, and tried placing 1 microphone per PDM_IN channel and also in pairs in 2 PDM_IN channels. In both cases, I only received data from left slot 0 in the left channel and only 0 in the right channel (which is expected). 

I tried changing the DSP_CFG registers to sum the outputs of the PDM channels (CH1+CH2)/s and (CH3+CH4)/2, but that seems to only have halved the amplitude of the signal on CH1, left slot 0.  

I tried using the ADC140 EVM I previously used to test the system while I was using a breadboard. However, since transferring the circuit to a custom made PCb, the EVM can not return a clean output anymore. I noticed that regardless of the register settings in the PPC3 GUI, the PCMD connected to the EVM could not start the PDM_CLK divider and send it out on the PDM_OUT channels. The FSYNC and BCLK signals were noisy, and the BCLK would not drop below 3.1 MHz, regardless of GUI settings. 

Are there any other registers I have to change besides enabling each channel or is there anything else I have to do to get the I2S output to work with 4 or more microphones? If my understanding of I2S and the information about in the PCMD user manual are correct, then the I2S can return a stereo output with more than 2 microphones' inputs by interleaving the left/right slots. If so, why am I only seeing the output from left slot 0?

Thank you in advance.

  • Hi Matei,

    Your BCLK to FSYNC ratio is 32bits (1.536 MHz/ 48kHz). Since you said this works for 2 mics, then I assume your bit depth is the minimum 16 bits. 

    If my understanding of I2S and the information about in the PCMD user manual are correct, then the I2S can return a stereo output with more than 2 microphones' inputs by interleaving the left/right slots.

    I think this is the root of the problem. Our devices do not interleave the left/right slots. They are appended to each other. So for a 4 channel case, you would see left 0, left 1, right 0, right 1 in sequential order, very similar to how TDM looks. Your BCLK isn't fast enough to support all 4 channels, which leads to weird results like you are seeing. I would first try to double your BCLK so that you have a BCLK/FSYNC of 64. Then check if you can see 4 channels on the data output. Make sure your receiver settings are adjusted as well to the new data format.

    Best regards,
    Jeff McPherson

  • Hello Jeff,

    Thank you for the clarification. Yes, I forgot to mention, the bit depth I'm working with is 16. I've changed the slot allocation order to left 0, left 1, right 0, right 1 for the ASI channels 1, 2, 3, 4, respectively. Additionally, I've increased the PDM_CLK speed to 3 MHz. That seems to have solved the issue of the left channel data being copied over to the right channel. Now the received left and right channels are different and show spatiality and proximity. However, the channels are shifted by 90 degrees on playback. Meaning that I can hear left 0 and right 0 (ch 1& 3) in the left output channel, and left 1 and right 1 (ch 2 & 4) in the right output channel. I think I might have to play arround with the ASI channel settings...

    Unfortunatelly, the Arduino I2S library I am using does not allow me to directly change the BCLK or increase the channel number; I can only select mono or stereo. I might have to look for another library or another solution. 

  • Hi Matei,

    I2S is a tricky format to use with more than 2 channels, so your Arduino library might be interpreting your format incorrectly. By definition I2S only supports 2 channels, so I have seen people run into a problem like this where the I2S library is fixed at 2 channels. You might consider a TDM library and using the TDM format instead, which is defined to support any number of channels.

    You could also "trick" your Arduino by accounting for the channel shift on the codec side, meaning swap the slots of CH2 and CH3. Right 0 and Left 1 will still appear on the "wrong" side, but by making the same swap on the codec side the mic data should appear where you expect them to.

    Best regards,
    Jeff McPherson