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.

TLV320ADC6140: Converting 4 Channel TDM to I2S

Part Number: TLV320ADC6140
Other Parts Discussed in Thread: AM5729

I currently have a 4-channel audio recording setup from a TLV320ADC6140 to an AM5729 over MCASP using TDM. Unfortunately, I have another device on the same MCASP that is not compatible with TDM. I am just looking for some guidance on the modifications required to communicate the 4 analog input channels over I2S instead of TDM. I understand that the simple-audio-card-format will need to change to "i2s", mcasp tdm-slots will change to 2, and all tdm-based fields will need to be removed.  Here are my device, mcasp and sound configurations:

sound {
	compatible = "simple-audio-card";
	simple-audio-card,name = "tlv320adc6140";
	simple-audio-card,format = "dsp_a";
	simple-audio-card,bitclock-master = <&mcasp>;
	simple-audio-card,frame-master = <&mcasp>;
	mcasp: simple-audio-card,cpu {
		sound-dai = <&mcasp1>;
	        system-clock-direction-out;
		system-clock-frequency = <24576000>;
		dai-tdm-slot-num = <4>;
		dai-tdm-slot-width = <32>;
		dai-tdm-slot-tx-mask = <1 1 1 1>;
		dai-tdm-slot-rx-mask = <1 1 1 1>;
	};

	codec: simple-audio-card,codec {
		sound-dai = <&tlv320adc6140>;
	};
};

&mcasp1 { compatible = "ti,dra7-mcasp-audio"; #sound-dai-cells = <0>; status = "okay"; op-mode = <0>; // I2S Mode tdm-slots = <4>; // 4 channels active num-serializer = <16>; // define all 16. Keep inactive ones for completeness and to ensure axr10 and axr11 used serial-dir = < // 0: INACTIVE, 1: TX, 2: RX - ax10 Tx | ax11 Rx 0 0 0 0 0 0 0 0 0 0 1 2 0 0 0 0 >; tx-num-evt = <32>; // configures WFIFIO threshold. 1 - if properpty missing FIFO use disabled. 0 - disabled rx-num-evt = <32>; // configures RFIFO threshold. ^ };

  tlv320adc6140: tlv320adc6140@4c {
	compatible = "ti,tlv320adc6140";
	#sound-dai-cells = <0>;
	reg = <0x4c>;
	ti,mic-bias-source = <6>;                   // Unconnected -> can probably leave it off
	ti,gpi-config   = <1 1 1 1>;                // All configured as general-purpose input
	ti,gpio-config  = <2 2>;                    // GPIO1 is configured as ADC_INT. check output drive type
	ti,gpo-config-1 = <1 0>;                    // GPO1 configured as general pupose output - check drive type
	ti,gpo-config-2 = <1 0>;                    // GPO2 configured as general pupose output - check drive type
	ti,gpo-config-3 = <1 0>;                    // GPO3 configured as general pupose output - check drive type
	ti,gpo-config-4 = <1 0>;                    // GPO4 configured as general pupose output - check drive type
	reset-gpios = <&gpio6 20 GPIO_ACTIVE_HIGH>; // Check: Only GPIO on ball C23
	status = "okay";
};



  • Hi Jared,

    I'm not familiar with programming AM5729 device to ensure the audio is in i2s format, but you're correct for switching to 2 channels (L+R) over TDM-8. Please see section 8.3.1.2.2 section of datasheet

    Here is script you can write to TLV320ADC6140 device to ensure that it will accept i2s, 32-bit word length, 4-channel single ended analog input.

    # CHECKSUM 0
    # Generated by ADCx140EVM-SW v3.0.5
    # TLV320ADC6140 device configuration
    # -----------------------------------------------------------------------------
    # Reset
    # -----------------------------------------------------------------------------
    # Select Page 0
    w 98 00 00
    # Reset Device
    w 98 01 01
    # 1mS Delay
    # -----------------------------------------------------------------------------
    # Begin Device Memory
    # -----------------------------------------------------------------------------
    # Page 0 (0x00) Dump
    # Select Page 0
    w 98 00 00
    # Wake up and enable AREG
    w 98 02 81
    # ASI Configuration
    w 98 07 70
    # GPI Configuration
    w 98 3b 60
    # Channel 1 configuration
    w 98 3c a1
    # Channel 2 configuration
    w 98 41 a1
    # Channel 3 configuration
    w 98 46 a1
    # Channel 4 configuration
    w 98 4b a1
    # Channel Input/Output Configuration
    w 98 74 f0
    
    

    Regards,

  • Hi Daveon, I appreciate the assistance. I have confirmed that my driver is currently setting up the ADC as outlined above. However, I believe the solution to my problem lies in clocking control of the MCASP to allow 4 channels worth of data to transmit over L+R Protocol. I have some worries about how ALSA will deal with this if anyone can provide some guidance.

  • Hi Jared,

    I see, there are two good resources on AM5729 product page that detail how to transmit data via I2S.

    Section 24.6.2.2 of the technical reference manual:

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

    Also this application note: McASP Design Guide - Tips, Tricks, and Practical Examples

    Best Regards,