AnsweredAssumed Answered

can't get ADAU1373 to play

Question asked by amery on Jun 15, 2015
Latest reply on Jun 17, 2015 by larsc

Hi, as mentioned on another post I'm struggling to get an ADAU1373 playing i2s data coming into AIF1.

 

codec_dai and cpu_dai (TI DM8148's McASP) are configured as SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_NB_NF, a 20MHz clock connected to MCLK2, an osciloscope hooked on lineout1/L, and a logic analyser spying the interface A.


At this point I don't know if I'm using it wrong, something is wrong with the driver or if the hardware is defective. I've been struggling for several days, run out of ideas and lost trust on everything. The following tests are run without the patches I posted yesterday, just your latest driver, reg_cache disabled and some debugging.


so I power the board up, read all readable registers and they are identical to those in the default registers table and then the driver powers up the device. all good.


adau1373 4-001c: adau1373_probe:

adau1373 4-001c: snd_soc_8_8_write(0x3c, 0x05) -- 0000 0101     (ADC reset)

adau1373 4-001c: adau1373_set_bias_level: level=1

adau1373 4-001c: snd_soc_8_8_write(0x27, 0x01) -- 0000 0001     (low voltage power up)

adau1373 4-001c: adau1373_set_bias_level: level=2

adau1373 4-001c: snd_soc_8_8_write(0x25, 0x30) -- 0011 0000     (and microphones up)


So my goal is to get some mono sound from AIF1 to Lineout1/L.

AIF1 -> DSP/0 -> DAC1 -> Lineout1


so first the Lineout1, 100% (0dB) playing Stereo.

# amixer sset "Lineout1" 31

adau1373 4-001c: snd_soc_8_8_write(0x09, 0x1f) -- 0001 1111     (Lineout1/L VOL 0dB)

adau1373 4-001c: snd_soc_8_8_write(0x0a, 0x1f) -- 0001 1111     (Lineout1/R VOL 0dB)

# amixer sset "Lineout1 LR Mux" "Stereo"

adau1373 4-001c: snd_soc_8_8_write(0x24, 0x30) -- 0011 0000     (Lineout1 Stereo)


DAC1 at 100% volume (0dB) boosted

# amixer sset DAC1 255

adau1373 4-001c: snd_soc_8_8_write(0x6e, 0x00) -- 0000 0000     (DAC1/L PB VOL -0%)

adau1373 4-001c: snd_soc_8_8_write(0x6f, 0x00) -- 0000 0000     (DAC1/R PB VOL -0%)

# amixer sset "DAC1 Boost" 1

adau1373 4-001c: snd_soc_8_8_write(0x78, 0x01) -- 0000 0001      (CODEC PBA/L 6dB gain)

adau1373 4-001c: snd_soc_8_8_write(0x78, 0x03) -- 0000 0011     (CODEC PBA/R 6dB gain)

 

AIF1 at 100% volume (0dB) boosted

# amixer sset AIF1 255

adau1373 4-001c: snd_soc_8_8_write(0x68, 0x80) -- 0000 0000     (DAIA/R REC VOL -0%)

adau1373 4-001c: snd_soc_8_8_write(0x69, 0x80) -- 0000 0000     (DAIA/R REC VOL -0%)

adau1373 4-001c: snd_soc_8_8_write(0x62, 0x80) -- 0000 0000     (DAIA/L PB VOL -0%)

adau1373 4-001c: snd_soc_8_8_write(0x63, 0x80) -- 0000 0000     (DAIA/R PB VOL -0%)

# amixer sset "AIF1 Boost" 1

adau1373 4-001c: snd_soc_8_8_write(0x76, 0x01) -- 0000 0001     (DAIA/L PB 6dB gain)

adau1373 4-001c: snd_soc_8_8_write(0x77, 0x01) -- 0000 0001     (DAIA/L REC 6dB gain)

adau1373 4-001c: snd_soc_8_8_write(0x76, 0x03) -- 0000 0011     (DAIA/R PB 6dB gain)

adau1373 4-001c: snd_soc_8_8_write(0x77, 0x03) -- 0000 0011     (DAIA/R REC 6dB gain)

 

And routing. DAC1 to Lineout1

# amixer sset "Left Lineout1 Mixer Left DAC1" on

adau1373 4-001c: snd_soc_8_8_write(0x14, 0x20) -- 0010 0000     (LLINE1MIX5 - Lineout1/L DAC1/R)

# amixer sset "Right Lineout1 Mixer Right DAC1" on

adau1373 4-001c: snd_soc_8_8_write(0x15, 0x10) -- 0001 0000     (RLINE1MIX4 - Lineout1/R DAC1/L)


signals get swapped (patch on a separated post) but that shouldn't affect my test.


DSP Channel 1 to DAC1

# amixer sset "DAC1 Mixer DSP Channel1" on

adau1373 4-001c: snd_soc_8_8_write(0x5e, 0x01) -- 0000 0001     (FDSP/0 to DAC1)


and AIF1 to DSP Channel1

# amixer sset "DSP Channel1 Mixer AIF1" on

adau1373 4-001c: snd_soc_8_8_write(0x56, 0x01) -- 0000 0001     (AIFA to DIN/0)

 

so, let's play, 1khz mono wave. I can hear it and see when played on my computer on L and R channels.

 

# aplay /media/mmcblk0p3/wav_samples/1000hz.wav

Playing WAVE '/media/mmcblk0p3/wav_samples/1000hz.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono

 

asoc: adau1373-aif1 <-> davinci-mcasp.2 info:

asoc: rate mask 0xfe

asoc: min ch 2 max ch 2

asoc: min rate 8000 max rate 48000

adau1373 4-001c: snd_soc_8_8_write(0x44, 0x4a) -- 0100 1010     (DAIA MASTER, I2S)

adau1373 4-001c: adau1373_set_dai_pll: pll_id:0 source:11 freq_in:20000000 freq_out:45158400

adau1373 4-001c: adau1373_set_dai_pll: fout = fin * (r:4 + (n:1612 / m:3125)) / x:1

adau1373 4-001c: adau1373_set_dai_pll: dpll_div:0

adau1373 4-001c: snd_soc_8_8_read_i2c(0x2e) -> 0x02 -- 0000 0010     (DPLLA BYPASS)

adau1373 4-001c: snd_soc_8_8_write(0x28, 0xb0) -- 1011 0000     (DPLLA = MCLK2, DPLLA BYPASS)

adau1373 4-001c: snd_soc_8_8_write(0x29, 0x0c) -- 0000 1100     (m:3125 >> 8)

adau1373 4-001c: snd_soc_8_8_write(0x2a, 0x35) -- 0011 0101     (m:3125 & 0xff)

adau1373 4-001c: snd_soc_8_8_write(0x2b, 0x06) -- 0000 0110     (n:1612 >> 8)

adau1373 4-001c: snd_soc_8_8_write(0x2c, 0x4c) -- 0100 1100     (n:1612 & 0xff)

adau1373 4-001c: snd_soc_8_8_write(0x2d, 0x23) -- 0010 0011     (factional, x:2, r:4)

adau1373 4-001c: snd_soc_8_8_write(0x40, 0x09) -- 0000 1001     (CLK1 K=1 J=1)

adau1373 4-001c: snd_soc_8_8_read_i2c(0x47) -> 0x00 -- 0000 0000     (DAIA_SOURCE=PLL1)

adau1373 4-001c: snd_soc_8_8_write(0x47, 0x02) -- 0000 0010     (64 BPFA, SR 1*Fs)

adau1373 4-001c: snd_soc_8_8_read_i2c(0x44) -> 0x4a -- 0100 1010

adau1373 4-001c: snd_soc_8_8_write(0x44, 0x42) -- 0100 0010     (16bits)

davinci_config_channel_size: dev:d674f080 channel_size:2

adau1373 4-001c: snd_soc_8_8_write(0x2e, 0x03) -- 0000 0011     (DPLLA_EN)

adau1373 4-001c: snd_soc_8_8_write(0x40, 0x89) -- 1000 1001     (Core clock enable)

adau1373 4-001c: snd_soc_8_8_write(0x51, 0x09) -- 0000 1001     (DAIAEN, SRCA playback disabled?)

adau1373 4-001c: snd_soc_8_8_write(0xeb, 0x11) -- 0001 0001     (FDSPEN, CODEC PBA enabled)

adau1373 4-001c: snd_soc_8_8_write(0x26, 0x30) -- 0011 0000     (DAC1/L+R powered up)

adau1373 4-001c: snd_soc_8_8_write(0x26, 0x33) -- 0011 0011     (Lineout1/L+R powered up)

 

transfer begins! logic analiser shows bit clock coming at ~2.8MHz, frame clocks at 44.1kHz (50% duty cycle), and both channels (identical) aligned to the right left taking 1/4 of the frame each.

transfer finishes cleanly after the length of the audio file... but nothing came out of LOUT1L

 

can you enlighten me on what am I missing or doing wrong?

 

thanks in advance,

Alejandro Mery

 

Update: fix typo on how the slots gets aligned in relation to the frame.

Outcomes