SGTL5000 I2S word length issue

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

SGTL5000 I2S word length issue

1,156 Views
victorien
Contributor IV

Hi,

I'm trying to use SGTL5000 codec with a CC2511 micro-controller. The I2C and I2S bus work well but I have an issue when I want to change the word length of I2S data (bits DLEN of CHIP_I2S_CTRL register). I configure the register to have 16 bits word length but when I check DOUT, I always see 24 bits of data.

Is there someone who have a solution ?

The initialization code is this one :

//Power Up
CHECK_ERROR(Codec_WriteRegister(CODEC_CHIP_LINREG_CTRL, 0x0008 ));

CHECK_ERROR(Codec_WriteRegister(CODEC_CHIP_ANA_POWER, 0x7260 ));

CHECK_ERROR(Codec_WriteRegister(CODEC_CHIP_CLK_TOP_CTRL, 0x0800 ));

CHECK_ERROR(Codec_WriteRegister(CODEC_CHIP_ANA_POWER, 0x7A60 ));

CHECK_ERROR(Codec_WriteRegister(CODEC_CHIP_LINREG_CTRL, 0x006C ));

CHECK_ERROR(Codec_WriteRegister(CODEC_CHIP_REF_CTRL, 0x004E ));

CHECK_ERROR(Codec_WriteRegister(CODEC_CHIP_LINE_OUT_CTRL, 0x0322 ));

CHECK_ERROR(Codec_WriteRegister(CODEC_CHIP_REF_CTRL, 0x004F ));

CHECK_ERROR(Codec_WriteRegister(CODEC_CHIP_SHORT_CTRL, 0x1106 ));

CHECK_ERROR(Codec_WriteRegister(CODEC_CHIP_ANA_CTRL, 0x0133 ));

CHECK_ERROR(Codec_WriteRegister(CODEC_CHIP_ANA_POWER, 0x7AFF ));

CHECK_ERROR(Codec_WriteRegister(CODEC_CHIP_DIG_POWER, 0x0073 ));

CHECK_ERROR(Codec_WriteRegister(CODEC_CHIP_LINE_OUT_VOL, 0x0505 ));

//Config I2S
//lrclk = mclk / MCLK_FREQ * RATE_MODE
//bclk = lrclk * SCLKFREQ

CHECK_ERROR(Codec_WriteRegister(CODEC_CHIP_CLK_CTRL, 0x0038 ));
CHECK_ERROR(Codec_WriteRegister(CODEC_CHIP_I2S_CTRL, 0x00B0 ));

//config entrée/sortie
CHECK_ERROR(Codec_WriteRegister(CODEC_CHIP_SSS_CTRL, 0x0010 ));

CHECK_ERROR(Codec_WriteRegister(CODEC_CHIP_ANA_CTRL, 0x0115 ));

//volume control
CHECK_ERROR(Codec_WriteRegister(CODEC_CHIP_ANA_ADC_CTRL, 0x0000 ));

CHECK_ERROR(Codec_WriteRegister(CODEC_CHIP_MIC_CTRL, 0x0001 ));

CHECK_ERROR(Codec_WriteRegister(CODEC_CHIP_ANA_HP_CTRL, 0x0101 ));

CHECK_ERROR(Codec_WriteRegister(CODEC_CHIP_ANA_CTRL, 0x0101 ));

CHECK_ERROR(Codec_WriteRegister(CODEC_CHIP_DAC_VOL, 0x3C3C ));

CHECK_ERROR(Codec_WriteRegister(CODEC_CHIP_ADCDAC_CTRL, 0x0200 ));

CHECK_ERROR(Codec_WriteRegister(CODEC_CHIP_ANA_CTRL, 0x0104 ));

Regards

Tags (3)
0 Kudos
4 Replies

884 Views
reyes
NXP TechSupport
NXP TechSupport

Hi,

Problem seems to be with the SYS_FS configuration on the CHIP_CLK_CTRL register, the selection on this bits needs to be multiple of the MCLK_FREQ selection, so, you currently have a SYS_FS selection of 48 kHz and a MCLK_FREQ selection of 256 which are not multiple (256/48=5.33), I recommend you to change the SYS_FS value to 32 kHz to make it multiple (256/32 = 8) and test if this solve the problem you are seen with the change of the word length of I2S data.


Have a great day,
Jose

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

884 Views
pascaline
Contributor I

Hi,

I'm using SGTL5000 codec and I have the same word length issue. I tried to configure CHIP_I2S_CTRL register to have 16 bits word length but I always have 24 bits. I also tried to change SYS_FS as you mentioned it in your answer, but it didn't work. 

Here is the initialisation code I am using : 

STGL5000_WriteReg(SGTL5000_CHIP_ANA_POWER, 0x4260);
STGL5000_WriteReg(SGTL5000_CHIP_LINREG_CTRL, 0x006C);
STGL5000_WriteReg(SGTL5000_CHIP_REF_CTRL, 0x01FF);
STGL5000_WriteReg(SGTL5000_CHIP_LINE_OUT_CTRL, 0x0322);
STGL5000_WriteReg(SGTL5000_CHIP_ANA_POWER, 0x40EB);
STGL5000_WriteReg(SGTL5000_CHIP_DIG_POWER, 0x73);

STGL5000_WriteReg(SGTL5000_CHIP_CLK_CTRL, 0x04);

STGL5000_WriteReg(SGTL5000_CHIP_I2S_CTRL, 0x0030);

STGL5000_WriteReg(SGTL5000_CHIP_SSS_CTRL, 0);
STGL5000_WriteReg(SGTL5000_CHIP_LINE_OUT_CTRL, 0x23);
STGL5000_WriteReg(SGTL5000_CHIP_ANA_ADC_CTRL, 0x0122);


STGL5000_WriteReg(SGTL5000_CHIP_DAC_VOL, 0x3C3C);
STGL5000_WriteReg(SGTL5000_CHIP_LINE_OUT_VOL, 0x0F0F);
STGL5000_WriteReg(SGTL5000_CHIP_ADCDAC_CTRL, 0x0200);
STGL5000_WriteReg(SGTL5000_CHIP_ANA_CTRL, 0x0C);

Do you see what I should change?

Thank you,
Regards

0 Kudos

884 Views
reyes
NXP TechSupport
NXP TechSupport

Hi,

I2S data length is modified by DLEN bits (5:4) in the CHIP_I2S_CRTL 0x0006 Register, DLEN should be 0x3 to operate with I2S data length of 16 bit.

If this is already configured and you still do not see the I2S data length of 16 bit, there could be a problem with the device.


Have a great day,
Jose

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

884 Views
pascaline
Contributor I

Hi,
Thank you for your quick answer.

I already configure the CHIP_I2S_CTRL register in my code with the line "STGL5000_WriteReg(SGTL5000_CHIP_I2S_CTRL, 0x0030);". It should write 0x3 in DLEN bits. I also tried to change I2S data length with other value, like 32 bits or 20 bits, but nothing change, I still see 24 bits. However, I noticed that if I modify I2S_MODE to set Right Justify Mode, I finally have I2S data lenght of 16 bits. I don't understand why I it doesn't work in I2S Mode.

Regards,
Pascaline

0 Kudos