This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TAS2521: TAS2521 Period Tick in the audio output

Part Number: TAS2521

I am using TAS2521 DAC with my host microcontroller for the purpose of USB speaker. The host controller sends audio signals to TAS2521 DAC over I2S. Following are the properties.

1) No of channels : 1 (Mono)
2) Bits per sample: 16 
3) Sampling Frequency : 44100 Hz
4) I2S MCLK  : 5.6MHz or 11.28MHz
Test input:  Sine tone 
Host runs mono mode of I2S on Left Channel
My host controller supports following I2S padding modes and accordingly it generates different I2S MCLK.
1) Normal Padding Mode. 
    Under this mode, controller seeks 32 bit for a single channel sample. However, since we use 16 bit only for a single channel sample, this 16 bit sample shall be on the MSB of 32 bit I2S Sample and the LSB of same shall be padded with  zeroes. In this mode, the I2S MCLK will be 11.28 MHz.
Thus, the signal will be like below. Square bracket denotes 32 bit I2S sample as taken by controller in this mode. L and R are 16 bit samples each.
     [ L  0x0000 ], [ R  0x0000 ], [ L  0x0000 ], [ R  0x0000 ],  ....
2) Continuous Padding Mode
    Under this mode, the controller seeks 16 bit only for a single channel sample. Thus there is no zero padding needed. The left and right samples are adjacent. The I2S MCLK generated will be 5.6MHz.
 The signal will be like below .  L and R are 16 bit samples each and square bracket denotes 16 bit sample as taken by controller in this mode. 
  [ L ] , [ R ] , [ L ] , [ R ], ...
With Continuous padding mode, and attached DAC settings. I tried playing sine tone of 500 Hz. I am able to get good audio output. But I hear a click sound coming every 1 second. The attached audio file gives more details about this. 
However, I am not hearing this click sound for 1 kHz, 2 kHZ, 3 kHz and so on. 
With Normal padding mode there is no click sound at all for any sine tone frequencies. But, I am hearing a slight background noise along with that. 
Questions
1) Are the attached settings correct for the signal I explained above?
2) With your EVM, did you observe similar issues while playing sine tone of different frequencies?
tas2521_settings.txt
CyU3PReturnStatus_t KoGoi_Set_TAS2521RegisterData( uint8_t register_address, uint8_t write_data )
{
	//perform I2C Write 
}


/**
 * @brief Configures the TAS2521 for speaker mode.
 */
void configureTAS2521_Speaker()
{
	KoGoi_Set_TAS2521RegisterData(0x00,0x00);
	KoGoi_Set_TAS2521RegisterData(0x01,0x01);
	KoGoi_Set_TAS2521RegisterData(0x00,0x01);
	KoGoi_Set_TAS2521RegisterData(0x02,0x00);
	KoGoi_Set_TAS2521RegisterData(0x00,0x00);
	KoGoi_Set_TAS2521RegisterData(0x3C,0x01);
	KoGoi_Set_TAS2521RegisterData(0x04,0x00);
	KoGoi_Set_TAS2521RegisterData(0x1B,0x00);
	KoGoi_Set_TAS2521RegisterData(0x1C,0x00);
	KoGoi_Set_TAS2521RegisterData(0x0B,0x81);
	KoGoi_Set_TAS2521RegisterData(0x0C,0x82);
	KoGoi_Set_TAS2521RegisterData(0x0D,0x00);
	KoGoi_Set_TAS2521RegisterData(0x0E,0x80);
	KoGoi_Set_TAS2521RegisterData(0x3F,0xB0);
	KoGoi_Set_TAS2521RegisterData(0x40,0x04);
	KoGoi_Set_TAS2521RegisterData(0x41,0x00);
	KoGoi_Set_TAS2521RegisterData(0x00,0x01);
	KoGoi_Set_TAS2521RegisterData(0x01,0x10);
	KoGoi_Set_TAS2521RegisterData(0x0A,0x00);
	KoGoi_Set_TAS2521RegisterData(0x03,0x00);

	KoGoi_Set_TAS2521RegisterData(0x2E,0x00);
	KoGoi_Set_TAS2521RegisterData(0x30,0x10);
	KoGoi_Set_TAS2521RegisterData(0x52,0x00);
	KoGoi_Set_TAS2521RegisterData(0x2D,0x02);
}


/**
 * @brief Configures TAS2521 as headphone
 */
void configureTAS2521_HeadPhone()
{
	KoGoi_Set_TAS2521RegisterData(0x00,0x00);
	KoGoi_Set_TAS2521RegisterData(0x01,0x01);
	KoGoi_Set_TAS2521RegisterData(0x00,0x01);
	KoGoi_Set_TAS2521RegisterData(0x02,0x00);
	KoGoi_Set_TAS2521RegisterData(0x00,0x00);
	KoGoi_Set_TAS2521RegisterData(0x3C,0x01);
	KoGoi_Set_TAS2521RegisterData(0x04,0x00);
	KoGoi_Set_TAS2521RegisterData(0x1B,0x00);
	KoGoi_Set_TAS2521RegisterData(0x1C,0x00);
	KoGoi_Set_TAS2521RegisterData(0x0B,0x81);
	KoGoi_Set_TAS2521RegisterData(0x0C,0x82);
	KoGoi_Set_TAS2521RegisterData(0x0D,0x00);
	KoGoi_Set_TAS2521RegisterData(0x0E,0x80);
	KoGoi_Set_TAS2521RegisterData(0x3F,0xB0);
	KoGoi_Set_TAS2521RegisterData(0x40,0x04);
	KoGoi_Set_TAS2521RegisterData(0x41,0x00);
	KoGoi_Set_TAS2521RegisterData(0x00,0x01);
	KoGoi_Set_TAS2521RegisterData(0x01,0x10);
	KoGoi_Set_TAS2521RegisterData(0x0A,0x00);
	KoGoi_Set_TAS2521RegisterData(0x03,0x00);

	KoGoi_Set_TAS2521RegisterData(0x09,0x20);
	KoGoi_Set_TAS2521RegisterData(0x0c,0x04);
	KoGoi_Set_TAS2521RegisterData(0x10,0x00);
}
  • Hi Priyan,

    The settings you're using (default from EVM, I think) are optimized for a MCLK = 11.2896MHz, the current MCLK = 11.28MHz seems to be close enough for a good performance as the sampling frequency is obtained as follows: Fs = MCLK / (NDAC*MDAC*DOSR) = 11.28*10^6 / (1*2*128) = 44.0625kHz.
    (Note that MCLK = 11.2896MHz gives exactly Fs = 44.1kHz).

    For 5.6MHz perhaps you can use the marked values in the following figure, the values doesn't match exactly but hopefully it will work as it do for 11.28MHz and 11.2896MHz:


    Best regards,
    -Ivan Salazar
    Applications Engineer - Low Power Audio & Actuators

  • Hi Ivan,

    We were carrying out some associated experiments as well, that is why the delay for the reply. The above solution did not help me.

    I have done the following thing.

    My controller board is giving out I2S MCLK as 11.3578MHz and due to that, the sampling frequency falls as 44.365MHz. However, since my setup is an USB playback device, the USB side sampling rate is 44.1 kHz. With this setup, all I am hearing is the audio with background hissing noise. In this setup, there is no periodic click sound happening. The audio is quite ok but the mild hissing noise along with audio makes our test cases fail.

    Is it because of this sample rate mismatch?

    Are you hearing such a noise with the EVM?

    DAC settings are same as in my above post.
  • Hi Priyan,

    The EVM does not show noise during playback.
    For MCLK = 11.3578MHz you could try the following PLL values:
    PLL_P = 1
    PLL_R = 1
    PLL_J = 7
    PLL_D = 4550
    NDAC = 3
    MDAC = 5
    DOSR = 128

    Best regards,
    -Ivan Salazar
    Applications Engineer - Low Power Audio & Actuators
  • Hi Ivan,

    This one also did not help us. Please check whether the below I2C writes are correct for speaker for the values you mentioned.

        Syntax:  KoGoi_Set_TAS2521RegisterData( Register, Data)

        KoGoi_Set_TAS2521RegisterData(0x00,0x00);
        KoGoi_Set_TAS2521RegisterData(0x01,0x01);
        KoGoi_Set_TAS2521RegisterData(0x00,0x01);
        KoGoi_Set_TAS2521RegisterData(0x02,0x00);
        KoGoi_Set_TAS2521RegisterData(0x00,0x00);
        KoGoi_Set_TAS2521RegisterData(0x3C,0x01);

        KoGoi_Set_TAS2521RegisterData(0x04,0x03);
        KoGoi_Set_TAS2521RegisterData(0x05,0x91);
        KoGoi_Set_TAS2521RegisterData(0x06,0x07);
        KoGoi_Set_TAS2521RegisterData(0x04,0x03);

        KoGoi_Set_TAS2521RegisterData(0x1B,0x00);
        KoGoi_Set_TAS2521RegisterData(0x1C,0x00);

        KoGoi_Set_TAS2521RegisterData(0x07,0xC6);
        KoGoi_Set_TAS2521RegisterData(0x08,0x11);

        KoGoi_Set_TAS2521RegisterData(0x0B,0x83);
        KoGoi_Set_TAS2521RegisterData(0x0C,0x85);
        KoGoi_Set_TAS2521RegisterData(0x0D,0x00);
        KoGoi_Set_TAS2521RegisterData(0x0E,0x80);
        KoGoi_Set_TAS2521RegisterData(0x3F,0xB0);
        KoGoi_Set_TAS2521RegisterData(0x40,0x04);
        KoGoi_Set_TAS2521RegisterData(0x41,0x00);
        KoGoi_Set_TAS2521RegisterData(0x00,0x01);
        KoGoi_Set_TAS2521RegisterData(0x01,0x10);
        KoGoi_Set_TAS2521RegisterData(0x0A,0x00);
        KoGoi_Set_TAS2521RegisterData(0x03,0x00);

        KoGoi_Set_TAS2521RegisterData(0x2E,0x00);
        KoGoi_Set_TAS2521RegisterData(0x30,0x10);
        KoGoi_Set_TAS2521RegisterData(0x52,0x00);
        KoGoi_Set_TAS2521RegisterData(0x2D,0x02);

  • Priyan,

    These are reversed:
    KoGoi_Set_TAS2521RegisterData(0x07,0xC6);
    KoGoi_Set_TAS2521RegisterData(0x08,0x11);
    Should be:
    KoGoi_Set_TAS2521RegisterData(0x07,0x11);
    KoGoi_Set_TAS2521RegisterData(0x08,0xC6);

    Best regards,
    -Ivan Salazar
    Applications Engineer - Low Power Audio & Actuators