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.

TLV320DAC3203: PDM microphone data go through TLV320DAC3203 to MCU issue

Part Number: TLV320DAC3203
Other Parts Discussed in Thread: TLV320AIC3256, TIDA-01236, TLV320AIC3268

Dear sir,

I am a new user for audio codec TLV320DAC3203 using, we are using TLV320DAC3203 (by pin 6 for data and pin 9 for clock) to collect ultrasonic signal (20K~80KHz) from PDM microphone SPH0641LU4H-1 and use TLV320DAC3203 by I2S interface to connect to Micro-controller, how can I transfer the PDM data signal to PCM data signal to micro-controller by using the Decimation filters in TLV320DAC3203? The ultrasonic signal frequency from SPH0641LU4H-1 can be 20K~80K. Which filter I should use for and could you show some example code to me and see how to fix this issue? Thanks.

Best Regards!

Tyler

  • Hello, Tyler!

    Welcome to E2E and thank you for your interest in our products!

    In order to configure the TLV320DAC3203 you would require to configure the PLL and clock dividers to get at least 96KHz of sampling rate. In addition, you may select decimation filters A and B with an AOSR = 64 or decimation filter C with and AOSR = 32. These configuration are specially designed for high sampling rates. So, ultrasonic signals could be supported.

    I attached an example that takes the digital microphone signal from the same pins that you require. It converts the PDM signal into I2S data. Please take a look at it and let me know if you have additional questions or comments.

    Digital Microphone 96KHz.txt
    ###############################################
    # Digital Microphone Script Loopback
    # ---------------------------------------------
    # Digital microphone data (DOUT) is sent to
    # the DAC's DIN pin internally. DOUT data
    # is also sent to the USB controller.
    ###############################################
    
    
    
    ###############################################
    # Software Reset
    ###############################################
    #
    # Select Page 0
    w 30 00 00
    #
    # Initialize the device through software reset
    w 30 01 01
    #
    ###############################################
    
    
    
    ###############################################
    # Clock and Interface Settings
    # ---------------------------------------------
    # The codec receives: MCLK = 12.288 MHz,
    # WCLK = 96 kHz
    ###############################################
    #
    # Select Page 0
    w 30 00 00
    #
    # PLL_clkin = MCLK, codec_clkin = PLL_CLK,
    # PLL on, P=1, R=1, J=8, D=0000
    w 30 04 03 91 08 00 00
    #
    # NDAC = 2, MDAC = 8, dividers powered on
    w 30 0b 82 88
    #
    # DOSR = 64
    w 30 0D 00 40
    #
    # NADC = 2, MADC = 8, dividers powered on
    w 30 12 82 88
    #
    # AOSR = 64
    w 30 14 40
    #
    # Digital Loopback (optional)
    # Routes DOUT to DIN internally, DOUT pin
    # is still output, DIN pin is ignored
    # w 30 1D 10
    #
    ###############################################
    
    
    
    ###############################################
    # Configure Power Supplies
    ###############################################
    #
    # 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
    #
    # Set the input power-up time to 3.1ms (for ADC)
    w 30 47 32
    #
    # Set the REF charging time to 40ms
    w 30 7b 01
    #
    ###############################################
    
    
    
    ###############################################
    # Configure Processing Blocks
    ###############################################
    #
    # Select Page 0
    w 30 00 00
    #
    # PRB_P2 and PRB_R2 selected
    w 30 3C 02 02
    #
    ################################################
    # High-pass first order Butterworth2 filter,
    # fc = 80 Hz
    ###############################################
    #
    # Write to Buffer A:
    #
    # BIQUAD A, Left Channel (Page 8, Register 36, C7-C11)
    w 30 00 08
    w 30 24 7E F8 EB 00 81 07 15 00 7E F8 EB 00 7E F7 DD 00 82 0C 0C 00
    #
    # BIQUAD A, Right Channel (Page 9, Register 44, C39-C43)
    w 30 00 09
    w 30 2c 7E F8 EB 00 81 07 15 00 7E F8 EB 00 7E F7 DD 00 82 0C 0C 00
    #
    # Write to Buffer B:
    #
    # BIQUAD A, Left Channel (Page 26, Register 36, C7-C11)
    w 30 00 1A
    w 30 24 7E F8 EB 00 81 07 15 00 7E F8 EB 00 7E F7 DD 00 82 0C 0C 00
    #
    # BIQUAD A, Right Channel (Page 27, Register 44, C39-C43)
    w 30 00 1B
    w 30 2c 7E F8 EB 00 81 07 15 00 7E F8 EB 00 7E F7 DD 00 82 0C 0C 00
    #
    ###############################################
    
    
    
    
    ###############################################
    # Configure ADC Channel
    ###############################################
    #
    # Select Page 0
    w 30 00 00
    #
    # Configure MISO as clock output for DIGMIC
    w 30 37 0E
    #
    # LADC and RADC enabled for DIGMIC
    # Route SCLK as DIGMIC_DATA
    # Power up LADC/RADC
    w 30 51 DC
    #
    # Unmute LADC/RADC
    w 30 52 00
    #
    ###############################################
    
    
    
    ###############################################
    # Configure DAC Channel
    ###############################################
    #
    # Select Page 1
    w 30 00 01
    #
    # De-pop: 5 time constants, 6k resistance
    w 30 14 25
    #
    # Route LDAC/RDAC to HPL/HPR
    w 30 0c 08 08
    #
    # Select Page 0
    w 30 00 00
    #
    # DAC => 0dB
    w 30 41 00 00
    #
    # Power up LDAC/RDAC
    w 30 3f d6
    #
    # Select Page 1
    w 30 00 01
    #
    # Unmute HPL/HPR driver, 0dB Gain
    w 30 10 00 00
    #
    # Power up HPL/HPR
    w 30 09 30
    #
    # Select Page 0
    w 30 00 00
    #
    # Unmute LDAC/RDAC
    w 30 40 00
    #
    ###############################################
    

    I hope this helps!

    Best regards,
    Luis Fernando Rodríguez S.

  • Hi Luis Fernando Rodríguez S.

    Sorry to response a little late, just came back to office. Thank you very much for your very useful information. And for this digital microphone 96KHz example code you attached, I have another several questions which are not clear to me, sorry for that, I am a new comer for this codec TLV320DAC3203.  

    1. From current ultrasonic microphone Spec, we will get the maximum frequency 80KHz signal(the signal frequency range is 20KHz~80KHz), that means we have to set at least 192KHz (WCLK) of sampling rate in TLV320DAC3203, not 96KHz, right?

    2. If we set the 192KHz sampling rate in TLV320DAC3203, we also need to select the decimation filters A and B with an AOSR = 64 or decimation filter C with and AOSR = 32 like this or we have to change to other AOSR value? Could you help to point out this?

    3. And for below filter in example code, it seems that it is 80Hz High-pass first order Butterworth2 filter. But for me as we will get the 20KHz~80KHz frequency signal from this digital microphone, how should I design this filter? Yes, I saw you set the AOSR=64 in the example code, but this only setting AOSR=64 is not enough for my design, we have to design a filter which meet 20KHz~80KHz frequency signal, right?

    ################################################
    # High-pass first order Butterworth2 filter,
    # fc = 80 Hz
    ###############################################
    #
    # Write to Buffer A:
    #
    # BIQUAD A, Left Channel (Page 8, Register 36, C7-C11)
    w 30 00 08
    w 30 24 7E F8 EB 00 81 07 15 00 7E F8 EB 00 7E F7 DD 00 82 0C 0C 00
    #
    # BIQUAD A, Right Channel (Page 9, Register 44, C39-C43)
    w 30 00 09
    w 30 2c 7E F8 EB 00 81 07 15 00 7E F8 EB 00 7E F7 DD 00 82 0C 0C 00
    #
    # Write to Buffer B:
    #
    # BIQUAD A, Left Channel (Page 26, Register 36, C7-C11)
    w 30 00 1A
    w 30 24 7E F8 EB 00 81 07 15 00 7E F8 EB 00 7E F7 DD 00 82 0C 0C 00
    #
    # BIQUAD A, Right Channel (Page 27, Register 44, C39-C43)
    w 30 00 1B
    w 30 2c 7E F8 EB 00 81 07 15 00 7E F8 EB 00 7E F7 DD 00 82 0C 0C 00
    #
    ###############################################

    Sorry for my so many questions, although I am new, but I have to find out how I can TLV320DAC3203 work correct with MCU from digital microphone signal from 20KHz~80KHz.

    We wish we can get the help from you soon. Have a good weekend!

    Best Regards!

    Tyler

  • Hi, Tyler,

    1. From current ultrasonic microphone Spec, we will get the maximum frequency 80KHz signal(the signal frequency range is 20KHz~80KHz), that means we have to set at least 192KHz (WCLK) of sampling rate in TLV320DAC3203, not 96KHz, right?

    You are right, a 96KHz sampling rate won't be capable to sample correctly the ultrasonic signals at that frequency. So, the 192KHz clock will be required.

    2. If we set the 192KHz sampling rate in TLV320DAC3203, we also need to select the decimation filters A and B with an AOSR = 64 or decimation filter C with and AOSR = 32 like this or we have to change to other AOSR value? Could you help to point out this?

    I would recommend to select the Decimation filter C with an AOSR = 32. This configuration is specific for sampling rates of 192KHz.

    3. And for below filter in example code, it seems that it is 80Hz High-pass first order Butterworth2 filter. But for me as we will get the 20KHz~80KHz frequency signal from this digital microphone, how should I design this filter? Yes, I saw you set the AOSR=64 in the example code, but this only setting AOSR=64 is not enough for my design, we have to design a filter which meet 20KHz~80KHz frequency signal, right?

    The digital filters included in the code that you mentioned are only used to eliminate the DC components that may be included in the digital microphone signal. We recommend to have this filter in your configuration. If you are looking to isolate the specific range of frequencies too, you may include more filters in you signal path. We recommend to take a look at our TI Biquad Coefficient Calculator Tool: http://www.ti.com/tool/COEFFICIENT-CALC. This tool helps to get the coefficients that may be included in you configuration.

    Please feel free to ask for additional information or comments. We will be glad to help you.

    Best regards,
    Luis Fernando Rodríguez S.

  • Dear Luis Fernando Rodríguez S.

    Sorry, we tried the feedback your posted in Jan 15  again and found we also met issue here, we try to get that signal from digital microphone SPH0641LU4H-1, if the signal frequency is below 20KHz, we can get the correct I2S data from MCU. But when the signal is larger 20KHz( We test in 40KHz) from digital microphone, it seems that we can not get the relative frequency I2S data( about 40KHz) from TLV320DAC3203 in MCU, I don't know what wrong with this. But we saw the below information in TLV320DAC3203 design reference guide in page 32. And you mentioned in 1st feedback for my question, TLV320DAC3203 will support ultrasonic signal (>20kHz), and our digital Microphone is SPH0641LU4H-1, it can get the ultrasonic signal up to 80KKHz.

    Could you double confirm whether TLV320DAC3203 ADC can support ultrasonic signal (>20kHz) or not? If TLV320DAC3203 is really supporting ultrasonic signal (20KHz~80KHz from microphone), what is wrong with us in setting? We see TI has a similar design, using the same ultrasonic microphone SPH0641LU4H-1, but the codec is TLV320AIC3256, the design reference file is TIDA-01236. This is very important for us, hope to get your early feedback. Thank you!

    Best Regards!

    Tyler

  • Hi, Tyler,

    I made several tests on the TLV320DAC3203. Unfortunately, even if the device supports sampling rates up to 192KHz, the audio input is limited to the audible range. There's an internal filter that limits the device input from 0KHz to 22KHz. So, your application won't be supported by this device.

    Best regards,
    Luis Fernando Rodríguez S.
  • Hi Luis Fernando Rodríguez S.

    Noted. And does TI has some codec chips which is supporting up to 80KHz ultrasonic signal for my application? Thanks.

    Best Regards!

    Tyler

  • Hi, Tyler,

    I think you would need an audio codec with higher capabilities or with an integrated miniDSP such the TLV320AIC3268. It seems that it was used for ultrasonic signals as mentioned in the TI design below:

    www.ti.com/.../TIDA-00403

    However, it seems that it was made for frequencies up to 40KHz and I cannot guarantee that it will work for your application.

    I strongly recommend to start another E2E thread asking for the TLV320AIC3268. Our audio codecs team will help you as soon as possible if you are interested in this ultra low power audio codec or a device with similar characteristics.

    I apologize if the TLV320DAC3203 couldn't fit all your requirements. However, feel free to ask for more information about it if you require. We will be glad to support you on all your questions.

    Best regards,
    Luis Fernando Rodríguez S.
  • Hi Luis Fernando Rodríguez S.

    Thanks for your feedback, I put another codec TLV320AIC3256 (just with minDSP inside) for this topic for comparsion in last question from me, you can refer to TIDA-01236,  this is TI refernece design for ultrasonic gas leak detector. 

    www.ti.com/.../TIDA-01236

    The codec is TLV320AIC3256 (just with minDSP inside), and use the same ultrasonic microphone SPH0641LU4H-1. And the filter C for TLV320AIC3256 is same from the reference guide page 31 is same as TLV320DAC3203, refer to below picture. I don't know why TLV320AIC3256 can work, but TLV320DAC3203 can't, I just want the ultrasonic data can go to MCU by I2S, no need DSP in codec first, we can use DSP development in MCU. Could help to check? Maybe there is some setting which can ignore the filter setting. Thanks. 

    Best Regards!

    Tyler

  • Tyler,

    Could you try with the PRB_R7, please?  I agree with you that both TLV320AIC3256 and TLV320DAC3203 share the same decimation filters and the digital microphone connections, so it should work as well.

    The 1.5.2 section of the TI Design document mentions the use of PRB_R7. This means that the decimation filter B is used instead of C. Could you try with the indications below, please? Let me know if you get better results.

    Best regards,
    Luis Fernando Rodríguez S.

  • Hi Luis Fernando Rodríguez S,

    my engineer has tried this, but also don't have good result, we don't know what is wrong, so this is not the normal use for ultrasonic design, maybe we have to forget this solution. And I will close this topic. Thanks.

    Best Regards!

    Tyler