Teensy Audio -- Noise in Microphone Capture

Status
Not open for further replies.

ahmak

New member
Hello All,
I am using a Cortex-M4 (STM32, not Teensy) with Teensy Audio board. The Teensy is powered by "jumper wires" from the main board. The configuration setting is given at end of my query.

I get a constant noise in my capture. Assuming the I2S was in error, I did SGTL Internal Loopback but the noise continues. Tried both synchronous and asynchronous mode. The audio is configured for 8KHz sampling as per our algorithm requirement.

The noise continued in both asynchronous and synchronous (2.048MHz clock (MCLK) input - again sourced from the Cortex-M4 or 12MHz (PLL mode).

Then, after lot of hair-pulling, I today changed BIAS_CTRL to -37.5% and the noise reduced significantly but still not reduced.

I tried adding a 0.1uF to the MIC pin, but the noise is still present. I am now trying only the loopback at the chip and unable to find a way forward...

Any help/ direction appreciated.

Thanks,


---- My configuration-----
static void ConfigureSgtl()
{
// Value which is used in Bitbucket code with PLL
uint32_t delay;

SgtlRegWrite(SGTL5000_CHIP_ANA_POWER, 0x4060); // Power down everything but ADC, DAC and Ref Currents Power Up
SgtlRegWrite(SGTL5000_CHIP_LINREG_CTRL, 0x006C); // Manually assign charge pump source to VDDIO
SgtlRegWrite(SGTL5000_CHIP_REF_CTRL, 0x001F2); // Set VAG = 1.575
SgtlRegWrite(SGTL5000_CHIP_LINE_OUT_CTRL, 0x0000);// No-op
SgtlRegWrite(SGTL5000_CHIP_SHORT_CTRL, 0x4446); // Disable short control
SgtlRegWrite(SGTL5000_CHIP_ANA_CTRL, 0x0122); // Unmute DAC/ADC and select proper sources for mic/headphone
SgtlRegWrite(SGTL5000_CHIP_PLL_CTRL,0x8312);

#ifdef USE_MONO_CHANNEL
SgtlRegWrite(SGTL5000_CHIP_ANA_POWER, 0x53A); // Power down everything but mic, dac, HP,
SgtlRegWrite(SGTL5000_CHIP_ANA_POWER, 0x5BA); // Enable VAG
#else
SgtlRegWrite(SGTL5000_CHIP_ANA_POWER, 0x457A); // Power down everything but mic, dac, HP,
SgtlRegWrite(SGTL5000_CHIP_ANA_POWER, 0x45FA); // Enable VAG
#endif

SgtlRegWrite(SGTL5000_CHIP_DIG_POWER, 0x0063); // ADC, DAC, I2S_IN, I2S_OUT

delay = 1000000u;
while(--delay);

SgtlRegWrite(SGTL5000_CHIP_LINE_OUT_VOL, 0x0F0F); // Max out the attenuation for line out
SgtlRegWrite(SGTL5000_CHIP_CLK_CTRL, 0x003B); // Fs = 48/6 KHz, MCLK=256*Fs
SgtlRegWrite(SGTL5000_CHIP_I2S_CTRL, 0x01B0); // 16-bit, Master, SCLK = 32Fs,
SgtlRegWrite(SGTL5000_CHIP_SSS_CTRL, 0x0010); // I2S_IN->DAC, ADC->I2S_OUT


SgtlRegWrite(SGTL5000_CHIP_ADCDAC_CTRL, 0x0000);
SgtlRegWrite(SGTL5000_CHIP_DAC_VOL, 0x3C3C); // 0dB for both channels
SgtlRegWrite(SGTL5000_CHIP_ANA_HP_CTRL, 0x0C0C); // 0dB volume in both HP channels

SgtlRegWrite(SGTL5000_CHIP_ANA_ADC_CTRL, 0x0000); // No loss in ADC volume
SgtlRegWrite(SGTL5000_CHIP_MIC_CTRL, 0x0170); // MIC BIAS output impedance 2kOhm, BiasV = 3V, ampli gain = +0dB
SgtlRegWrite(SGTL5000_CHIP_CLK_TOP_CTRL, 0x0000); // Disable the internal osc
SgtlRegWrite(SGTL5000_DAP_CTRL, 0x0000); // Disable DAP
}
 
i don't know much about microelectronics, but maybe you need to check your 'analog' setup .... does the mic require phantom power? what is the load it is presenting? is there an impendance mismatch?... maybe you need a preamp for the mic, and then use the stgl linein? are you picking up rf? do you need to think about balancing your cable run / differential signalling CMMR type stuff. You'd be surprised by how much noise can get into a 'mic to input' setup ...everything from 50hz hum to radio frequencies ... I had a washing machine plugged in 50 yeards away from my mixer once (don't ask why), and i swear it put noise all over my recordings through the powerlines!!! Couldn't hear it in the recording booth, but it was everywhere on the mixer channels. And don't even start with how noisy usb is!! sheesh.

Noise is everywhere. BAH!
 
Last edited:
How much noise? Do you have a Teensy for comparison with the audio lib?

If I "mask" the 5 LSBs the noise goes away, if this helps. I zero all values from -32 to +31 but then my audio input sounds artificial.

I have ordered a Teensy 3.0 as well (did not do so earlier, thinking it should be a simple plug and play for such a widely used chip.... ) and expect to get it my Tuesday so will update then as well.

I tried adding a 0.1uF to the MIC input assuming some stray input may get shorted to 0. My Teensy Audio boards were purchased through Sparkfun.

Thanks,
 
One huge source of noise in my setup seemed to be related to the digital HP filter used by the ADC. If you disable the filter, a lot of nasty-sounding noise goes away. I learned about this solution from this post:

https://forum.pjrc.com/threads/27215-24-bit-audio-boards?p=78831&viewfull=1#post78831

For those of us using the Teensy Audio Library, you can disable this filter by issuing this command: audioShield.adcHighPassFilterDisable();

if you're not using the Teensy Audio Library, you'll have to dig into the Audio Library's code, especially control_SGTL5000.cpp to see what's going on.

I see this:

Code:
unsigned short AudioControlSGTL5000::adcHighPassFilterDisable(void)
{
	return modify(CHIP_ADCDAC_CTRL, 1, 3);
}

where CHIP_ADCDAC_CTRL is 0x00E, and where "modify" is:

Code:
unsigned int AudioControlSGTL5000::modify(unsigned int reg, unsigned int val, unsigned int iMask)
{
	unsigned int val1 = (read(reg)&(~iMask))|val;
	if(!write(reg,val1)) return 0;
	return val1;
}


Hopefully this helps!

Chip
 
Status
Not open for further replies.
Back
Top