Because of the holidays, TI E2E™ design support forum responses will be delayed from Dec. 25 through Jan. 2. Thank you for your patience.

TLV320AIC3204: Digital microphone with PDM output - help needed please

Part Number: TLV320AIC3204

Tool/software:

Hello,

I never got to the point of exploring this further but I'm now back on this project.

My current circuit setup uses IN1_L (pin 13) and IN2_L (pin 14) for analog microphones.

For development purpose, I have blank pads on IN1_R (pin 14), IN2_R (pin 16), IN3_R (pin 21) and IN3_L (pin 20) inputs as well. They are currently not used but I can solder wires on the pads to access the pins.

DIN / MFP4 (pin 4) is not used;

SCLK / MFP3 (pin 8) is used as a PCM CLK 8kHz input from a modem.

MISO / MFP4 (pin 11) is used for PCM DATA output to a modem.

GPIO / MFP5 (pin 32) is used for PCM CLK 2.048MHz output to a modem.

Basically, pins 8, 11 and 32 route audio to a modem's PCM input voice channel and I need this.

Question 1: As per document SLOS602A–SEPTEMBER 2008, P0_R81 (ADC channel setup):

D5–D4 R/W 00 Digital Microphone Input Configuration
                         00: GPIO serves as Digital Microphone Input
                         01: SCLK serves as Digital Microphone Input
                         10: DIN serves as Digital Microphone Input
                         11: Reserved. Do not use
D3 R/W 0 Left Channel Digital Microphone Power Control
                         0: Left Channel ADC not configured for Digital Microphone
                         1: Left Channel ADC configured for Digital Microphone
D2 R/W 0 Right Channel Digital Microphone Power Control
                         0: Right Channel ADC not configured for Digital Microphone
                         1: Right Channel ADC configured for Digital Microphone

I presume that I need to select only ONE of the above options? So if I want to select right ADC as mic input, then I wouldn't need to configure D5-D4 so how do I configure these registers? Do I set them to '11' eventhough it says "Reserved. Do not use"? Basically, what I get from this is that a digital mic can stream its PDM data to 5 different digital inputs?

Question 2: As per the table in question 1, if I decide to use "left channel" as digital input, I presume that it blocks the entire left channel (pins 13, 15 and 20) for digital microphone inputs? If this is the case, then perhaps I should experiment with the right channel since it is not used? Therefore, I would set P0_R81 to 0bx10001xx?

Question 3: Again as per SLOS602A–SEPTEMBER 2008 page 25, figure 5.2 "Analog routing diagram", if I use INx_R for the digital microphone input, before going into the ADC, it goes into the Mic PGA. Since this is a digital mic, I presume I will not need the Mic PGA so then I would simply set P1_R59/60 to Left/Right MICPGA is set to 0dB? This would then make that I don't need to configure P1_R52/R54/R55/R57 either?

Question 4: Once I have the digital microphone input configured (e.g. IN1_R pin 14), I guess I don't have the choice but to sacrifice either pin 8, 11 or 32 for the microphone clock? Or is there another pin I can use to time the data? For instance, on my existing circuit, pin 1 MCLK has a 3.072MHz clock going to it coming from a microcontroller. Can I use that for the clock for microphone clocking since this is the base CODEC clock, therefore, everything should be synched off that clock?

Question 5: Once I confirm that microphone has proper clocking and sends its data to the CODEC input, how can I route that I2S audio to the DOUT / MFP2 (pin5) or SEC_DOUT / MISO_MFP4 (pin 11)?

Hopefully this all makes sense!

Thanks!

Benoit

  • Hi Benoit,

    1) You actually need to set all of them. The D5-D4 set which pin the PDM data will arrive into. D3 and D2 set a multiplexer that passes either the sigma delta data (Analog ADC) or the PDM data to the serial interface. The application reference guide gives a little more detail on this than the datasheet does.

    2) You're correct, that analog input pins will be ignored if you select a channel to be digital input.

    3) You're also correct here. As shown in the diagram above, the digital mic input skips the PGA. So settings here can be ignored.

    4) Pin 8 can't output the PDM clock, but yes you have to use either 11 or 32 as your clock output.

    5) DOUT (pin 5) by default is the digital serial output so no extra configuration should be needed. Pin 11 is the DOUT for the secondary interface, which is a different bus altogether, so I would stick with pin 5.

    Best regards,
    Jeff McPherson

  • Hi Jeff,

    Thanks for the detailed explanation. I'll just re-word a few things to make sure that the context of what I am trying to achieve is clear:

    My current design, which I want to avoid modifying as much as I can, has three main parts: an MCU, a modem and the CODEC.

    The MCU is tied to the CODEC's "master" port for IP audio and the "slave" port is tied to the modem's PCM port for voice audio.

    For the master port (IP audio), the MCU outputs a 128KHz BCLK and a 3.072MHz MCLK. In return, the CODEC outputs an 8KHz WCLK and 8-bit audio. The MCU samples the audio on the WCLK l-to-h transitions, each byte is packetized then at some point is sent over IP through some other means.

    For the slave port (voice call audio), given that the modem can only work in one configuration, it is the modem who provides a 2.048MHz BCLK and an 8KHZ WCLK to the CODEC then the CODEC outputs 16-bit PCM audio to the modem's PCM audio input.

    In either of these two cases (IP or voice), they both use the analog microphones on the IN1_L and IN2_L analog inputs. All this works perfectly well.

    Now, I want to add a digital microphone and the goal is to hopefully send its audio to either the IP channel (master) or voice channel (slave).

    The CODEC's slave port is already tied-up with pins 8, 11 and 32 for the modem's voice channel and the only pin left available is DIN / MFP1 (pin 4) and that's fine since it is one of the accepted pins for digital audio.

    The misunderstanding is more with the microphone's clocking: I was thinking of either using the MCLK of 3.072MHz or use S_BCLK of 2.048MHz coming from the modem. The problem with using the 2.048MHz is that it would work only during a voice call as opposed to the MCLK which is always present since it comes from the MCU so it would work on both the IP or voice audio. My guess is that if I use the CODEC's MCLK (from the MCU), I presume that this will make the whole system synch'ed-up with the digital mic's audio.

    Now for my questions to your answers:

    #1- Given that DIN / MFP1 (pin 4) is currently not used, that's the input I will have to use for the digital microphone input. So I understand now: I cannot use the analog input directly e.g. pin 13 for instance, contrary to what I understood at first (which I thought was weird!). Therefore, P0_R81 bits D5-D4 specify which digital input I will use - in my case I will set these bits to 10: DIN serves as Digital Microphone Input (pin 4). In that same register, I then need to specify which ADC input I will sacrifice for the digital mic and in my case, it will the the right ADC because I am using the left one for the two analog microphone inputs therefore bit D3 will remain '0' Left Channel ADC not configured for Digital Microphone and bit D2 will be set to '1' Right Channel ADC configured for Digital Microphone. Is that correct?

    #4- Since S_BCLK (GPIO / MFP5) pin 32 will already have a 2.048MHz signal on it coming from the modem going into the CODEC, can I use that same clock and just 'split' it and feed it to the microphone's CLK input? If so, instead, can I just split the 3.072MHz MCLK coming-out of the MCU going into the modem's MCLK input since that clock is always available in both voice or IP audio? That would be ideal.

    #5- I've indicated that ideally, I'd like to be able to stream the audio on both the IP or voice channel (one at a time). You indicated that DOUT (MFP2) pin5 is the default output for digital audio and that's fine. But how would I route it to the S_DOUT (MISO / MFP4) pin 11 instead of the default?

    New questions:

    #6- If I feed the digital mic with MCLK 3.072MHz and pipe its PDM data into DIN (pin 4) with the result being piped-out the CODEC on DOUT (pin 5), I can then just turn-off the PWM that goes to the CODEC' BCLK input and in return, the CODEC will stop outputting WCLK out of pin 3?

    #7- As for the format out of the CODEC on pin DOUT, for analog audio, I use DSP format because this is the equivalent of PCM. For the digital mic, can I keep DSP? Or do I absolutely have to force it to I2S?

    Thanks again!

    Benoit

  • Hi Benoit,

    Thank you for the context. I don't think I understand what you mean by "master" and "slave" port on the codec. I think you're referring to what the datasheets call "primary" and "secondary" I2S interface. Correct me if I'm wrong but I think my answers to your questions will be the same.

    1) You are correct.

    4) I'm not confident that this will work. The clock of interest here is the ADC_MOD_CLK that comes out of the clock tree in the codec. This clock is what your digital microphone will need in order to sync up correctly to the internals of the codec and decode the data properly. This clock gets derived from MCLK anyway so I don't think syncing is an issue anymore than it would be for the analog mics. But I do think you're out of pins since 11 and 32 are already being used up by your interfaces. Even if one of your clocks (either 3.072 or 2.048 MHz) was equal to the ADC_MOD_CLK, I worry that there'd be no way of ensuring that it was in sync with the internal ADC_MOD_CLK.

    5) Pin 11 becomes the output if you set the LSB of Page 0 Register 33 to 1.Both Pin 11 and Pin 5 are multiplexed to the output from the serial interface.

       

    6) If BCLK is used as the PLL input source, then yes WCLK will stop. If MCLK is used, then BCLK will have no effect.

    7) Once the data reaches the serial interface, you can choose whatever format you like. You will not be forced to I2S by using digital microphones.

    Best regards,
    Jeff McPherson

  • Hi Jeff,

    Thanks for the detailed reply.

    Yes, by "master" and "slave" port on the codec, I meant "primary" and "secondary" I2S interfaces.

    I'll do some testing with #4 re: ADC_MOD_CLK. So from what I understand now, previously with analog microphones, the MCU was reading the data bits off of the 128KHz clock during the high-cycle of the WCLK (the WCLK caused a interrupt on the MCU which triggered the MCU to read the data off the DOUT pin timed with the 128KHz clock transitions).

    Now with a digital mic, either GPIO or MISO clocks have to be setup to output a clock based off ADC_MOD_CLK. Fair enough, however...

    Using analog mics, each data bits were sampled off of the BLCK but every byte for these bits were clocked-off the WCLK.

    So now for the digital mic, S_DOUT/MISO will be used as the microphone clock, which will most likely be quite fast and its PDM data bits will go into DIN pin 4. Good up to here. But in order for the MCU to sample the bits, what clock does it sample the bits off-of? I'm trying to wrap my head around the mapping of analog signals to digital signals:

    > From the MCU's perspective, there are three things: it outputs an 128KHz BLCK to the CODEC, the CODEC generates a 16KHz WCLK and pipes its 8-bits of data out of DOUT.

    > For digital mic, S_DOUT (let's say) needs to be configured as an output clock based off ADC_MOD_CLK and this is the clock that feeds the mic. In return, the mic will then send its PDM audio data to DIN (pin 4) and the audio will come-out on DOUT (pin 5). Fine up to here.

    But now the question: how/where does the MCU sample the bits off of DOUT? In other words, what clock source does the MCU use to time each byte in order to sample the bits and off what clock does it sample each bit off-of?

    Also, Is there a way to make the CODEC output 8-bit data out of DOUT from the CODEC like with my analog configuration?

    Thanks again!

    Benoit

  • Hi Benoit,

    Using analog mics, each data bits were sampled off of the BLCK but every byte for these bits were clocked-off the WCLK.

    This is still true of the PDM/digital mics. The codec will still convert the digital mic data into I2S/TDM and place the data onto DOUT such that it is clocked against BCLK. From the MCU point of view here, the data format will be the same.

    Think of the ADC_MOD_CLK as being synchronous but not related to the I2S bus (BCLK and WCLK). The mod clock helps the mic latch the data coming from the mic, the codec receives this data, and then on the other side of the black box the PDM data is converted into I2S and sent out over DOUT with the data latched to BCLK. Likewise one sample/byte corresponds to a half cycle of WCLK just as it was in the analog mic case.

    Best regards,
    Jeff McPherson

  • Hi Jeff,

    It works!

    The microphone I am using is a Knowles V2D200S.

    For the electrical connections, the only thing I had to do was:

    1) Solder the microphone's PDM data output to the CODEC's pin 4 input;
    2) Solder the microphone's clock input to the CODEC's pin 11 output;

    As explained in an earlier post, I have an application I wrote that connects to my device over IP. Then, I press 'play' and it starts streaming from the analog side, over IP, to my app then I hear in my speakers.

    To get the digital mic working, I simply started streaming for the analog mic then sent it two commands to change CODEC parameters on the fly.

    Here are the only difference for the digital mic vs the analog mic:

    P0_R55: Analog: 002 --> 0x02 --> 0000 0010   Digital: 014 --> 0x0E --> 0000 1110
    >>> D4-D1=0111: MISO is clock output for Digital Microphone

    P0_R81Analog: 228 --> 0xE4 --> 1110 0100   Digital: 232 --> 0xE8 --> 1110 1000
    >>> D5-D4=10: DIN serves as Digital Microphone Input
    >>> D3=1: Left Channel ADC configured for Digital Microphone

    Now that it works, do you have any recommendations of other registers I should tweak or look into? Anything pertaining to gain or volume perhaps?

    I will be off for holidays as of today Friday December 20th and returning to the office on the 6th of January so if you respond to me and I don't, then that's why.

    Thanks again for all your help and happy holidays!

    Benoit

  • Hi Benoit,

    Glad to hear it's working. If you have a valid data stream there's not much else you need to change. At most you should adjust volume based on what kind of volume you are expecting at the next stage. You can try to increase or decrease the volume to find a balance between a strong output level without bringing up the noise floor too high.

    Best regards,
    Jeff McPherson