PROCESSOR-SDK-AM67: BeagleY AI uname 6.1.83 + ADCx140EVM-PDK . 4 TDM, 48000 hz, 16kbit. codec slave, codec master

Part Number: PROCESSOR-SDK-AM67
Other Parts Discussed in Thread: TLV320ADC5140

Tool/software:

Hi Guys here again.

We give up get 4 channels from RP5+TVL320ADC5140 and decided to swich  towards BeagleY_AI + TVL320ADC5140. After one day of struggle to connect to part together I am return  back. 

1)  From official tool was taken lates   Debian 13 V6.1x-ti XFCE. After OS initialization   it do not have any  related stuff for  SND_SOC_TLV320ADCX140 family , C/h drivers, dtbo files.   By fakeroot make -j$(nproc) bindeb-pkg was taken linux image, recompile all modules , now uname -r give 6.1.83, 

2) SND_SOC_TLV320ADCX140 now ok, c/h drivers ok, on i2c situation below: 

 root@beagleboard:/home/bb# i2cdetect -l
i2c-1 i2c OMAP I2C adapter I2C adapter
i2c-2 i2c OMAP I2C adapter I2C adapter
i2c-3 i2c OMAP I2C adapter I2C adapter
i2c-4 i2c OMAP I2C adapter I2C adapter
i2c-5 i2c OMAP I2C adapter I2C adapter

root@beagleboard:/home/bb# i2cdetect -y 1
Warning: Can't use SMBus Quick Write command, will skip some addresses
0 1 2 3 4 5 6 7 8 9 a b c d e f
00:
10:
20:
30: -- -- -- -- -- -- -- --
40:
50: -- -- -- -- 54 -- -- -- -- -- -- -- -- -- -- --
60:
70:
root@beagleboard:/home/bb#

root@beagleboard:/home/bb# i2cdetect -y 2
Warning: Can't use SMBus Quick Write command, will skip some addresses
0 1 2 3 4 5 6 7 8 9 a b c d e f
00:
10:
20:
30: UU -- -- -- -- -- -- --
40:
50: UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60:
70:
root@beagleboard:/home/bb#

Could you help whit rest of adjustment  for slave and master mode for alsa, dts/dtbo files, for extlinux.conf as well, for registry settings for TVL320ADC5140 to get 4 channels from ADC

Thank you for help.

  • update here. TVL320 took 0x4c but driver do not loaded 

    1)

    root@beagleboard:/home/bb# i2cdetect -y -r 1
    0 1 2 3 4 5 6 7 8 9 a b c d e f
    00: -- -- -- -- -- -- -- --
    10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    40: 40 -- -- -- -- -- -- -- -- -- -- -- 4c -- -- --
    50: -- -- -- -- 54 -- -- -- -- -- -- -- -- -- -- --
    60: -- -- -- -- -- 65 -- -- -- -- -- -- -- -- -- --
    70: -- -- -- -- -- -- -- --
    r

    2)

    root@beagleboard:/home/bb# i2cdump -y 1 0x4c
    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 05 00 30 00 00 00 00 01 02 03 04 .....?.0....????
    10: 05 06 07 02 48 ff 10 10 04 20 02 08 00 00 02 40 ????H.??? ??..?@
    20: 00 22 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ."..............
    30: 00 00 00 ff 00 00 00 00 00 00 00 00 00 00 c9 80 ..............??
    40: 00 00 00 c9 80 00 00 00 c9 80 00 00 00 c9 80 00 ...??...??...??.
    50: 00 00 c9 80 00 00 00 c9 80 00 00 00 c9 80 00 00 ..??...??...??..
    60: 00 c9 80 00 00 00 00 00 00 00 00 01 40 7b 00 00 .??........?@{..
    70: e7 00 00 f0 00 00 00 80 00 00 ff 00 ff 8c 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 ................

  • Hi Valerii,

    Please refer the below document on understanding the MCASP operation and direction of PINs(Input/Output) and Master/Slave configuration.

    https://www.ti.com/lit/pdf/sprack0

    Also for reference, you can look at our device tree where our codec is the master(clock initiator).

    https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/tree/arch/arm64/boot/dts/ti/k3-j722s-evm.dts?h=ti-linux-6.12.y#n206

    Audio related documentation can be found in the link below:

    https://software-dl.ti.com/jacinto7/esd/processor-sdk-linux-am67/11_00_10_01/exports/docs/linux/Foundational_Components/Kernel/Kernel_Drivers/Audio.html

    Hope this helps

    Best Regards,

    Suren

  • Hi Man. Thank for standard answer. It is do not help so much. Could you tell me why alsa do no upload driver for tlv320adc5140?

    I already bought 2 TI products, spend my money and  could not connect them together!

    Here is dump of 3 commands after all settings initialization, 3 of them give nothing:

    root@beagleboard:/home# sudo depmod -a
    | grep tlv320sudo modprobe snd-soc-tlv320adcx140
    lsmod | grep tlv320
    root@beagleboard:/home#

    Let check step by step what was done, and where we got bug.

    1) snd-soc-tlv320adcx140.ko - created and loaded to system

    2) dts/dtbo created and placed in /overlay

    3) extlinux.conf changed 

    Linux won’t load the tlv320adcx140 driver at boot, alsa do not see card.

  • Hi Valerii,

    I assume you have referred the below FAQ in porting the driver.

     [FAQ] TLV320ADC5140: Is there a Linux Driver for the TLV320ADC5140 family of devices? 

    Since its more of the ADC issue, I am routing the query to our Audio team, for further support.

    Best Regards,

    Suren

  • please do, as you could not help. This is not ADC issue it look like Linux issue.

    Best regards

    Valeriy

  • While the team responds, can you share the DTS changes you made in order to add the ADC as soundcard. 

    Does adding dummy sound card work? 

    For using Dummy codec in DTS, you will need to apply the following patch

    https://patchwork.kernel.org/project/alsa-devel/patch/5652E348.8080002@invoxia.com/

    Device tree changes to include dummy codec and register as dummy sound card.

    Example DTS to include the dummy codec.

    codec_test: codec_test {
    compatible = "linux,snd-soc-dummy";
    #sound-dai-cells = <0>;
    status="okay";
    };
     
    codec_test: codec_test {
                    compatible = "linux,snd-soc-dummy";
                    #sound-dai-cells = <0>;
                    status="okay";
            };
     
      
     
    codec_audio: sound {
     
                    compatible = "simple-audio-card";
                    simple-audio-card,name = "AM62X-DUMMY";
                    simple-audio-card,format = "i2s";
                    simple-audio-card,bitclock-master = <&sound_master0>;
                    simple-audio-card,frame-master = <&sound_master0>;
     
      
     
                    sound_master0: simple-audio-card,cpu {
                    sound-dai = <&mcasp1>;
                    system-clock-direction-out;
                    };
     
      
     
                    simple-audio-card,codec {
                            sound-dai = <&codec_test>;
                    };
            };

    Best Regards,

    Suren

  • here is lates Suren   

    /dts-v1/;
    /plugin/;
    
    /*
     * BeagleY-AI (AM67A) + TLV320ADC5140
     * Mode: Codec-Slave (SoC is clock master)
     * Bus: McASP1 on 40-pin HAT header (PCM_* signals)
     * Format: DSP_A (TDM), 4 slots x 16-bit, fs = 16 kHz (BCLK = 1.024 MHz)
     *
     * Wiring on 40-pin HAT:
     *   Pin 12  -> PCM_CLK   = mcasp1_aclkx  (BCLK, SoC -> codec)
     *   Pin 35  -> PCM_FS    = mcasp1_afsx   (FSYNC, SoC -> codec)
     *   Pin 38  -> PCM_DIN   = mcasp1_axr0   (DATA IN to SoC  <- codec DOUT)
     *   Pin 40  -> PCM_DOUT  = mcasp1_axr1   (DATA OUT from SoC; not used here)
     *   Pin 3/5 -> I2C1 SDA/SCL (codec control, default addr 0x48)
     *   GND     -> GND
     *
     * Notes:
     *   - MCLK (AHCLKX) is not present on the HAT header; the codec can lock from BCLK/FSYNC via PLL.
     *   - mcasp0 is used by HDMI on your system; this overlay uses mcasp1 to avoid conflicts.
     */
    
    &{/} {
            compatible = "ti,am67a-beagley-ai";
    
            /* -------------------------------------------------------------
             * Enable & configure McASP1 as capture on AXR0 in TDM4.
             * We DO NOT attach a pinctrl here because your base DT already
             * applied "main-mcasp1-default-pins".
             * ------------------------------------------------------------- */
            fragment@1 {
                    target = <&mcasp1>;
                    __overlay__ {
                            status = "okay";
    
                            /* 0 = MCASP_IIS_MODE (I2S/TDM framing) */
                            op-mode = <0>;
    
                            /* Single data-in serializer using AXR0 in TDM4 */
                            tdm-slots = <4>;
                            serializers = <1>;
    
                            /* Direction bitmask for active serializers:
                             * 1 = IN  (AXR0 is input to the SoC, receiving codec DOUT)
                             */
                            serial-dir = <1>;
                    };
            };
    
            /* -------------------------------------------------------------
             * TLV320ADC5140 on I2C1 (pins 3/5 on the HAT header)
             * Verify the bus label ("&i2c1") matches your running DT.
             * ------------------------------------------------------------- */
            fragment@2 {
                    target = <&i2c1>;
                    __overlay__ {
                            #address-cells = <1>;
                            #size-cells = <0>;
    
                            tlv5140: tlv320adcx140@4c {
                                    compatible = "ti,tlv320adcx140","ti,tlv320adc5140"; /* covers 5140 */
                                    reg = <0x4c>;                    /* confirm with i2cdetect -y 1 */
                                    #sound-dai-cells = <0>;
    
                                    /* If RESET is wired, add it here:
                                     * reset-gpios = <&main_gpio? N GPIO_ACTIVE_LOW>;
                                     */
                            };
                    };
            };
    
            /* -------------------------------------------------------------
             * simple-audio-card glue: SoC (McASP1) is bitclock/frame master.
             * TDM4 @ 16-bit. fs=16 kHz -> BCLK = 16k * 4 * 16 = 1.024 MHz.
             * ------------------------------------------------------------- */
            fragment@3 {
                    target-path = "/";
                    __overlay__ {
                            sound_tlv5140 {
                                    compatible = "simple-audio-card";
                                    simple-audio-card,name   = "TLV320ADC5140-4ch-16k-CodecSlave";
                                    simple-audio-card,format = "dsp_a";
    
                                    /* SoC provides BCLK/FSYNC; codec is slave */
                                    simple-audio-card,bitclock-master = <&cpu_dai>;
                                    simple-audio-card,frame-master    = <&cpu_dai>;
    
                                    /* If you externally feed MCLK=12.288MHz to codec, you may hint:
                                     * simple-audio-card,mclk-fs = <256>;
                                     */
    
                                    cpu_dai: simple-audio-card,cpu {
                                            sound-dai = <&mcasp1>;
    
                                            /* Must match codec serial-port config */
                                            dai-tdm-slot-num   = <4>;
                                            dai-tdm-slot-width = <16>;
    
                                            /* Optionally restrict slots (0..3):
                                             * dai-tdm-slot-mask = <0x0F>;
                                             */
                                    };
    
                                    codec_dai: simple-audio-card,codec {
                                            sound-dai = <&tlv5140>;
                                    };
                            };
                    };
            };
    };

  • Suren look on date, 10 years ago)    Nov. 23, 2015, 9:58 a.m. UTC

  • Yes the patch still holds good to test simple-card without any codec connected. Slight smile

    We also have a similar patch if you want to try that instead:

    https://github.com/jailuthra/linux/commit/2d577a938d24f238edb19c8481dbb7136ff43cf6

    Also, For Beagle boards, could you try asking on the Beagle community on their forum page? Beagle uses a modified version of the SDK from TI to run their debian-based images.

    Best Regards,

    Suren