SGTL5000 Lineout Volume Low Output

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SGTL5000 Lineout Volume Low Output

Jump to solution
2,786 Views
samxt
Contributor II

Hello, I'm attempting to use the SGTL5000 on a Teensy audio adapter board (https://www.pjrc.com/store/teensy3_audio.html) to output audio from a STM32H723GT6 MCU.

The problem I'm having is, the Lineout Output volume is really low (70mV peak-to-peak). No matter how I configure the registers, I cannot change the amplitude of the output, nor can I seem to mute it via modifying any registers (besides powering it down via CHIP_ANA_POWER).

I can verify I2C is working since writing to a register and reading it back returns the value I set the register to; And also reading a register before writing to it returns it's default values as expected. I can also verify I2S is working directly since writing 0xFFFF and 0x0000 interchangeably with a delay produces a square waveform on an oscilloscope. The SGTL5000 is running in slave mode.

I've directly translated the commands for setting up the IC from the source code used on the Teensy audio breakout board (https://github.com/PaulStoffregen/Audio), and I also referenced the code in the SGTL5000's datasheet. I checked VDDD (2.4v), VDDA (3.3v), and VDDIO (3.3v) and followed the I2C initialization commands for those values as outlined in the datasheet.

I am using relatively long wires for the I2S and I2C, but based on issues that come up doing this, it shouldn't effect my problem (https://forum.pjrc.com/index.php?threads/just-noise-with-teensy-3-6-and-audio-adaptor-board.41157/).

I've also checked the rate of my SYS_MCLK and it is 256*Fs as expected. The fall and rise time seem to be a bit higher than the datasheet says it seems to be, but that might be a result of my oscilloscope being inaccurate.

Here is my source code, note SGTL5000_writeI2S is simply a wrapper for HAL_I2S_Transmit in the hardware abstraction library for the STM32 processor:

 

 

void STGL5000_Init(I2C_HandleTypeDef *hi2c, I2S_HandleTypeDef *hi2s){
	STGL5000_writeRegister(hi2c, SGTL5000_CHIP_ANA_POWER_REG, 0x4060);
	STGL5000_writeRegister(hi2c, SGTL5000_CHIP_LINREG_CTRL_REG, 0x006C);
	STGL5000_writeRegister(hi2c, SGTL5000_CHIP_REF_CTRL_REG, 0x01F2);
	STGL5000_writeRegister(hi2c, SGTL5000_CHIP_LINE_OUT_CTRL_REG, 0x0F22);
	STGL5000_writeRegister(hi2c, SGTL5000_CHIP_SHORT_CTRL_REG, 0x4446);
	STGL5000_writeRegister(hi2c, SGTL5000_CHIP_ANA_CTRL_REG, 0x0071);

	//Slave mode stuff
	STGL5000_writeRegister(hi2c, SGTL5000_CHIP_ANA_POWER_REG, 0x00AD);

	// Power up Digital stuff
	STGL5000_writeRegister(hi2c, SGTL5000_CHIP_DIG_POWER_REG, 0x0021);
	HAL_Delay(400);
	STGL5000_writeRegister(hi2c, SGTL5000_CHIP_LINE_OUT_VOL_REG, 0x001D); // set to 1.3 Vpp

	// assuming slave
	STGL5000_writeRegister(hi2c, SGTL5000_CHIP_CLK_CTRL_REG, 0x0004);
	STGL5000_writeRegister(hi2c, SGTL5000_CHIP_I2S_CTRL_REG,  0x0030);

	// routing
	STGL5000_writeRegister(hi2c, SGTL5000_CHIP_SSS_CTRL_REG, 0x0010);
	STGL5000_writeRegister(hi2c, SGTL5000_CHIP_ADCDAC_CTRL_REG, 0x0000); // disable DAC mute
	//STGL5000_writeRegister(hi2c, SGTL5000_CHIP_ADCDAC_CTRL_REG, 0x000C); // disable DAC mute
	STGL5000_writeRegister(hi2c, SGTL5000_CHIP_DAC_VOL_REG, 0xFC3C); // digital gain, 0dB
	STGL5000_writeRegister(hi2c, SGTL5000_CHIP_ANA_HP_CTRL_REG, 0x7F7F); // set volume (lowest lv)
	STGL5000_writeRegister(hi2c, SGTL5000_CHIP_ANA_CTRL_REG, 0x0077); // enable zero cross detectors

    HAL_StatusTypeDef test = HAL_I2S_Init(hi2s);
    int t = 0;
    uint16_t val = 0;
    while(1){
    	if (t)
    		STGL5000_writeI2S(hi2s, 0, 0xFFFF);
    	else
    		STGL5000_writeI2S(hi2s, 0, 0x0000);
		t = !t;
    	//STGL5000_writeI2S(hi2s, 0, adcValue);
        HAL_Delay(1);
    }

}

 

 

 

 

samxt_0-1726511128832.png

 

0 Kudos
Reply
1 Solution
2,692 Views
samxt
Contributor II

Update again:

We ended up attempting to direct the ADC directly to the DAC and it still did not work even after further troubleshooting with that. In the end we decided our best option to use an entirely different IC for audio in our project, I'm happy to say that particular IC we got fully functional in a few hours.

What was wrong with the SGTL5000, I do not know. Sorry for those who came looking for answers.

View solution in original post

0 Kudos
Reply
4 Replies
2,693 Views
samxt
Contributor II

Update again:

We ended up attempting to direct the ADC directly to the DAC and it still did not work even after further troubleshooting with that. In the end we decided our best option to use an entirely different IC for audio in our project, I'm happy to say that particular IC we got fully functional in a few hours.

What was wrong with the SGTL5000, I do not know. Sorry for those who came looking for answers.

0 Kudos
Reply
2,770 Views
samxt
Contributor II
Update: After testing, we concluded that the output seen in the lineout is actually residual interference from the I2S data line. This explains why changing the lineout and DAC registers doesn't appear to effect anything.
0 Kudos
Reply
1,434 Views
wwn
Contributor I
Hello, I apologize for consulting you under this post. I've encountered a similar issue. I haven't even configured the IC, yet the HP port is receiving the music that my MCU sends to the IC via I2S—though the volume is extremely low. Additionally, the registers aren't functioning as expected, and I've detected waveforms similar to those at the HP port on multiple lines, including the line-out. However, I'd like to figure out how this crosstalk is being introduced. Thank you for your reply.
0 Kudos
Reply
2,743 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello,

In teensy board the the lineout resiual interference from the I2S data line that;s why you see 70 Ohm.

 

Regards

0 Kudos
Reply