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.

TLV320AIC3204: Convert Microphone data into PCM data

Part Number: TLV320AIC3204


Hi,

I have digital microphone input which is connected as input to the CODEC TLV320AIC3204 in the PIN SCLK/MFP3.

I2S clocks BLCK and WCLK is given as input to the CODEC. Expecting I2S output from pin DOUT/MFP2.

Can anyone help with the register configurations needed for this purpose.

Thanks and Regards,

Suresh.

  • Hi Suresh,

    Two register writes are required to configure SCLK/MFP3 as digital microphone input.

    1. ADC Channel Setup Register, page 0 register 80 (P0_R81),
    • Bits D5-D4, Digital Microphone input configuration = 01.

             2.SCLK/MFP3 Function Control Register, page 0 register 56 (P0_R56)

    • Bits D2-D1, SCLK function control Configuration = 01

    Where are the digital mic clock and power pins routed? Is it connected to the codec or to an external device? If the codec has to generate clocks additional register configurations will  be required. Let us know if you need any assistance for clock configuration.

    Best Regards.

  • Hi,

    Looks like register address are not matching.

    Page 0/ Register 81 bits D5-D4 should be configured as 1 and Page 0/ Register 56 bits D2-D1 should be configured as 01.

    Digital Mic clock is generated from CODEC and given as output from GPIO/MFP5 pin.

    For the I2S conversion BLCK and WCLK(8KHZ) is connected as input from external device.

    I2S output data needs to be taken from CODEC. output pin configured from DOUT/MFP2.

    Regards,

    Suresh

  • Hi Suresh,

    You are indeed right. It is bits D2-D1 of Page 0/ Register 56. I have corrected my earlier response to reflect that.

    To route digital microphone clock to GPIO/MFP5, Page 0/ Register 52/ Bits D5-D2 has to be set to 1010.

    Best Regards.

  • Hi Diljith,

    As of now I could see CODEC is getting pdm data as input.

    I need to know how to take i2s data as output from codec. Probably required register configuration to take data out.

    Regards,

    Suresh

  • Hi Suresh,

    DOUT/MFP2 is the default pin for ASI-1 output. So configuration is not required. Could you list out the registers that you are programming? You probably haven't un-muted the ADC (Page 0/ Register 82).

    Best Regards.

  • Hi Diljith,

    Below is the register programming:

    Page 0:

    Register 0xB to 0x81 //Clock divider 

    Register 0xC to 90 //Clock divider

    Page 1:

    Register 0x1 to 0x8  //AVDD supply

    Register 0x2 to 0x00 // Enable master analog power control

    Register 0x47 to 0x31 // power up time to 3.1ms

    Page 0:

    Register 0x3F to 0xD6 // Power up LDAC and RDAC

    Register 0x51 to 0x10 // SCLK act as digital output

    Register 0x52 to 0x00 // Unmute ADC output for both the channel

    Register 0x34 to 0x28 // Digital Mic clock output from MFP5 pin

    Let me know if these register settings are fine..

    Thank you,

    Suresh.

  • Hi Suresh,

    It appears that you are programming the DAC-related settings instead of ADC related settings.

    Please use the following as reference and modify as needed. I am assuming an MCLK  of 12.288 MHz and sampling frequency of 8 kHz.


    ###############################################
    # Software Reset
    ###############################################
    #
    # Select Page 0
    w 30 00 00
    #
    # Initialize the device through software reset
    w 30 01 01
    #
    ###############################################


    ###############################################
    # Clock Settings
    # ---------------------------------------------
    # Assumption : MCLK = 12.288 MHz, WCLK = 8 kHz
    ###############################################
    #
    # Select Page 0
    w 30 00 00
    #
    # NADC = 1, MADC = 12
    # Modulator Clock = Dig Mic Clock = MCLK/(NADC*MADC) = 1.024 MHz
    w 30 12 81
    w 30 13 8C
    #
    # AOSR default = 128, Sampling Frequency FS = Modulator Clock/128 = 1024/128 = 8 kHz
    # Change MADC to 6 if Sampling frequency of 16 kHz is required
    ###############################################



    ###############################################
    # Signal Processing Settings
    ###############################################
    #
    # Select Page 0
    w 30 00 00
    #
    # Set the ADC Mode to PRB_P1
    w 30 3d 01 | Default
    #
    ###############################################


    ###############################################
    # Initialize Codec
    ###############################################
    #
    # Select Page 1
    w 30 00 01
    #
    # Disable weak AVDD in presence of external
    # AVDD supply
    w 30 01 08
    #
    # Enable Master Analog Power Control
    w 30 02 00
    #
    # Select ADC PTM_R4
    w 30 3d 00
    #
    # Set the input powerup time to 3.1ms (for ADC)
    w 30 47 32
    #
    # Set the REF charging time to 40ms
    w 30 7b 01
    #
    ###############################################


    ###############################################
    # Recording Setup
    ###############################################
    # Select Page 0
    w 30 00 00
    #
    # w 30 38 02 # Default | Enable SCLK pin for Dig Mic Input
    #
    w 30 34 28 # Digital Mic Clock output on GPIO/MFP5
    #
    # Power up LADC & Configure for digital microphone
    w 30 51 98
    #
    # Unmute LADC/RADC
    w 30 52 00
    #
    ###############################################

  • Hi Diljith,

    Thanks for the detailed register configuration.

    After Removing DAC configuration and with your ADC related settings, Data output from Codec on Left channel is always '1'.

    Which means do we need to do some more configurations?

    Regards,

    Suresh.

  • Hi Suresh,

    Did you check the inputs and outputs to the digital mic?  Are you powering the digital mic through the codec or externally? Is the digital mic clock frequency proper and is the digital mic data toggling properly?

    Best Regards.

  • Hi Diljith,

    Yes it is. Microphone is giving proper data to the codec. 

    Here my doubt is like Digital microphone data which is coming at 1.5Mhz to the codec should be given to DAC and from DAC to ADC right for the PDM to PCM conversion of 8KHZ.

    Regards,

    Suresh.

  • There is no need to route the PDM data to DAC. PDM data is routed to the ADC's CIC filter when configured for digital microphone mode.

    The only other thing that I can think of is enabling both left and right channels for digital microphone, i.e. you could try setting page 0, register 0x51 as 0xDC instead of 0x98.

    How about the I2S interface? Is the I2S running in master mode or slave mode? Did you check the clocks on the I2S side?

    Best Regards.

  • Hi Diljith,

    Yes you are correct. I was not aware of CIC filter in the path.

    I have enabled both the channel for ADC but still output from codec is same as earlier which is always high.

    Codec I2S is in slave mode. Both BLCK and WCLK is input to the codec.

    Regards,

    Suresh.

  • Other suggestions are welcome.

    Thanks in advance.

    Regards,

    Suresh.

  • Sorry for the delay. I was out of office for a few days. Are you still getting outputs from the codec as always high?

    Best Regards.

  • Hi Diljith,

    Now it is resolved. Getting PCM data from Codec.

    Thank you very much for your support.

    Regards,

    Suresh.