Lineout 'pop' when audioShield.enable() is called

Status
Not open for further replies.

MrTom

Well-known member
I got a Teensy 3.2 w/audio shield. I just downloaded Arduino 1.6.7 and Teensyduino. I loaded up the "SpectrumAnalyzerBasic" sketch, and when it gets to "audioShield.enable();" there's a horrendous audio pop out of the lineout. The headphone out doesn't have this pop. I tried to set mixer levels to 0 and volume to 0 before the .enable(), but I suppose since it's not enabled yet it can't adjust the volume as the sketch just locks up.

I searched the forums and found something from almost a year ago, but I wasn't sure of the fix. Is there a function I could add to quiet down that pop when it starts?
 
It looks like inside control_sgtl5000.cpp the function "bool AudioControlSGTL5000::enable(void)", and it calls "write(CHIP_ANA_POWER, 0x4060)". That's right where there's a major audio pop. It's worse right when you upload the sketch and it runs. When I pull the power and put it back and the sketch runs then the pop is much lower, but still there.

Anyone know how to cure this?
 
Last edited:
What happens if you simply remove that line?

Hmm, then there's no pop. It seems to be working okay. But I don't want to go removing code all willy nilly.

It does seem to be writing a 1 to registers:
// 14 DAC_MONO While DAC_POWERUP is set, this allows the DAC to be put into left only
// ........mono operation for power savings. 0=mono, 1=stereo (default)
// 6 ADC_MONO While ADC_POWERUP is set, this allows the ADC to be put into left only
// ........mono operation for power savings. This mode is useful when
// ........only using the microphone input.
// ........0x0 = Mono (left only), 0x1 = Stereo
// 5 REFTOP_POWERUP Power up the reference bias currents
// ........0x0 = Power down, 0x1 = Power up
// ........This bit can be cleared when the part is a sleep state
// ........to minimize analog power.

Not sure if they are really needed or not. It may be the REFTOP_POWERUP that's causing the pop.

EDIT: It doesn't seem like any of the bits make any difference. If I write all 0's or all 1's, it still pops. It seems the only option is to remove it.
 
Last edited:
Page 42 of http://www.pjrc.com/teensy/SGTL5000.pdf details this register.

So as 0x4060 is being written the following is being done:
DAC_MONO = 1 -> Stereo mode
ADC_MONO = 1 -> Stereo mode
REFTOP_POWERUP = 1 -> Power up the reference bias currents

Now none of these actually need to be set. As you can tell a RESET sets them to these values anyway.
By rewritting these values you're possibly resetting the charge pump which maybe causing a brief discharge.
You can try writing 0x4040 to confirm if you'd like
 
Page 42 of http://www.pjrc.com/teensy/SGTL5000.pdf details this register.

So as 0x4060 is being written the following is being done:
DAC_MONO = 1 -> Stereo mode
ADC_MONO = 1 -> Stereo mode
REFTOP_POWERUP = 1 -> Power up the reference bias currents

Now none of these actually need to be set. As you can tell a RESET sets them to these values anyway.
By rewritting these values you're possibly resetting the charge pump which maybe causing a brief discharge.
You can try writing 0x4040 to confirm if you'd like

Even writing 0x4040 still makes a pop. I also tried a modify() to change only one of the bits without affecting the rest, but the same thing. If this is truly not necessary maybe it could be added to final code so when other people try to use lineout they don't get the same problem.

BTW, is there a better way to build-all than having to delete the build folder in the temp directory?
 
Last edited:
... just for interest try writing 0x0000, 0x4000 and 0x0040. I'd be interested to know exactly which register bit is causing or if rewriting the register is causing issues itself.
If it's the latter that's not all that surprising. These complicated ICs all have their own little quirks that just aren't listed on the datasheets and only come through experience with them.

Unfortunately I don't think there is a way to rebuild your project in the arduino IDE. I'd strongly recommend using Visual Micro or even going to full distance with a makefile. Both of these will provide you with that functionality and much more
 
... just for interest try writing 0x0000, 0x4000 and 0x0040. I'd be interested to know exactly which register bit is causing or if rewriting the register is causing issues itself.
If it's the latter that's not all that surprising. These complicated ICs all have their own little quirks that just aren't listed on the datasheets and only come through experience with them.

Unfortunately I don't think there is a way to rebuild your project in the arduino IDE. I'd strongly recommend using Visual Micro or even going to full distance with a makefile. Both of these will provide you with that functionality and much more

It seems writing any of those values makes it pop every time. The odd thing is the pop happens only after the Upload when it runs. When you unplug the USB cable, which I also use as power, and plug it back in to run the sketch the pop doesn't happen. Really there is a very subtle pop, but very low and acceptable.
 
Status
Not open for further replies.
Back
Top