09-24-2020, 09:54 PM
It all started with figuring out audio quality issues in the Mobian room over on the Matrix server.
Long story short, I messed around with gain settings but couldn't make it sound as expected. So I started digging around in the schematics and datasheets to see if there was a hardware issue. Turns out I was right; there are hardware issues.
Let's start in the middle with the centerpiece of the discussion, Broadchip BCT4717ETB-TR. This is an analog switch and in the PinePhone it's wired up to switch between headphone audio and debug serial. In the PinePhone v1.2 schematic on page 8 you can see it's connected to HPOUT_L/HPOUT_R on the A64 through inductors, to PB8-DEBUG-RX/PB8-DEBUG-TX on the A64 and to HP_L/HP_R on the headphone jack.
The issue here stems from the BCT4717ETB-TR being an analog switch. The way it is connected on the schematic implies it's being used as a non-inverting audio OpAmp even though it's meant for signaling. It lacks the linear properties of an audio OpAmp and the datasheet gain graphs don't even go below 1 MHz. The graphs cover 1 MHz to 1 GHz and 300 MHz is the point where it reaches -3 dB attenuation at 1.65 V_CC which matches up well with its rated bandwidth of 300 MHz. The graph isn't exactly flat in between which leads me to believe it's unlikely to be flat for lower frequencies as well, but that's still not the main issue.
The main issue is both the analog switch range and the output impedance. The analog signal range is specified as 0 to V+, which in our case should mean 0-3.3 V. That is sort of fine since we're using a virtual ground (connected to HP-FB on the A64) but it's a point of concern. The output impedance isn't explicitly defined but the output resistance is specified as 4 Ohm typical and 8.5 Ohm maximum. Together with the inductance that becomes a low pass filter, I haven't been able to find accurate data for our components in the audible range but the shape of the curve is inverse logarithmic. This could explain why the amplifier is so incredibly bass heavy. Furthermore even if we apply a constant impedance at 4 Ohms that's still way too high for most headphones you'd connect to a phone, which are somewhere in the ballpark of 8 to 40 Ohms at 1 kHz. This could lead to strange harmonics, especially at the lower end of that range.
Then there's yet another issue I discovered while trying to measure the DC offset which turned out to be in the mV range and too small to accurately measure with my old analog scope and a twitchy cable. After about 10 seconds of pausing the music the DC offset rose to a whopping 200 mV! This is not really a good thing if you leave headphones plugged in overnight as they typically don't like DC at all, let alone 200 mV.
This is about as far as I can go tonight, it's way past bedtime and I'm super tired but I wanted to get this written down somewhere before I forget the details. My conclusion for now is that someone needs to validate my results, if the 200 mV idle offset is reproducible on other units then we might need to issue a PSA about not leaving headphones plugged in when they're not in use. Furthermore I'd really encourage the hardware people to either use a proper headphone amplifier or separate out the debug serial port from the headphone jack.
I'll see if I can figure out a way of getting frequency response curves.
Long story short, I messed around with gain settings but couldn't make it sound as expected. So I started digging around in the schematics and datasheets to see if there was a hardware issue. Turns out I was right; there are hardware issues.
Let's start in the middle with the centerpiece of the discussion, Broadchip BCT4717ETB-TR. This is an analog switch and in the PinePhone it's wired up to switch between headphone audio and debug serial. In the PinePhone v1.2 schematic on page 8 you can see it's connected to HPOUT_L/HPOUT_R on the A64 through inductors, to PB8-DEBUG-RX/PB8-DEBUG-TX on the A64 and to HP_L/HP_R on the headphone jack.
The issue here stems from the BCT4717ETB-TR being an analog switch. The way it is connected on the schematic implies it's being used as a non-inverting audio OpAmp even though it's meant for signaling. It lacks the linear properties of an audio OpAmp and the datasheet gain graphs don't even go below 1 MHz. The graphs cover 1 MHz to 1 GHz and 300 MHz is the point where it reaches -3 dB attenuation at 1.65 V_CC which matches up well with its rated bandwidth of 300 MHz. The graph isn't exactly flat in between which leads me to believe it's unlikely to be flat for lower frequencies as well, but that's still not the main issue.
The main issue is both the analog switch range and the output impedance. The analog signal range is specified as 0 to V+, which in our case should mean 0-3.3 V. That is sort of fine since we're using a virtual ground (connected to HP-FB on the A64) but it's a point of concern. The output impedance isn't explicitly defined but the output resistance is specified as 4 Ohm typical and 8.5 Ohm maximum. Together with the inductance that becomes a low pass filter, I haven't been able to find accurate data for our components in the audible range but the shape of the curve is inverse logarithmic. This could explain why the amplifier is so incredibly bass heavy. Furthermore even if we apply a constant impedance at 4 Ohms that's still way too high for most headphones you'd connect to a phone, which are somewhere in the ballpark of 8 to 40 Ohms at 1 kHz. This could lead to strange harmonics, especially at the lower end of that range.
Then there's yet another issue I discovered while trying to measure the DC offset which turned out to be in the mV range and too small to accurately measure with my old analog scope and a twitchy cable. After about 10 seconds of pausing the music the DC offset rose to a whopping 200 mV! This is not really a good thing if you leave headphones plugged in overnight as they typically don't like DC at all, let alone 200 mV.
This is about as far as I can go tonight, it's way past bedtime and I'm super tired but I wanted to get this written down somewhere before I forget the details. My conclusion for now is that someone needs to validate my results, if the 200 mV idle offset is reproducible on other units then we might need to issue a PSA about not leaving headphones plugged in when they're not in use. Furthermore I'd really encourage the hardware people to either use a proper headphone amplifier or separate out the debug serial port from the headphone jack.
I'll see if I can figure out a way of getting frequency response curves.