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: Increase bitrate from 8-bit mono @ 8kHz to 16-bit mono @ 16kHz

Part Number: TLV320AIC3204


Tool/software:

Hello,

My CODEC interfaces to an MCU and the MCU is also connected to a modem. On the CODEC, I have a PDM microphone.

The MCU outputs a 128kHz PWM to the CODEC's BCLK and in return, the CODEC outputs an 8kHz WCLK. This makes that I have 8-bit 8kHz audio.

I now want to have 16-bit 16kHz audio. So I increased the BCLK to 256kHz and the CODEC returns 16kHz. However, as much as the audio does appear to sound of better quality / clearer, it is suuuuper slow.

Using the AIC software to show me the proper values, I changed MDAC/MADC (P0_R12/P0_R19) from 0x8C to 0x86 and that's what returns a 16kHz WCLK.

For the rest, the MCU is sending it a 3.072MHz clock to MCLK input. Then I have PLL enabled with R=3, J=40 and P=2. Using the AIC software, it shows a 184.32MHz CODEC_CLKIN under the "CODEC CLOCK / PLL" tab and then under the "Dividers" tab, NDAC/NADC are se to 15, MDAC/MADC are set to 12, DOSR/AOSR set to 128. All this shows ADC_CLK 12.288MHz;

- When using 8-bit 8kHz, ADC_MOD_CLK shows as 1024kHz and ADC_FS of 8kHz; < This works perfectly fine but low quality

- When using 16-bit 16kHz, ADC_MOD_CLK shows as 2048KHz for ADC_FS of 16KHz; < This sounds like higher quality but suuuuuuper slow audio

Here's the configuration for the 16-bit 16kHz audio (8bit 8kHz is pretty much the same except for the registers indicated above):


PAGE0:
Register 000: 000 (0x00 --> 0000 0000)
Register 001: 000 (0x00 --> 0000 0000)
Register 002: 096 (0x60 --> 0110 0000)
Register 003: 000 (0x00 --> 0000 0000)
Register 004: 003 (0x03 --> 0000 0011)
Register 005: 163 (0xA3 --> 1010 0011)
Register 006: 040 (0x28 --> 0010 1000)
Register 007: 000 (0x00 --> 0000 0000)
Register 008: 000 (0x00 --> 0000 0000)
Register 009: 000 (0x00 --> 0000 0000)
Register 010: 000 (0x00 --> 0000 0000)
Register 011: 143 (0x8F --> 1000 1111)
Register 012: 134 (0x86 --> 1000 0110)
Register 013: 000 (0x00 --> 0000 0000)
Register 014: 128 (0x80 --> 1000 0000)
Register 015: 002 (0x02 --> 0000 0010)
Register 016: 000 (0x00 --> 0000 0000)
Register 017: 008 (0x08 --> 0000 1000)
Register 018: 143 (0x8F --> 1000 1111)
Register 019: 134 (0x86 --> 1000 0110)
Register 020: 128 (0x80 --> 1000 0000)
Register 021: 001 (0x01 --> 0000 0001)
Register 022: 000 (0x00 --> 0000 0000)
Register 023: 004 (0x04 --> 0000 0100)
Register 024: 000 (0x00 --> 0000 0000)
Register 025: 000 (0x00 --> 0000 0000)
Register 026: 001 (0x01 --> 0000 0001)
Register 027: 132 (0x84 --> 1000 0100)
Register 028: 000 (0x00 --> 0000 0000)
Register 029: 000 (0x00 --> 0000 0000)
Register 030: 001 (0x01 --> 0000 0001)
Register 031: 000 (0x00 --> 0000 0000)
Register 032: 000 (0x00 --> 0000 0000)
Register 033: 000 (0x00 --> 0000 0000)
Register 034: 000 (0x00 --> 0000 0000)
Register 035: 000 (0x00 --> 0000 0000)
Register 036: 196 (0xC4 --> 1100 0100)
Register 037: 102 (0x66 --> 0110 0110)
Register 038: 000 (0x00 --> 0000 0000)
Register 039: 000 (0x00 --> 0000 0000)
Register 040: 000 (0x00 --> 0000 0000)
Register 041: 000 (0x00 --> 0000 0000)
Register 042: 014 (0x0E --> 0000 1110)
Register 043: 000 (0x00 --> 0000 0000)
Register 044: 000 (0x00 --> 0000 0000)
Register 045: 000 (0x00 --> 0000 0000)
Register 046: 000 (0x00 --> 0000 0000)
Register 047: 000 (0x00 --> 0000 0000)
Register 048: 000 (0x00 --> 0000 0000)
Register 049: 000 (0x00 --> 0000 0000)
Register 050: 000 (0x00 --> 0000 0000)
Register 051: 000 (0x00 --> 0000 0000)
Register 052: 000 (0x00 --> 0000 0000)
Register 053: 018 (0x12 --> 0001 0010)
Register 054: 002 (0x02 --> 0000 0010)
Register 055: 014 (0x0E --> 0000 1110)
Register 056: 002 (0x02 --> 0000 0010)
Register 057: 000 (0x00 --> 0000 0000)
Register 058: 000 (0x00 --> 0000 0000)
Register 059: 000 (0x00 --> 0000 0000)
Register 060: 001 (0x01 --> 0000 0001)
Register 061: 007 (0x07 --> 0000 0111)
Register 062: 000 (0x00 --> 0000 0000)
Register 063: 020 (0x14 --> 0001 0100)
Register 064: 012 (0x0C --> 0000 1100)
Register 065: 000 (0x00 --> 0000 0000)
Register 066: 000 (0x00 --> 0000 0000)
Register 067: 000 (0x00 --> 0000 0000)
Register 068: 111 (0x6F --> 0110 1111)
Register 069: 056 (0x38 --> 0011 1000)
Register 070: 000 (0x00 --> 0000 0000)
Register 071: 000 (0x00 --> 0000 0000)
Register 072: 000 (0x00 --> 0000 0000)
Register 073: 000 (0x00 --> 0000 0000)
Register 074: 000 (0x00 --> 0000 0000)
Register 075: 238 (0xEE --> 1110 1110)
Register 076: 016 (0x10 --> 0001 0000)
Register 077: 216 (0xD8 --> 1101 1000)
Register 078: 126 (0x7E --> 0111 1110)
Register 079: 227 (0xE3 --> 1110 0011)
Register 080: 000 (0x00 --> 0000 0000)
Register 081: 232 (0xE8 --> 1110 1000)
Register 082: 000 (0x00 --> 0000 0000)
Register 083: 030 (0x1E --> 0001 1110)
Register 084: 030 (0x1E --> 0001 1110)
Register 085: 000 (0x00 --> 0000 0000)
Register 086: 064 (0x40 --> 0100 0000)
Register 087: 192 (0xC0 --> 1100 0000)
Register 088: 038 (0x26 --> 0010 0110)
Register 089: 000 (0x00 --> 0000 0000)
Register 090: 016 (0x10 --> 0001 0000)
Register 091: 000 (0x00 --> 0000 0000)
Register 092: 000 (0x00 --> 0000 0000)
Register 093: 000 (0x00 --> 0000 0000)
Register 094: 000 (0x00 --> 0000 0000)
Register 095: 000 (0x00 --> 0000 0000)
Register 096: 127 (0x7F --> 0111 1111)

** Past register 127, all values are 0.

PAGE 1:
Register 000: 001 (0x01 --> 0000 0001)
Register 001: 000 (0x00 --> 0000 0000)
Register 002: 000 (0x00 --> 0000 0000)
Register 003: 000 (0x00 --> 0000 0000)
Register 004: 000 (0x00 --> 0000 0000)
Register 005: 000 (0x00 --> 0000 0000)
Register 006: 000 (0x00 --> 0000 0000)
Register 007: 000 (0x00 --> 0000 0000)
Register 008: 000 (0x00 --> 0000 0000)
Register 009: 060 (0x3C --> 0011 1100)
Register 010: 000 (0x00 --> 0000 0000)
Register 011: 016 (0x10 --> 0001 0000)
Register 012: 008 (0x08 --> 0000 1000)
Register 013: 008 (0x08 --> 0000 1000)
Register 014: 000 (0x00 --> 0000 0000)
Register 015: 000 (0x00 --> 0000 0000)
Register 016: 006 (0x06 --> 0000 0110)
Register 017: 006 (0x06 --> 0000 0110)
Register 018: 064 (0x40 --> 0100 0000)
Register 019: 064 (0x40 --> 0100 0000)
Register 020: 000 (0x00 --> 0000 0000)
Register 021: 000 (0x00 --> 0000 0000)
Register 022: 000 (0x00 --> 0000 0000)
Register 023: 000 (0x00 --> 0000 0000)
Register 024: 000 (0x00 --> 0000 0000)
Register 025: 000 (0x00 --> 0000 0000)
Register 026: 000 (0x00 --> 0000 0000)
Register 027: 000 (0x00 --> 0000 0000)
Register 028: 000 (0x00 --> 0000 0000)
Register 029: 000 (0x00 --> 0000 0000)
Register 030: 000 (0x00 --> 0000 0000)
Register 031: 000 (0x00 --> 0000 0000)
Register 032: 000 (0x00 --> 0000 0000)
Register 033: 000 (0x00 --> 0000 0000)
Register 034: 000 (0x00 --> 0000 0000)
Register 035: 000 (0x00 --> 0000 0000)
Register 036: 000 (0x00 --> 0000 0000)
Register 037: 000 (0x00 --> 0000 0000)
Register 038: 000 (0x00 --> 0000 0000)
Register 039: 000 (0x00 --> 0000 0000)
Register 040: 000 (0x00 --> 0000 0000)
Register 041: 000 (0x00 --> 0000 0000)
Register 042: 000 (0x00 --> 0000 0000)
Register 043: 000 (0x00 --> 0000 0000)
Register 044: 000 (0x00 --> 0000 0000)
Register 045: 000 (0x00 --> 0000 0000)
Register 046: 000 (0x00 --> 0000 0000)
Register 047: 000 (0x00 --> 0000 0000)
Register 048: 000 (0x00 --> 0000 0000)
Register 049: 000 (0x00 --> 0000 0000)
Register 050: 000 (0x00 --> 0000 0000)
Register 051: 104 (0x68 --> 0110 1000)
Register 052: 064 (0x40 --> 0100 0000)
Register 053: 000 (0x00 --> 0000 0000)
Register 054: 064 (0x40 --> 0100 0000)
Register 055: 000 (0x00 --> 0000 0000)
Register 056: 000 (0x00 --> 0000 0000)
Register 057: 000 (0x00 --> 0000 0000)
Register 058: 000 (0x00 --> 0000 0000)
Register 059: 040 (0x28 --> 0010 1000)
Register 060: 040 (0x28 --> 0010 1000)
Register 061: 000 (0x00 --> 0000 0000)
Register 062: 000 (0x00 --> 0000 0000)
Register 063: 192 (0xC0 --> 1100 0000)

**Past register 64, all values are 0.

Thanks!

Ben

[EDIT] Is is possible that if I leave the WCLK as 8kHz but increase the BLCK to 256kHz, I will have 16-bits of data?

  • Hi Ben,

    I believe you're missing a factor of two. 128kHz / 8kHz = 16 = 2 channels of 8 bits. 256kHz / 16kHz = 16 = 2 channels of 8 bits or 1 channel of 16. So you're missing the right amount of BCLK per sample. You would need 16kHz * 2 channels * 16bits per channel = 512kHz. 

    The audio sounding slow is probably not the codec. That tends to happen when the data gets played back at a slower rate then the data rate of the audio itself, giving the illusion of the audio sounding super slow and stretched out like a time machine.

    Try adjusting the clocks and double checking the recording rate on your host/PC as I mentioned above and let me know what happens.

    Best regards,
    Jeff McPherson

  • Hi Jeff,

    I want to try a different approach and I want to start-off by testing something with the TLV320AIC3204EVM-K development board. I've had two of them kicking around for a long time. For some reason, neither of them are detected by Windows 11 in a sense that in Device Manager, they appear as "Unknown USB Device (Device Descriptor Request Failed)". Is there a particular driver for these for Windows 11? The AIC3204 software does not detect them of course since the driver is not installed and I have to run the AIC3204 software in Windows 7 compatibility mode. So what am I missing here to get either of these to run under Windows 11? I've used them in the past on Windows 7 but this is not an option anymore.

    Also, how can I route the PDM microphone's audio to HPL output pin 25 to listen with a headset? I guess I need to somehow route it through the DAC first? I will be going through the docs but really, if I can have the PDM microphone's output routed to HPL and LOL in maximum quality, then that will give me something to work with because I may use a different approach for the transmission of the audio in order to keep it at max quality.

    Thanks.

    Benoit

    [EDIT] I hear my audio over IP at 8-bit 8kHz on my PC application as it should but I also have a headset connected to HPL out pin 25 directly and all I hear is loud whitenoise but I cannot manage to figure-out how to route the DIN pin 4 audio out on HPL.... Any idea? Thanks again!

  • Hi Ben,

    Sounds like you're using an EVM with the USBMOD-EVM motherboard correct? The driver should automatically install itself, but it's not uncommon to see the firmware on that USB controller die. Exactly why it was discontinued and newer versions of this EVM use the AC-MODEVM motherboard instead. There are some instructions here you can use to try to revive it.

    https://e2e.ti.com/support/audio-group/audio/f/audio-forum/773576/faq-tlv320aic-codecs-and-adcs-how-to-restart-revive-a-usb-audio-evm

    Bit 4 in Register 29 will let you route the ADC output into the DAC input internally, letting you play the PDM mics over HPL. Of course you'll need to complete the DAC routing but that's relatively straightforward from the application reference guide. This loopback bit is buried in the back and is harder to find if you don't know it's there.

    Best regards,
    Jeff McPherson

  • Ah! It works! And the worst in this is that I had my slaa557 Application Reference opened on register 30 when I left yesterday! I missed that bit 4 in register 29!

    Cool, so it works now!

    For the EVM, I'll keep your link but now that it works on my circuit, I may simply proceed with that. I will now change the audio from 8-bit 8kHz to whatever the max I can get out of a 3.072MHz. I'll play around with the (offline) AIC3204 app to make the proper calculations.

    Thank you so much for all your help!

    Ben

    [EDIT] I guess one last question then... sorry! So if I have a 3.072MHz MCLK and have PDM routed to HPL out, what would be the ultimate/optimal settings to have the highest quality possible on the HPL side? I don't really care about how much power it consumes, all I want is the maximum quality possible. I will play with the settings to try different scenarios in the meantime.

    Right now, here are my settings:

    MCLK: 3.072MHZ -> Goes into the PLL;
    R=4, J=15, D=0 and P=1 -> This returns a 183.32MHz CODEC_CLKIN;
    NDAC / NADC -> 10
    MDAC / MADC -> 3
    DOSR / AOSR -> 128

    These settings yield the following:
    DAC_CLK / ADC_CLK of 18.432MHz
    DAC_MOD_CLK / ADC_MOD_CLK of 6.144MHz
    DAC_FS / ADC_FS of 48KHz.

    Do these settings seem right to you or is there anything better I should tweak?

    Thanks again!

    Ben

    [EDIT 2] I am this close at getting very high quality audio but there seems to be some sort of hiss in my audio, like if say words with the letter 's' like "tessssst tessssst", it seems to hiss a the prononciation of the 's'... And the background noise is also hissing just slightly rather than sounding 'echo-y'. If I play a 1kHz tone next to my mic, it sounds like if there was an artifact in it.... so I think I'm really close to having what I need, maybe it's just my calculations for the frequency. Any idea?

    [EDIT 3] Using SLAA557 document, I think one of the problems is that I missed part of the parameters to set CODEC_CLKIN with the PLL and I was setting it at 183.32MHz but that's above the max when I look at table 2-26 (page 77) since I have AVdd at 1.8V and I have to set P0_R4_D6 to 0 therefore I must stay between 80MHz and 132MHz...

    Then on Table 2-27. PLL Example Configurations it shows how to configure my registers for 48kHz using a 3.072MHz MCLK which is what I have. This gives me a CODEC_CLKIN of 86.016MHz which makes me fall within the Min PLL_CLK and Max PLL_CLK from Table 2-26.

    Now I guess what I need to figure-out is if there's a way to get rid of the loud hiss from the background.

    What is the difference between setting P0_R20 (AOSR) to either 128 or 64 other than to reduce the volume? If I set it to 128, then P0_R65 I can't set it too high because then it's extremely loud. But if I set P0_R20 to 64 and P0_R65 to 48, then it gives about the same result of super loud audio. I'm sure the loud hissing from the background is probably caused by some of my settings. But my words with 's' don't appear to hiss much anymore however, if it's too loud, then it sounds like clipping.

    Sorry for all the questions, there's just so much in there and it's a bit overwhelming.

    Anyhow, any suggestions you may have, please let me know.

    Have a great week-end!

    Ben