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.

TLV320AIC3105: TLV320AIC3105 MIC issue

Part Number: TLV320AIC3105

Hi,

We have an tlv320aic3105 audio cape and have BeagleBone Green as host, mcasp0 is configured for i2S. Playback is working, but Capture doesn't save any voice data. I run the command

arecord -vv -f dat /dev/null

and get the error message

arecord: pcm_read:2031: read error: Input/output error

(the screenshot is attached below)

In this test, LINE1L is used fro MIC input.

To support tlv320aic3105 audio codec, I change and build device tree am335x-bonegreen.dtb with ti-processor-sdk-linux-am335x-evm-03.02.00.05, CODEC driver is tlv320aic3x. 

I don't know what is the cause of this error, Below are some questions I can think of:

  1. Does tlv320aic3x fully support tlv320aic3105 or need some changes?
  2. Is audio-routing wrong? Below is audio-routing for MIC:

ti,audio-routing =

                        "Headphone Jack",     "HPLOUT",

                        "Headphone Jack",       "HPROUT",

                        "LINE1L",        "Line In";

3. Any other cause?

Thanks for your help,

Bruce

/////////////////////////////////////////////

root@beaglebone:~# arecord -vv -f dat /dev/null

Recording WAVE '/dev/null' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo

Plug PCM: Hardware PCM card 0 'DA830 EVM' device 0 subdevice 0

Its setup is:

  stream       : CAPTURE

  access       : RW_INTERLEAVED

  format       : S16_LE

  subformat    : STD

  channels     : 2

  rate         : 48000

  exact rate   : 48000 (48000/1)

  msbits       : 16

  buffer_size  : 24000

  period_size  : 6000

  period_time  : 125000

  tstamp_mode  : NONE

  period_step  : 1

  avail_min    : 6000

  period_event : 0

  start_threshold  : 1

  stop_threshold   : 24000

  silence_threshold: 0

  silence_size : 0

  boundary     : 1572864000

  appl_ptr     : 0

  hw_ptr       : 0

arecord: pcm_read:2031: read error: Input/output error

//////////////////////////////////////////////////////////////////////

  • Hi, Bruce,

    Unfortunately, we don't support this kind of commands or beaglebone drivers. However, is it possible to provide a register map of the audio codec? This will be really useful to understand the root cause. Any schematic or additional information will be also useful.

    Thank you.

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

    Thanks for your quick response.

    I don’t directly configure the codec registers; instead, I use alsamixer to configure audio device. Here is the register map from the driver file tlv320aic3x.c, I believe that kernel uses this map as default configuration.

    static const struct reg_default aic3x_reg[] = {

            {   0, 0x00 }, {   1, 0x00 }, {   2, 0x00 }, {   3, 0x10 },

            {   4, 0x04 }, {   5, 0x00 }, {   6, 0x00 }, {   7, 0x00 },

            {   8, 0x00 }, {   9, 0x00 }, {  10, 0x00 }, {  11, 0x01 },

            {  12, 0x00 }, {  13, 0x00 }, {  14, 0x00 }, {  15, 0x80 },

            {  16, 0x80 }, {  17, 0xff }, {  18, 0xff }, {  19, 0x78 },

            {  20, 0x78 }, {  21, 0x78 }, {  22, 0x78 }, {  23, 0x78 },

            {  24, 0x78 }, {  25, 0x00 }, {  26, 0x00 }, {  27, 0xfe },

            {  28, 0x00 }, {  29, 0x00 }, {  30, 0xfe }, {  31, 0x00 },

            {  32, 0x18 }, {  33, 0x18 }, {  34, 0x00 }, {  35, 0x00 },

            {  36, 0x00 }, {  37, 0x00 }, {  38, 0x00 }, {  39, 0x00 },

            {  40, 0x00 }, {  41, 0x00 }, {  42, 0x00 }, {  43, 0x80 },

            {  44, 0x80 }, {  45, 0x00 }, {  46, 0x00 }, {  47, 0x00 },

            {  48, 0x00 }, {  49, 0x00 }, {  50, 0x00 }, {  51, 0x04 },

            {  52, 0x00 }, {  53, 0x00 }, {  54, 0x00 }, {  55, 0x00 },

            {  56, 0x00 }, {  57, 0x00 }, {  58, 0x04 }, {  59, 0x00 },

            {  60, 0x00 }, {  61, 0x00 }, {  62, 0x00 }, {  63, 0x00 },

            {  64, 0x00 }, {  65, 0x04 }, {  66, 0x00 }, {  67, 0x00 },

            {  68, 0x00 }, {  69, 0x00 }, {  70, 0x00 }, {  71, 0x00 },

            {  72, 0x04 }, {  73, 0x00 }, {  74, 0x00 }, {  75, 0x00 },

            {  76, 0x00 }, {  77, 0x00 }, {  78, 0x00 }, {  79, 0x00 },

            {  80, 0x00 }, {  81, 0x00 }, {  82, 0x00 }, {  83, 0x00 },

            {  84, 0x00 }, {  85, 0x00 }, {  86, 0x00 }, {  87, 0x00 },

            {  88, 0x00 }, {  89, 0x00 }, {  90, 0x00 }, {  91, 0x00 },

            {  92, 0x00 }, {  93, 0x00 }, {  94, 0x00 }, {  95, 0x00 },

            {  96, 0x00 }, {  97, 0x00 }, {  98, 0x00 }, {  99, 0x00 },

            { 100, 0x00 }, { 101, 0x00 }, { 102, 0x02 }, { 103, 0x00 },

            { 104, 0x00 }, { 105, 0x00 }, { 106, 0x00 }, { 107, 0x00 },

            { 108, 0x00 }, { 109, 0x00 },

    };

    I am not sure if the driver tlv320aic3x.c fully supports tlv320aic3105, for instance, support recording.

     

    Regards,

    Bruce

  • Hi, Bruce,

    The registers configuration that you shared is the default state of the TLV320AIC3105. This means that the audio codec is not being configured.

    In order to enable the recording function, you need at least to configure page 0 / registers 15 - 25. Registers 17-24 are configured to select the analog input where the sound will be recorded. Registers 15-16 are used to configure the PGA. Registers 19, 22 are used to enable the ADC. And register 25 is used to configure the MICBIAS (if it is required).

    Please configure all these registers according to your needs and let me know if you require additional assistance.

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

     

    In our application, MIC1L/LINE1L is the input connected to left PGA and left ADC, the register 15 and register 19 of the page 0 need to be configured. When the codec tlv320aic3105 is brought up, these two registers are set from TI driver aic3x_init() as following:

    Register

    value

    Page 0/register 15

    0x20

    Page 0/register 19

    0x0

     

    After the codec is up running, I run alsamixer to configure PGA Capture, below is the copy of ADC config changes:

            control.44 {

                    iface MIXER

                    name 'PGA Capture Volume'

                    value.0 119

                    value.1 119

                    comment {

                            access 'read write'

                            type INTEGER

                            count 2

                            range '0 - 119'

                            dbmin 0

                            dbmax 5950

                            dbvalue.0 5950

                            dbvalue.1 5950

                    }

            }

            control.45 {

                    iface MIXER

                    name 'PGA Capture Switch'

                    value.0 true

                    value.1 true

                    comment {

                            access 'read write'

                            type BOOLEAN

                            count 2

                    }

            }

    However, when I run the capture, I see the error

    arecord: pcm_read:2031: read error: Input/output error

    I don't know what causes this error.

    I also compare tlv320aic3105 register map, the register 73-79 of page 0 in tlv320aic3105 are reserved,  not sure if writing the values to these registers has any impact, which is done in aic3x_init().

    Best regards,

    Bruce

  • Hi, Bruce,

    Could you verify if there's any data at DOUT pin when the configuration is completed? Additionally, it seems that the ADC is disabled. Page 0 / Register 19 / Bit D2 needs to be configured as '1' to enable the ADC. So, the correct register value would be 0x04.

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

    We see the data at DOUT pin when we run the capture and get the error. It makes me confused: how does the ADC have output data if the ADC is disabled?

    Best regards,
    Bruce
  • Hi, Bruce,

    There are two registers that enable the ADC:

    - Page 0 / Register 19. Bit D2 configures the left ADC.
    - Page 0 / Register 22. Bit D2 configures the right ADC.

    Probably only one of these registers is being configured. So, you would need to configure both registers to fully enable the ADC channels.

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

    Thanks for your help, I will try.

    Best regards,

    Bruce

  • Hi Luis,

    Tlv320aic3105 capture is still not working, it hangs when running capturing. We checked that Page 0/ Register 19 and Register 22, Bit D2 is 1 when doing recording, the values of Page 0 /Register 15 and 16 are 0x77.

    We made some changes on da830_evm_dai  and evm_dai_tlv320aic3x  in davinci-evm.c,

    1. change .cpu_dai_name and .platform_name from "davinci-mcasp.1" to  "davinci-mcasp.0" to support both playback and capture;
    2. change .dai_fmt to I2S.

    tlv320aic3105 provides bit clock and frame clock.

    Below are changes:

    static struct snd_soc_dai_link da830_evm_dai = {

            .name = "TLV320AIC3X",

            .stream_name = "AIC3X",

            .cpu_dai_name = "davinci-mcasp.0",

            .codec_dai_name = "tlv320aic3x-hifi",

            .codec_name = "tlv320aic3x-codec.1-0018",

            .platform_name = "davinci-mcasp.0",

            .init = evm_aic3x_init,

            .ops = &evm_ops,

            .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM |

                       SND_SOC_DAIFMT_NB_NF,

    };

    ……

    static struct snd_soc_dai_link evm_dai_tlv320aic3x = {

            .name           = "TLV320AIC3X",

            .stream_name    = "AIC3X",

            .codec_dai_name = "tlv320aic3x-hifi",

            .ops            = &evm_ops,

            .init           = evm_aic3x_init,

            .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM |

                       SND_SOC_DAIFMT_NB_NF,

    };

    I am not sure if these changes are correct or I need to make some other changes as well.

     

    Best regards,

    Bruce

  • Hi, Bruce,

    Do you have the modified registers configuration? I mean, do the registers change with these changes on your code. I apologize, we don't support this kind of drivers.

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

    I managed to get the tlv320aic3105 capture up running, but it captures the noise. The codec configuration is:

    1. Codec is configured as slave, which the host provides bit clock and frame clock;
    2. TX and RX work on synchronous mode, which host provide only TX bit clock and frame clock to tlv320aic3105;
    3. MiC1L/LINE1L is selected as audio input.

    Register dump of tlv320aic3105 is as following:

    root@arm:~# i2cdump -f -y 2 0x18
    No size specified (using byte-data access)
          0       1       2       3       4       5       6       7       8       9       a       b       c       d       e       f
    00: 00     00     aa     20     04     00     00     0a     00     00     00     41     00     00     00    5b
    10: 5b     ff       ff       04     78     78     04     78     78     06     00     fe      00     00     fe     00
    20: 00     00     00     00     cc     00     00     00     00     00     00     80     80     2f      2f     af 
    30: 00     00     00     0c     2f      2f      af      00     00     00     0c     00     00     00     2f     2f
    40: af      0c     00     00     00     2f      2f      af      0c     2f      2f      af      2f      2f      af     08 
    50: 2f      2f      af      00     00     00     08     00     00    00      2f      2f      af     08     00     00
    60: 00     00     00     00     00     01     02     00     00    00      00     00     00    00     00   00 
    70: 00     00     00     00     00     00     00     00     00    00      00     00     00    00     00   00
    80: 00     00     aa     20     04     00     00     0a     00    00      00     01     00    00     00   5b
    90: 5b     ff       ff       04     78     78     04     78     78    06      00     fe      00    00     fe    00
    a0: 00     00     00     00     cc     00     00     00     00    00      00     80     80    2f      2f     af 
    b0: 00     00     00     0c     2f      2f      af      00     00    00      0c     00     00    00     2f     2f 
    c0: af      0c     00     00     00     2f      2f      af      0c    2f       2f      af      2f     2f      af     08
    d0: 2f      2f      af     00      00    00     08     00      00   00      2f      2f      af     08     00    00
    e0: 00     00     00    00      00    01     02     00      00   00      00     00     00    00     00    00
    f0:  00     00     00    00      00    00     00     00      00   00      00     00     00    00     00    00

    Please help me understand the issue.

    Thanks,

    Bruce

  • Hi Bruce,

    i'm using TLV320AIC3105 on my iMX6 board, i use codec driver tlv320aic3x.c and machine driver imx-tlv320aic3x.c.

    when kernel running, it shows:

    imx-tlv320aic3x sound: tlv320aic3x-hifi <-> 202c000.ssi mapping ok

    ....

    ALSA device list:
     #0: tlv320-audio

    and I2C communication is working well (i can read/write registrer of codec ic)

    but when i play music, i don't see BCLK, WCLK, I2S data out (TXD), only have MCLK (24MHz) and of cause, no sound! 

    i spend one week to find what is problem but not success!

    Can you share me your codec driver and machine driver?

    Many thanks!

    BR/Hai

  • Hi Hai,

    TI audio codec driver tlv320aic3x works for tlv320aic3105 if you run playback.

    Regards,

    Bruce

  • Hi Bruce,

    i see there are two drivers: tlv320aic3x.c (Author: Vladimir Barinov) and tlv320aic31xx.c (Author: Jyri Sarha <jsarha@ti.com>)

    i use tlv320aic3x.c but not success, which driver did you use?

    Please help me, now i'm really stuck!

    Thanks!

    Regards,

    Hai 

  • I use tlv320aic3x.c.  

  • Hi Bruce,

    i can make clock out on SSI WCLK, BCLK and Data out line. But i measure on RIGHT_LOM, RIGHT_LOP, LEFT_LOM, LEFT_LOP, HPLOUT, HPROUT... of TLV320AIC3105 ic, no anyone has data clock out, and no sound!

    in device tree, i use audio-routing:

    "Ext Spk", "LLOUT",

    "Ext Spk", "RLOUT",

    "Line Out Jack", "LLOUT",

    "Line Out Jack", "RLOUT",

    "Headphone Jack", "HPLOUT",

    "Headphone Jack", "HPROUT";

    Can you share me audio-routing in your device tree?

    Thanks!

    Regards/Hai

  • Hi Hai,

    Here is device tree I used

    "Headphone Jack", "HPLOUT",
    "Headphone Jack", "HPROUT",
    "LINE1L", "Line In",
    "LINE1R", "Line In";

    Regards,

    Bruce

  • Hi Hai,

    Did you capture the sound from TLV320aic3105 MIC? Do you use RX clock or share TX clock? Is tlv320aicaic3105 master mode or slave mode? Which port do you use, MIC1L/Line1L or other port?

    Best regards.

    Bruce

      

  • Hi Bruce,

    i can capture from TLV320AIC3105 using MIC1L/LINE2L/LINE2R input, the quality of record sound is acceptable, not much noise.

    I'm using external MCLK from master MCU,  TLV is in slave mode.

    My diagram:

    Master MCU  ----- TLV codec

    CLK_OUT (24MHz) --> MCLK

    AUD3_TXD     -    I2S_DIN

    AUD3_RXD    -    I2S_DOUT

    AUD3_TXFS  -    I2S_WCLK

    AUD3_TXC    -    I2S_BLCK

    Regards,

    Hai