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.

TAS2557: Initialization - 22050Hz, 16bit.

Part Number: TAS2557

Hi!

I am using an integrated TAS2557 module and need som help with initialization and configuration. 

I want the module to act as a master on I2S with MCLK at 12MHz. to play 16bit audio at 22050Hz sample rate, mono.

I have used the TAS2557EVM board in order to generate a .cfg-file which i have written to our integrated module using SPI. You can find the configuration file attached.

I cant seem to get the circuit to act as a master and would really appreciate some help.

Best regards,

/Viktor

combined_configuration_0_ROMMode2_44.1KHz.cfg

  • Hi Viktor,

    Welcome to e2e.
    You can add the following commands at the end of your script. These commands will configure BCLK and WCLK as outputs, based on your sample rate configuration.

    w 98 00 00
    w 98 7f 00
    w 98 00 01
    w 98 01 00 # I2S // 16-bit
    w 98 0d 01 # BDIV input = DAC_MOD_CLK
    w 98 0e 82 # BDIV enabled and set to 2
    w 98 0f A0 # WDIV enabled and set to 32
    w 98 10 00 # ASI1 BCLK & WCLK from BDIV & WDIV
    w 98 3d 0d # GPIO1 (BCLK) output from ASI1_BCLK_OUT
    w 98 3e 0c # GPIO2 (WCLK) output from ASI1_WCLK_OUT

    I added this to the cfg you provided, the modified cfg is attached as well.
    You can try this on your test setup.

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

    5430.combined_configuration_0_ROMMode2_44.1KHz.cfg

  • Thank you Ivan!

    As i mentioned before I am configuring my device over SPI. While debugging the SPI-interface I noticed that the TAS2557 does not accept my register writings. 

    I'm trying to write to a register and then read the same register again in order to confirm my setup.

    i am writing the following:

    {REGISTER, VALUE}:

    {0x00, 0x00}, {0x7f, 0x00}, {0x00, 0x01}, {0x0f, 0x8f}

    Then i am reading the same register, but the module only returns 0xff or 0x00.

    So my question is, since the datasheet is lacking information regarding how to use SPI, do you have any further information on how i am supposed to read and write to registers in TAS2557 with SPI?

    Thank you in advance!

    /Viktor

  • Viktor,

    I just would like to verify the following: Did you removed jumper on J13/J48?
    SPI_SELECT pin must be pulled up to enable SPI interface.

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

    I apologize for my late response.
    I am not using the TAS2557EVM board on this implementation, I am using a breadboard constructed by our HW-team, and SPI_SELECT is pulled up to +3V3, 

    What is the MIN and MAX frequency on SPI SCL?
    And do you have any implementation examples for registration read/write using SPI?

    Thank you in advance!

    /Viktor

  • Hello Ivan!

    You can ignore my previous question regarding SPI-usage. I found another thread here on E2E with someone experiencing the same problem and his/hers solution worked for me aswell.

    The register needs to be shifted 1 bit to the left and the LSbit set to 1 for read and 0 for write. Also the TAS2557 module seems to be running on SPI mode 2. I could not find this information in the datasheet and I think you could save some other programmer a couple of hours of debugging if you include this information in the TAS2557 datasheet :)

    Although, I am still having some issues with the clocks and the module does not seem to generate anything on BCLK1 and WCLK1.
    I am the configuration file provided by you earlier, but rearranged as a struct, which is the following:

    static cfg_reg_t init_registers[] =
        {
        /* Power Down And Mute Begin */
        {0x00, 0x00}, {0xfe, 0x64}, {0x0e, 0x01}, {CFG_META_DELAY, 10}, {0xfe, 0x00}, {0x0e, 0x03}, 
        {0x00, 0x00}, {0xfe, 0x00}, {0x58, 0x00}, {0x00, 0x00}, {0xfe, 0x00}, {0x08, 0x60}, 
        {CFG_META_DELAY, 2}, {0x0A, 0x00}, {0x00, 0x00}, {0x08, 0x00}, 
        /* Power Down And Mute End */
        
        /* Software Reset Start */
        {0x00, 0x00}, {0xfe, 0x00}, {0x02, 0x01}, {CFG_META_DELAY, 10}, 
        /* Software Reset End */
        
        /* PLL Begin */
        {0x00, 0x00}, {0xfe, 0x00}, {0x00, 0x01}, {0xe6, 0x0f}, {0xe8, 0x0d}, {0x00 ,0x00}, 
        {0xfe ,0x64}, {0x36 ,0x01}, {0x38 ,0x03}, {0x3a ,0x1d}, {0x3c ,0xd0}, {0x40 ,0x02}, 
        {0x44 ,0x08}, {0x04 ,0x10}, {0x42 ,0x08}, {0x02 ,0x08}, {0x56 ,0x00}, {0x58 ,0x40}, 
        {0x3e ,0x20}, {0x15 ,0x00}, 
        /* PLL End */
        
        /* Program Begin */
        {0x00 ,0x00}, {0xfe ,0x00}, {0x00 ,0xfd}, {0x1a ,0x0d}, {0x00 ,0xfe}, {0x50 ,0x00}, 
        {0x00 ,0x00}, {0x10 ,0x02}, {0x14 ,0x08}, {0x68 ,0x03}, {0x00 ,0x32}, {CFG_META_BURST, 5}, 
        {0x78, 0x3d}, {0x99, 0x99}, {0x9a, 0x00}, {CFG_META_BURST, 5}, {0xe0, 0x00}, {0x03, 0xde}, 
        {0x00, 0x00}, {CFG_META_BURST, 5}, {0xd0, 0x00}, {0x00, 0x00}, {0x00, 0x00}, {0x00, 0x33}, 
        {CFG_META_BURST, 5}, {0xc8, 0x39}, {0x80, 0x00}, {0x00, 0x00}, {0x00, 0x35}, {CFG_META_BURST, 5}, 
        {0x98, 0x00}, {0x00, 0x00}, {0x01, 0x00}, {0x00, 0x34}, {CFG_META_BURST, 5}, {0xd0, 0x00}, 
        {0x6a, 0xe2}, {0x36, 0x00}, {CFG_META_BURST, 5}, {0xd8, 0x00}, {0x6a, 0xe2}, {0x36, 0x00}, 
        {CFG_META_BURST, 5}, {0xe0, 0x7f}, {0x2a, 0x3b}, {0x94, 0x00}, {0x00, 0x00}, {0x44, 0x02}, 
        {0x00, 0x00}, {0xfe, 0x82}, {0x00, 0x19}, {CFG_META_BURST, 5}, {0x70, 0xd1}, {0x50, 0x00}, 
        {0x10, 0x00}, {0x00, 0x00}, {0xfe, 0x00}, {0x00, 0x32}, {CFG_META_BURST, 13}, {0x78, 0x3d}, 
        {0x99, 0x99}, {0x9a, 0x30}, {0x00, 0x00}, {0x00, 0x50}, {0x00, 0x00}, {0x00, 0x00}, 
        {CFG_META_BURST, 5}, {0x98, 0x02}, {0x00, 0x00}, {0x00, 0x00}, {CFG_META_BURST, 5}, {0xc0, 0x28}, 
        {0x00, 0x00}, {0x00, 0x00}, {0x00, 0x33}, {CFG_META_BURST, 5}, {0x80, 0x00}, {0x00, 0x01}, 
        {0x00, 0x00}, {CFG_META_BURST, 5}, {0xc8, 0x39}, {0x80, 0x00}, {0x00, 0x00}, {0x00, 0x00}, 
        {0x0c, 0x74}, {0x56, 0x03}, {0x54, 0x00}, {0x00, 0x00}, {0xfe, 0x64}, {0x50, 0x80}, 
        {0x00, 0x00}, {0xfe, 0x00}, {0x10, 0x02}, {0x00, 0x33}, {CFG_META_BURST, 9}, {0x20, 0x73}, 
        {0x33, 0x33}, {0x33, 0x6b}, {0x85, 0x1e}, {0xb8, 0x00}, {CFG_META_BURST, 33}, {0x40, 0x1d}, 
        {0x99, 0x99}, {0x99, 0x20}, {0xcc, 0xcc}, {0xcc, 0x24}, {0x00, 0x00}, {0x00, 0x27}, 
        {0x33, 0x33}, {0x33, 0x2a}, {0x66, 0x66}, {0x66, 0x2d}, {0x99, 0x99}, {0x99, 0x30}, 
        {0xcc, 0xcc}, {0xcc, 0x34}, {0x00, 0x00}, {0x00, 0x00}, 
        /* Program End */
        
        /* PRE Begin*/
        {0x00, 0x00}, {0xfe, 0x00}, {0x5e, 0x2a}, {0x5a, 0x17}, {0x00, 0x02}, {0x0c, 0x11}, 
        {0x00, 0x32}, {CFG_META_BURST, 9}, {0xa8, 0x00}, {0x94, 0x45}, {0x70, 0x00}, {0x07, 0x6d}, 
        {0xf7, 0x00}, 
        /* PRE End */
    
        /* Configuration Begin */
        {0x00, 0x00}, {0xfe, 0x00}, {0x0a, 0xa0}, {0x0a, 0xa3}, {0x08, 0xfa}, {0x00, 0x00}, 
        {0xfe, 0x00}, {0x0a, 0xa0}, {0x0a, 0xa3}, {0x08, 0xfa}, {CFG_META_DELAY, 2}, {0x00, 0x00},
        {0xfe, 0x00}, {0x5a, 0x21}, {0x5c, 0x21}, {0x58, 0x0b}, 
        /* Configuration End */
        
        /* Power Up And Unmute Begin */
        {CFG_META_DELAY, 2}, {0x00, 0x00}, {0xfe, 0x00}, {0x0e, 0x00}, {0xfe, 0x64}, {0x0e, 0x00},
        /* Power Up And Unmute End */
        
        /* Set TAS2557 as master and configure BCLK & WCLK */
        {0x00, 0x00}, /* Page 0 */
        {0xfe, 0x00}, /* Book 0 */
        {0x00, 0x01}, /* Page 1 */
        {0x02, 0x00}, /* I2S, 16bit */
        {0x1a, 0x01}, /* BDIV input = DAC_MOD_CLK */
        {0x1c, 0x82}, /* BDIV enabled and set to 2 */
        {0x1e, 0xa0}, /* WDIV enabled and set to 32 */
        {0x20, 0x00}, /* ASI1 BCLK & WCLK from BDIV & WDIV */
        {0x7a, 0x0d}, /* GPIO1 (BCLK) output from ASI1_BCLK_OUT */
        {0x7c, 0x0c}  /* GPIO2 (WCLK) output from ASI1_WCLK_OUT */
        };

    Am i doing something wrong with the initialization?

    Thank you!
    /Viktor

  • Hi Viktor,

    Can you move the BCLK and WCLK config commands I sent you, before Power Up and Unmute? I'd like to try this just in case.
    I'll review the rest of the settings to verify it is good. It may take some time as these are several register writings.

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

    I tried your suggestion, but unfortunately without any improvements.
    I am open for suggestions if you have any other configuration files to write at startup. Im only really interesting to get some sound going at the moment. All these register writings are copied from the EVM development kit. There is definitely a possibility that I have gotten some configurations wrong. But according to the datasheet of this module, it suggests that you generate a .cfg-file from PPC3.

    Of course, I understand!

    Thank you for your help!
    /Viktor

  • Viktor,

    I noticed that you took the .cfg generated from PPC3 and adjust it to SPI on your previous comment. It looks correct.
    However at the beginning of this thread you mention 22050Hz sample rate. Are you using this WCLK frequency?
    This sample rate is not currently supported through PPC3 cfg generator, and the script you're using is based on 44.1kHz sample rate. Have you tried to set the I2S master on this sample rate to test if audio is correct?

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

    I just now noticed an error in my code. Due to the register shift, the definitions of CFG_META_DELAY and CFG_META_BURST turned out to be the same value as some registers and the writing became all wrong. 
    Both BCLK and WCLK are now working properly. 

    I have tried playing a 3kHz sound and it appears to sound right!

    Thank your for your support Ivan.

    Best regards, 
    /Viktor