On Thu, Oct 29, 2015 at 2:56 PM, Rick Mann rmann@latencyzero.com wrote:
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/68747470733a2f2f6661726d312e737461746963666c69636b722e636f6d2f3637382f32313431393631383237305f303233336331643566355f682e6a7067
FYI, Henry Ott's great book (Electromagnetic Compatibility Engineering) strongly discourages the use of separate digital and analog ground planes. On modern mixed signal boards, they don't make a lot of sense, and IIRC he says something to the effect of, "don't use a separate ground plane even though manufacturers inexplicably still recommend them". :-) They key is physical separation of analog and digital signals, not separate ground planes.
That said, which GND plane is your QFN pad connected to? It looks to be the analog plane, and where are the two planes connected together (should be literally under the codec).
If the two planes are connected under the codec, then the layout looks okay. If they are not connected under the codec, or at least close, and if you can dig out your ground planes, try soldering a solder braid between them, jumpering from your QFM pad vias over to your digital ground with low impedance solder braid (solder wick).
What are L2 and L3 for? LC filters on power supplies can get nasty if you're not careful. In fact, they're almost always nasty on power supplies because they cause a strong resonance (there are exceptions of course...). You can try just shorting them out.
The vias from your bypass caps (C16, C17) to GND looks pretty high impedance, using only a single shared via. Ideally, you should use 2 vias per cap, and thick wires.
But.. even with all those comments, nothing looks horribly wrong. I can't tell from the screenshot -- are you 100% sure that every GND on the analog plane connects to the analog plane?
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.
Where does it say to LC filter the power supply in the datasheet -- I didn't see that.
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.
Yeah, but the DAC isn't enabled I believe -- it often gets shut off even though the chip is 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/1671425#1671425
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/c7ee146f2b88da17fd4e61b0a1a6707c91007ef0/bbb/cape/Podtique1/BB-BONE-AUDI-03-00A0.dts#L136-L150
- 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.
Very difficult with a scope. You can use an LC filter for that, but even so, there i still a ton of high frequency crud left due to the sigma delta dacs. Much better to use a pro audio sound card with pro audio level balanced inputs like RME Fireface or Lynx. There are many others, though I'm only really familiar with the fireface.
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.
Yep, that's becase the codec itself is turned on/off. there will be lots of digital noise up over a few MHz, and it makes viewing with a scope almost impossible. Get a pro audio sound card :-)
-Caleb