Part Number: TLV320AIC3120EVM-U
Other Parts Discussed in Thread: TLV320AIC3120,
Tool/software:
Hello, we are trying to control the TLV320AIC3120 audio codec on the TLV320AIC3120EVM-U board using a Raspberry Pi 4 model b microcontroller over I2C connection so that audio loopback can be achieved with I2S data. The Pi is connected to the codec board through SDA, SCL, MCLK, DIN, BCLK, DOUT, WCLK, and RESET and the respective TP pins on the codec board.
Pinout Details:
I2C Interface: - SDA: GPIO 2 (Pin 3) -> TP2 (I2C SDA) - SCL: GPIO 3 (Pin 5) -> TP1 (I2C SCL) I2S Audio Interface: - MCLK: GPIO 4 (Pin 7) -> TP3 (MCLK for codec) (Using Fake Clock Because Pi does not provide signals through Mclk) - BCLK: GPIO 18 (Pin 12) -> TP5 (I2S BCLK) - LRCLK: GPIO 19 (Pin 35) -> TP7 (I2S WCLK) - DOUT: GPIO 21 (Pin 40) -> TP4 (I2S DIN to codec) - DIN: GPIO 20 (Pin 38) -> TP6 (I2S DOUT from codec)
We also physically lifted the IC off the U1 chip TAS1020BPFB to prevent it from communicating over I2C at the same time as the Pi. On the Pi we have installed the correct Linux kernel driver for the codec, and the device is recognized over I2C by the Pi. We also created an overlay file to set up the I2S streaming and MCLK.
Results from i2cdetect:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: 50 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
However, upon testing, it became clear that the codec was not being initialized correctly, and in dmesg these messages were present:
[ 5.245345] tlv320aic31xx: loading out-of-tree module taints kernel.
[ 5.246262] tlv320aic31xx-codec 1-0018: supply HPVDD not found, using dummy regulator
[ 5.246387] tlv320aic31xx-codec 1-0018: supply SPRVDD not found, using dummy regulator
[ 5.246419] tlv320aic31xx-codec 1-0018: supply SPLVDD not found, using dummy regulator
[ 5.246441] tlv320aic31xx-codec 1-0018: supply AVDD not found, using dummy regulator
[ 5.246478] tlv320aic31xx-codec 1-0018: supply IOVDD not found, using dummy regulator
[ 5.246502] tlv320aic31xx-codec 1-0018: supply DVDD not found, using dummy regulator
[ 11.740642] tlv320aic31xx-codec 1-0018: aic31xx_wait_bits: Failed! 0x24 was 0xc0 expected 0x0 (0, 0x40, 500000 us)
[ 11.740665] tlv320aic31xx-codec 1-0018: ASoC: POST_PMD: ADC event failed: -1
[ 13.012677] tlv320aic31xx-codec 1-0018: aic31xx_wait_bits: Failed! 0x24 was 0xc0 expected 0x0 (0, 0x40, 500000 us)
[ 13.012700] tlv320aic31xx-codec 1-0018: ASoC: POST_PMD: ADC event failed: -1
[ 13.915491] tlv320aic31xx-codec 1-0018: aic31xx_wait_bits: Failed! 0x24 was 0xc0 expected 0x0 (0, 0x40, 500000 us)
[ 13.915526] tlv320aic31xx-codec 1-0018: ASoC: POST_PMD: ADC event failed: -1
[ 19.208454] tlv320aic31xx-codec 1-0018: aic31xx_wait_bits: Failed! 0x25 was 0x88 expected 0x0 (0, 0x80, 500000 us)
[ 19.208480] tlv320aic31xx-codec 1-0018: ASoC: POST_PMD: DAC Left event failed: -1
[ 20.212429] tlv320aic31xx-codec 1-0018: aic31xx_wait_bits: Failed! 0x25 was 0x88 expected 0x0 (0, 0x8, 500000 us)
[ 20.212453] tlv320aic31xx-codec 1-0018: ASoC: POST_PMD: DAC Right event failed: -1
How can this issue be solved and allow for codec to be controlled by the Pi? The overlay code is below, as are the results from i2cdump. Thank you for your time.
Overlay Code:
/plugin/;
/ {
compatible = "brcm,bcm2835";
fragment@0 {
target = <&i2s>;
__overlay__ {
status = "okay";
};
};
fragment@1 {
target = <&i2c1>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
tlv320: tlv320aic3120@18 {
compatible = "ti,tlv320aic3120";
reg = <0x18>;
#sound-dai-cells = <0>;
clocks = <&dummy_clock>;
clock-names = "mclk";
};
};
};
fragment@2 {
target-path = "/";
__overlay__ {
dummy_clock: dummy_clock {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <11289600>; // 12.288 MHz
clock-output-names = "dummy-mclk";
};
sound {
compatible = "simple-audio-card";
simple-audio-card,name = "TLV320AIC3120";
simple-audio-card,format = "i2s";
simple-audio-card,bitclock-master = <&cpu_dai>;
simple-audio-card,frame-master = <&cpu_dai>;
simple-audio-card,channels-min = <2>;
simple-audio-card,channels-max = <2>;
cpu_dai: simple-audio-card,cpu {
sound-dai = <&i2s>;
};
codec_dai: simple-audio-card,codec {
sound-dai = <&tlv320>;
};
};
};
};
};
I2C dump results:
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: 00 00 01 66 00 11 04 00 00 00 00 01 01 00 80 80 ..?f.??....??.??
10: 08 00 01 01 80 80 04 00 00 00 01 30 00 00 01 00 ?.?????...?0..?.
20: 00 00 00 00 c0 88 00 00 00 00 00 00 00 00 00 00 ....??..........
30: 00 00 00 02 32 12 02 02 02 11 10 00 01 04 00 04 ...?2??????.??.?
40: 0c 1b 00 00 6f 38 00 00 00 00 00 ee 10 d8 7e e3 ??..o8.....???~?
50: 00 00 80 00 00 00 00 00 7f 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 ................







