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.

Linux/PROCESSOR-SDK-AM335X: Codec integration

Part Number: PROCESSOR-SDK-AM335X
Other Parts Discussed in Thread: TLV320AIC3106, TLV320AIC3105

Tool/software: Linux

Dear TI E2E Community,

Hope TLV320AIC3106 has been interfaced to one of your AM335X starter kit

0. Is it possible to verify i2c read/writes using linux i2c-tools to TLV320AIC3106

1. Could you please share the logs of the i2cdetect,  i2cset, i2cget,  and i2cdump by verifying TLV320AIC3106 has been interfaced to one of your AM335X starter kit, so that it will be useful for me to do my initial bringup with i2c using TLV320AIC3105 with my custom processor

I  am using TLV320AIC3105 to be interfaced to my custom processor, where my custom processor's Linux BSP's is running on it. and unable to get as a first step i2c working as posted in

e2e.ti.com/.../2547666

2. As part of the first stage bringup can the I2c read/write can be verified with just only the reset and i2c_scl and i2c SDA using i2c tools -  ie., i2cdetect, i2cset, i2cget, i2cdump without connecting MCLK, BCLK, LRCLK, and DATA_IN and DATA_out from processor to TLV320AIC3105?

3. Is that the codec reset signal is required to be interfaced to the processor to get TLV320AIC3105 detected using i2c tools ie., using i2c detect?

4. 3. Is that TLV320AIC3105 always acts as slave?? ie., MCLK needs to be provided by the processor to the Codec or is there any chances that Codec can also act as a master ie., can the codec also generate mclk to the processor?

5. Could you please let me know what could be the reason that I am seeing the following issues w.r.t tlv320aic3105

root@imx6ull14x14evk:/# aplay -Dplughw:0,0 a2002011001-e02-8kHz.wav
Playing WAVE 'a2002011001-e02-8kHz.wav' : Signed 16 bit Little Entlv320aic3x-codec 1-0018: Unable to sync registers 0x1-0x2. -11 -------------------> ISSUE NO. 1
dian, Rate 8000 Hz, Stereo
aplay: pcm_write:2023: write error: Input/output error

 

root@imx6ull14x14evk:/# amixer
amixer: Mixer default load error: No such device or address --------------------------------------------------------------> ISSUE NO. 3
root@imx6ull14x14evk:/#
root@imx6ull14x14evk:/# i2cget -f -y 1 0x18 0x5 --------------------------------------------------------------> ISSUE NO. 4
Error: Read failed
 
root@imx6ull14x14evk:/# cat /proc/asound/cards
 0 [imxtlv320      ]: imx-tlv320 - imx-tlv320
                      imx-tlv320
root@imx6ull14x14evk:/# cat /proc/asound/devices
  0: [ 0]   : control
 16: [ 0- 0]: digital audio playback                    
 24: [ 0- 0]: digital audio capture                     
 33:        : timer                                    
root@imx6ull14x14evk:/# cat /proc/asound/card0/id       
imxtlv320                                               
root@imx6ull14x14evk:/#
root@imx6ull14x14evk:/# i2cdump -f -y 1 0x18 --------------------------------------------------------------> ISSUE NO. 5
No size specified (using byte-data access)
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
10: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
20: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
30: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
40: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
50: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
60: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
70: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
80: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
90: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
a0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
b0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
c0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
d0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
e0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
f0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
root@imx6ull14x14evk:/#

kindly do the needful as early as possible

Eagerly awaiting for your replies

Many Thanks in advance

  • You are asking for support of a third-party processor. Please direct your questions to the device/BSP manufacturer. This forum supports only the Sitara processor family.
  • Srini,

    As Biser explained, Sitara forum supports TI Sitara processors (AM3x, AM4x, AM5x). If you have questions related to Sitara AM335x device, please let me know.

    If you have specific questions regarding TI TLV320AIC3105 audio codec, you should ask/post in the below forum:

    e2e.ti.com/.../64

    Regards,
    Pavel

  • Dear Biser and Pavel,

    Thanks for your quick responses,

    I hope the below portion of the questions are related to AM335X starter kit and TLV320AIC3106

    Hope TLV320AIC3106 has been interfaced to one of your AM335X starter kit

    0. Is it possible to verify i2c read/writes using linux i2c-tools to TLV320AIC3106 with AM335X starter kit , could you pls verify with any of your linux processor's SDK's and confirm that whether does  TLV320AIC3106 gets detected in U-boot using i2c commands?

    1. Could you please share the logs of the i2cdetect,  i2cset, i2cget,  and i2cdump by verifying TLV320AIC3106 has been interfaced to one of your AM335X starter kit, so that it will be useful for me to do my initial bringup with i2c using TLV320AIC3105 with my custom processor?

    Kindly do the needful as early as possible

    Many thanks in advance

  • Dear Pavel,

    Can you please try with your AM335X starter kit and tLV320AIC3106 and share me the above data, as that  would be useful for my debugging and and help me in choosing hte tlv codec for interfacing with my custom hardware

    Also could you please let me know, whether tlv320aic3106 is configured as slave with Am335x or Am335x is configured as slave with TLV320aic3106?

    Kindly do the needful as early as possible

    Eagerly awaiting for your replies

    Many Thanks in advance

  • Srini,

    Srini said:
    Hope TLV320AIC3106 has been interfaced to one of your AM335X starter kit

    Yes, it has been.

    Srini said:
    0. Is it possible to verify i2c read/writes using linux i2c-tools to TLV320AIC3106 with AM335X starter kit , could you pls verify with any of your linux processor's SDK's and confirm that whether does  TLV320AIC3106 gets detected in U-boot using i2c commands?

    Yes, AIC3106 is detected in u-boot. I am using PSDK v4.01, see the below log:

    U-Boot SPL 2017.01-g590c7d7fe1 (Sep 26 2017 - 18:28:01)
    Trying to boot from MMC1
    reading uboot.env

    ** Unable to read "uboot.env" from mmc0:1 **
    Using default environment

    reading u-boot.img
    reading u-boot.img
    reading u-boot.img
    reading u-boot.img


    U-Boot 2017.01-g590c7d7fe1 (Sep 26 2017 - 18:28:01 -0400)

    CPU  : AM335X-GP rev 2.1
    Model: TI AM335x EVM-SK
    DRAM:  256 MiB
    NAND:  0 MiB
    MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
    reading uboot.env

    ** Unable to read "uboot.env" from mmc0:1 **
    Using default environment

    <ethaddr> not set. Validating first E-fuse MAC
    Net:   cpsw, usb_ether
    Hit any key to stop autoboot:  0
    => i2c bus
    Bus 0:    i2c@44e0b000
    => i2c probe
    No I2C bus selected
    => i2c dev 0
    Setting bus to 0
    => i2c bus  
    Bus 0:    i2c@44e0b000  (active 0)
    => i2c probe
    Valid chip addresses: 18 1B 2D 50
    => i2c speed
    Current bus speed=400000
    => i2c md 0x1B 0.2 5
    0000: 00 10 04 00 00    .....
    => i2c md 0x1B 0.2 0x10
    0000: 00 10 04 00 00 00 00 00 00 01 00 00 00 80 80 ff    ................
    =>

    AIC3106 is attached to I2C0/0x44E0B000 controller at addr 0x1B. You can check this in u-boot/arch/arm/dts/am335x-evmsk.dts

    Srini said:
    1. Could you please share the logs of the i2cdetect,  i2cset, i2cget,  and i2cdump by verifying TLV320AIC3106 has been interfaced to one of your AM335X starter kit, so that it will be useful for me to do my initial bringup with i2c using TLV320AIC3105 with my custom processor?

    These i2c commands (i2cdetect, i2cset, i2cget, i2cdump) are available at user space level, not at u-boot. In u-boot we have the below i2c commands:

    => i2c help
    i2c - I2C sub-system

    Usage:
    i2c bus [muxtype:muxaddr:muxchannel] - show I2C bus info
    crc32 chip address[.0, .1, .2] count - compute CRC32 checksum
    i2c dev [dev] - show or set current I2C bus
    i2c loop chip address[.0, .1, .2] [# of objects] - looping read of device
    i2c md chip address[.0, .1, .2] [# of objects] - read from I2C device
    i2c mm chip address[.0, .1, .2] - write to I2C device (auto-incrementing)
    i2c mw chip address[.0, .1, .2] value [count] - write to I2C device (fill)
    i2c nm chip address[.0, .1, .2] - write to I2C device (constant address)
    i2c probe [address] - test for and show device(s) on the I2C bus
    i2c read chip address[.0, .1, .2] length memaddress - read to memory
    i2c write memaddress chip address[.0, .1, .2] length [-s] - write memory
              to I2C; the -s option selects bulk write in a single transaction
    i2c flags chip [flags] - set or get chip flags
    i2c olen chip [offset_length] - set or get chip offset length
    i2c reset - re-init the I2C Controller
    i2c speed [speed] - show or set I2C bus speed

    Regarding user space i2c commands, refer to the below log:

     

    root@am335x-evm:~# i2cdetect -y -r 0
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:          -- -- -- -- -- -- -- -- -- -- -- -- --
    10: -- -- -- -- -- -- -- -- 18 -- -- 1b -- -- -- --
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- UU -- --
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    50: 50 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    70: -- -- -- -- -- -- -- --                         
    root@am335x-evm:~# i2cdump -f -y 0 0x1B b
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
    00: 00 00 00 10 04 00 00 00 00 00 00 01 00 00 00 80    ...??......?...?
    10: 80 ff ff 78 78 78 78 78 78 06 00 fe 00 00 fe 00    ?..xxxxxx?.?..?.
    20: 00 00 00 00 02 00 00 00 00 00 00 80 80 00 00 00    ....?......??...
    30: 00 00 00 04 00 00 00 00 00 00 04 00 00 00 00 00    ...?......?.....
    40: 00 04 00 00 00 00 00 00 04 00 00 00 00 00 00 00    .?......?.......
    50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    60: 00 01 00 00 00 c0 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 00 10 04 00 00 00 00 00 00 01 00 00 00 80    ...??......?...?
    90: 80 ff ff 78 78 78 78 78 78 06 00 fe 00 00 fe 00    ?..xxxxxx?.?..?.
    a0: 00 00 00 00 02 00 00 00 00 00 00 80 80 00 00 00    ....?......??...
    b0: 00 00 00 04 00 00 00 00 00 00 04 00 00 00 00 00    ...?......?.....
    c0: 00 04 00 00 00 00 00 00 04 00 00 00 00 00 00 00    .?......?.......
    d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    e0: 00 01 00 00 00 c0 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    ................
    root@am335x-evm:~# i2cget -f -y 0 0x1B 3 b
    0x10
    root@am335x-evm:~# i2cget -f -y 0 0x1B 4 b
    0x04
    root@am335x-evm:~# i2cset -f -y 0 0x1B 3 0x5A b
    root@am335x-evm:~# i2cget -f -y 0 0x1B 3 b
    0x5a

    The commands are provided in the below wiki:

    processors.wiki.ti.com/.../Linux_Core_I2C_User's_Guide

  • Srini said:
    Can you please try with your AM335X starter kit and tLV320AIC3106 and share me the above data, as that  would be useful for my debugging and and help me in choosing hte tlv codec for interfacing with my custom hardware

    Done. Check my previous post.

    Srini said:
    Also could you please let me know, whether tlv320aic3106 is configured as slave with Am335x or Am335x is configured as slave with TLV320aic3106?

    AIC3106 is master, AM335x is slave

    Regards,
    Pavel

  • Is that AIC3106 is always configured as master, can it be configured in slave mode ?, Could you please elaborate is that the codec generates the MCLK, BCLK and LRCLK to the slave (AM335x) does this means that "Codec is the master" and AM335x is the slave??
  • Srini,

    In AM335x SK, AIC3106 is always configured as master, but AIC3106 can be configured as slave in a custom board.

    In AM335x SK, AIC3106 (master) generates BCLK (bit clock) and WCLK (frame sync). While AM335x device (slave) generates MCLK (from pin A15/CLKOUT1, 24MHz).

    I am not aware what is LRCLK (can not find such pin in AIC3106 datasheet).

    master/slave is configured in DTS file:

    simple-audio-card,bitclock-master = <&sound_master>;
    simple-audio-card,frame-master = <&sound_master>;

    sound_master: simple-audio-card,codec {
    sound-dai = <&tlv320aic3106>;
    system-clock-frequency = <24000000>;
    };


    See also below txt file:

    linux-kernel/Documentation/devicetree/bindings/sound/simple-card.txt

    You can check how bitclock-master and frame-master are parsed and handled in the below file:

    linux-kernel/sound/soc/soc-core.c

    Other files related to master/slave config are:

    linux-kernel/sound/soc/davinci/davinci-mcasp.c
    linux-kernel/sound/soc/codecs/tlv320aic3x.c


    To sum up, master/slave configuration is done only in DTS file. Rest of the files (soc-core.c, davinci-mcasp.c, tlv320aic3x.c) should not be modified, you can use these file as a reference, for better understanding.

    Regards,
    Pavel
  • Dear Pavel,

    Thanks a lot for your prompt responses and appreciate the same, Right now I have connected only i2c_scl and i2c sda lines and ground to my custom processor without connecting mclk, lrclk, bclk and i2s_in adn i2s_out

    1. Could you please perform i2c write/read in u-boot and share me the logs with your Am335x and tlv320aic3106?

    2. Any Idea or inputs, why I see the following behaviour?

    In u-boot, I see the following w.r.t TLV320AIC3105

    => i2c dev 1

    Setting bus to 1

    => i2c md 0x18 0.2 0x10

    0000: 00 00 10 04 00 00 00 00 00 00 01 00 00 00 80 80    ................

    => i2c md 0x18 0.2 0x20

    0000: 00 00 10 04 00 00 00 00 00 00 01 00 00 00 80 80    ................

    0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    => i2c md 0x18 0.2 0x6d

    0000: 00 00 10 04 00 00 00 00 00 00 01 00 00 00 80 80    ................

    0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    0060: 00 00 00 00 00 00 00 00 00 00 00 00 00    .............

    => i2c md 0x18 0.2 0x100

    0000: 00 00 10 04 00 00 00 00 00 00 01 00 00 00 80 80    ................

    0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    00a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    00b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    00c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    00d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    00e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    00f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    =>    

    But in Kernel I see the following dump, May I know  why TLV320AIC3105 is getting detected as "UU" and dump being set to all zero's, and may I know what is the kernel version being used in "PSDK v4.01"?

    # i2cdetect -y -a -r 1

        0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f

    00: 00 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

    10: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- -- --> Why this is not showing as 18 for tlv320aic3105?

    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

    50: 50 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

    70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

    /# i2cdump -f -y 1 0x18 ---------------------------------> > Why this dump is showing all as zeros for tlv320aic3105?

    No size specified (using byte-data access)

        0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef

    00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    60: 00 00 00 00 00 00 00 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 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    e0: 00 00 00 00 00 00 00 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    ................

    Kindly do the needful

  • Srini said:

    Right now I have connected only i2c_scl and i2c sda lines and ground to my custom processor without connecting mclk, lrclk, bclk and i2s_in adn i2s_out

    Any Idea or inputs, why I see this behaviour?

    From what I understand, you observe that behaviour on your custom board, which is based on NXP processor and AIC3105 codec. As this is Sitara forum, and you are NOT using Sitara device, I can not be in help.

    Srini said:
    But in Kernel I see the following dump, May I know  why TLV320AIC3105 is getting detected as "UU"

    Srini said:
    10: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- -- --> Why this is not showing as 18 for tlv320aic3105?

    Check below link:

    Srini said:
    what is the kernel version being used in "PSDK v4.01"?

    4.9.41

    Srini said:
    /# i2cdump -f -y 1 0x18 ---------------------------------> > Why this dump is showing all as zeros for tlv320aic3105?

    This is NOT Sitara device, thus I can NOT help

  • Dear Pavel,

    Thanks a lot for all your prompt support w.r.t this thread and it was very quickly responses from you

    Even though am using custom processor, your inputs  are really helping me to fix the hardware issue, could you please do the favour w.r.t the below query?

    1. Could you please perform i2c write/read in u-boot and share me the logs with your Am335x and tlv320aic3106?, as the below logs shows only the i2c read operations in u-boot

    us 0:    i2c@44e0b000
    => i2c probe
    No I2C bus selected
    => i2c dev 0
    Setting bus to 0
    => i2c bus  
    Bus 0:    i2c@44e0b000  (active 0)
    => i2c probe
    Valid chip addresses: 18 1B 2D 50
    => i2c speed
    Current bus speed=400000
    => i2c md 0x1B 0.2 5
    0000: 00 10 04 00 00    .....
    => i2c md 0x1B 0.2 0x10
    0000: 00 10 04 00 00 00 00 00 00 01 00 00 00 80 80 ff    ................
    => 

    Kindly do the needful, as early as possible

    Many Thanks in advance

  • Dear Pavel,

    May I know if there was any updates on the above,

    Could you please send me the scope waveforms of MCLK, BCLK, WCLK, TX_data, after once you do the playback from "AM335x to TLV320AIC3105"?

    With the help of your inputs am able to resolve the i2c issue?