On Oct 29, 2015, at 14:21 , Benoît Thébaudeau benoit.thebaudeau.dev@gmail.com wrote:
Dear Rick Mann,
On Thu, Oct 29, 2015 at 8:59 AM, Rick Mann rmann@latencyzero.com wrote:
I have a custom cape on a Beaglebone Black that uses a tlv320aic3104, connected to a tpa3140d2 audio power amp. I currently manually control the /shudown pins on the two ICs, and just turn them on before doing anything else.
The system works. But I notice that when I open the output device for writing (via libao), I immediately hear hiss, even before I send any samples to the device. After I close the libao audio device, a few seconds later Linux sends some i2c commands to the tlv320 and it's once again silent.
The perceived amplitude of this hiss does not seem to be affected by "amixer set PCM <0 - 127>" calls.
Does anyone have any idea where this noise might be coming from? Is it just thermal or other noise in the routing of audio within the tlv320? Is there some configuration or routing I might be able to change to avoid it? Did I screw up somewhere in my circuit design or layout that only manifests when linux configures the chip for operation?
Any ideas are appreciated. Thanks.
Thanks Benoit,
It could be many things, but here are a few ideas:
- Make sure that you have followed carefully the data sheets (CODEC +
amp) regarding the hardware schematic and layout. IIRC, the TLV has a thermal pad that should be grounded.
- Make sure that the audio power supplies are clean enough. You can
derive them from more general-purpose power supplies if filtering is added. The PCB layout must define a clear audio area, ideally with a plane for the audio power supply on one of the layers. Even better, you can use dedicated low-noise power supplies.
I tried to follow the layout guidelines exactly. It's a four-layer board with a solid ground plane under the analog sections, and it's isolated from the digital ground. Here's a shot of the board:
https://camo.githubusercontent.com/833bde12303c9607259e486b8b301503dcc69a94/...
Red is top layer, light blue is the ground plane (second layer), purple is the third layer, and dark blue is the bottom layer.
There are dedicated LDOs for everything, fed from a main 5 V DC-DC converter. The main amplifier power comes from the main power input, which in this instance is a linear constant-current bench supply. It's also heavily LC-filtered, as per the data sheet guidelines.
The biggest reason I'm fairly sure it's not the board layout is that the noise is dramatically reduced when the ALSA audio device is not open, even though the ICs are powered and enabled.
- Make sure that all unused CODEC pins are configured as not connected in ALSA.
- Make sure that all unused audio paths are disabled. You can use
`alsactl store` to dump and check everything.
I'll see what I can see. On the TI e2e forum, it was suggested to ensure the DAC audio path goes through the output mixer, rather than bypassing it, because it acts as a noise filter (diagram in the post).
http://e2e.ti.com/support/data_converters/audio_converters/f/64/p/465738/167...
I don't know what the actual routing is, as I don't understand the ALSA configuration. Here's my asound.state after executing aslactl store:
https://gist.github.com/JetForMe/5d01938dcd952557d2af
Here's my DTS:
https://github.com/JetForMe/podtique/blob/c7ee146f2b88da17fd4e61b0a1a6707c91...
- If possible, you can also listen to the TLV outputs directly
without the amp in order to know if it's caused by the amp or before it in the audio chain.
Hmm, not sure how to listen to them. But like I said, I don't think it's caused by the amp. Once the CODEC is reset by ALSA, the noise stops, even though the amp remains powered.
I tried to look at the output on an oscilloscope, but this has proved challenging. I used speaker-test to generate a 500 Hz sine wave, but the noise on the differential line out seems to eclipse the signal; at least, I haven't really been able to see the sine wave, despite hearing a pretty clear 500 Hz tone from the speakers (albeit with the hiss).
I can see signal on the line as soon as the CODEC is configured by ALSA, even before sending it samples. Once the CODEC is reset by ALSA, the signal visible reduces substantially.