Post Go back to editing

Change sample rate on board EVAL ADAU1452 REVBZ AD1938 to 96Khz

Category: Software
Product Number: ADAU1452 AND AD1938, ADAU1452 , ADAU1452
Software Version: SIGMA STUDIO 4.7

I am trying to change the sample rate from 48khz to 96khz, i use CODEC AD1938 on EVAL ADAU1452, it was working at sample rate 48khz stand alone mode, reading pdf EVAL-ADAU1452REVBZ-UG-1662 i made modifications to the board according instructions (page 26 to 33).

After doing the rework on EVAL ADUSB2Z board and  on EVAL ADA1452 this i was able to read setting on CODEC AD1938, i assume this means the fix is allowing communication between sigma studio and AD1938.

I have read  RE: Different sample rates , tried it and didn't work 

I followed these instructions, it didn't work for me.  Changing the Hardware sample rate on EVAL-ADAU1452REVBZ  

On the next link i couldn't find ADAU1452, https://ez.analog.com/dsp/sigmadsp/w/documents/5214/how-do-i-change-the-sample-rate-of-my-sigmastudio-system, so i only followed partial (setting fs and all the object to 96khz).

After trying to set to 96khz i tried to set to 48khz, its not working, please share more information and schematic connection, maybe its not only software my problem.

TEST AD1938 SAMPLE RATE CHANGE.dspproj

  • Hello Leithor,

    The instructions in the user guide are for having SigmaStudio control the codec not the DSP. I think I mention it in there somewhere that you could modify it so the DSP could boot up the codec but that complicate the program a little. 

    So you should be able to read the settings of the codec and do something like mute the ADC or the DACs from the register settings and the codec will follow. Or change the clock setting and see the clock conflict with the DSP or some other reaction. However, since you can read data it looks like that is all working great.

    I will attach the actual program I used when I wrote the user guide. So this was tested and worked when I did the mod and took the pictures. Some of the other posts you read explain about setting up the sampling rate in SigmaStudio and there are a few details to take care of. Test this first and then we can look at your project once we know the hardware is working properly. 

    I did not look at your project. I noticed your post when I went onto my computer for something else. It is 8PM here on the east coast. :) So try this project and see what happens. 

    Dave T

    Basic Test Project with Codec at 96kHz I2S.dspproj

  • Hello Dave, Sorry to interrupt.

    I'm currently working on a 96KHz project, so I thought I could share the project and settings quickly.

    Hi Leithor,

    This is applicable if all the modifications for controlling the codec mentioned in ADAU1452 user guide were done. please refer the below settings.

    DSP as Master and CODEC as slave. please look below.

    ADC as Master and serial input port as slave and serial output port as master and DAC as slave. please look at the below settings.

    Please look at the ADC's LRCLK out:

    If you want to put the board in standalone mode (if slave), then you have to ground the SPI pins. Please look below.

    project_at_96KHz.dspproj

    Regards,

    Harish

  • Thank you so much Harish, this information solved the configuration issue with the CODEC AD1938

  • Hello Harish, i am trying to download the program to EEPROM and have it work as a standalone (all of this in to the EVAL1452 board), attached is the test programproject_at_96KHz eeprom.dspproj

    I "download the firmware" to the E2Prom , no error during download from SStudio, but when i check if the program is correctly downloaded i receiver an error (mismatch).

    I did test if it starts up in Selfboot mode (all SPI pins on AD1938 to GND), it doesn't, don't know what went wrong with trying to move to 96khz the sample rate, please advice

    Regards

  • Hello Leithor,

    Let me clarify a few things.

    i am trying to download the program to EEPROM and have it work as a standalone (all of this in to the EVAL1452 board), attached is the test program

    If you try putting the CODEC in standalone mode which is at 48KHz, but if your project is at 96KHz (Core, serial ports clocks) then the DAC will mute.

    So, the project should be at 48KHz if the codec is at 48KHz (standalone).

    Let me share what I have done, and I will show my modified board. I have a ADAU1466Z but hardware wise it's just the same as ADAU1452 eval board.

    Also, if you ground the SPI pins of the CODEC (DSP is also connected in the bus), so you will not be able to program/control the DSP from USBi if you ground the SPI pins.

    Here is the thing that I did to self-boot from EEPROM and put the Codec in standalone mode.

    Initially don't ground the SPI pins.

    1. prepare your program and add EEPROM into your schematics, connect the USBi to the bus and Link compile download the program. Then write the program to the EEPROM by using 'write latest compilation thru DSP'. Since the program is downloaded into the EEPROM, now you don't want the USBi communication from SS (OfCourse unless you don't need to control in real time or readback values)

    2. Ground the SPI pins, power up the board and trigger the self-boot and hit reset.

    Below is the grounding of my board.

    Now you can see that the DSP is self-booted from EEPROM, and the program is running in the DSP and codec is at 48KHz and the audio is playing out.

    You can remove the jumpers now from the ground.

    I did test if it starts up in Selfboot mode (all SPI pins on AD1938 to GND), it doesn't,

    You have to make sure that if the program is written to the EEPROM, if you had your SPI pins connected to ground at the start then your USBi communication wouldn't have worked, since it can't communicate to the DSP, there is no way the EEPROM is written from the DSP.

    Also remember that you can't run the core and sport at 96KHz and run the codec at 48KHz. The DAC will be muted.

    Regards,

    Harish

  • Hello Harish thank you for the quick reply

    Now the program did download to the EEprom, I verified it was successful the download. 

    I am still stuck on how to solve my problem. Want the AD1938 running at 96khz in selfboot mode, its not working. When i have the USBi connected and SPI running it does work, so please explain how do i make it work in stand alone mode in the EVAL1452 board (96khz), is there a different hardware connection for the AD1938?

  • Hello Leithor,

    Just I'm kindly reminding you that there is no direct connection between the EEPROM and USBi. The USBi writes the self-boot program via the DSP.

    Let me share what I tried. It seems like there is a way to put the CODEC at 96KHz after self-boot from EEPROM.

    I have used this boot time master control port, please refer the wiki here. The data transmission will take place before the actual program starts. It will program the respective IC before audio processing in the DSP starts.

    The idea is to program the CODEC from the master control port, this block uses the XML file for programming the external IC.

    Note that the EEPROM is also connected in the master control port SPI bus, the DSP will only use the main latch (SS_M/MP0) to self-boot from the EEPROM. So, we have to use any MP pin as the slave select. Here I have chosen MP13/LRCLK_IN3.

    So, I prepared passthrough project and add this startup boot module and config the parameters respectively. 

    I have taken out the master control port pins, you can see that in my eval board next to reset button.

    prepare your audio processing program (schematic) and add the startup boot module and config the parameters like below.

    1) Prepare your project, add EEPROM in it, now adding AD193x IC is not necessary since we are not directly controlling it from the USBi. we are going to program it from the DSP but the only limitation is that it can't be controlled in real time.

    Initially don't connect anything in the codec SPI pins.

    2) Now write the program to the EEPROM by using 'write latest compilation thru DSP' command. Make sure that the self-boot switch is turned OFF.

    once the self-boot program is written to the EEPROM successfully, now disconnect the USBi and power.

    Connect the jumpers between the master control port and CODEC like in the below images. I have added couple of pictures for your reference. 

    After the connection is done, power up the board and turn ON the self-boot switch and hit reset. Here my board is running my 96KHz project without a problem.

    I configured the project for 96KHz (core and serial ports), I have measured the LRCLK to check that. Here it shows it's 96kHz.

    I have added a couple of pictures of my board for your reference.

    I will also attach my project and xml file below.

    96KHz_project_startupboot_codec.zip

    So now, if you trigger the self-boot then the project and codec will run at 96KHz.

    Kindly let me know if I have missed anything here.

    Regards,

    Harish

  • Hello Harish

    Thank you for the support, it is booting up, but its at 48khz. See pictures bellow of my eval board 1452 and osciloscope LRCLK.

    So the good thing its that its in self boot mode, the bad news is that its not on 96khz yet.

    Bellow is my project, i needed to change the DSP to ADAU1452.96KHz_project_startupboot_codec ADAU1452.dspproj

    and the XML file loaded is the one you shared me 

    <?xml version="1.0" standalone="no"?>
    <ROM IC="AD193x" IC_Address="8" Address_byte_length="1">
      <dateTime>2018-01-24T15:53:18.9331122Z</dateTime>
      <version>3.16.4.1751</version>
      <page modetype="Mode 0">
        <action instr="writeXbytes" len="2" addr="4" ParamName="IC 1.DacCtrl2Register" DspName="IC 1">41</action>
        <action instr="writeXbytes" len="2" addr="0" ParamName="IC 1.HWConfiguration.PllCtrl0Register" DspName="IC 1">80</action>
        <action instr="writeXbytes" len="2" addr="1" ParamName="IC 1.HWConfiguration.PllCtrl1Register" DspName="IC 1">00</action> 
        <action instr="writeXbytes" len="2" addr="2" ParamName="IC 1.HWConfiguration.DacCtrl0Register" DspName="IC 1">02</action>
        <action instr="writeXbytes" len="2" addr="3" ParamName="IC 1.HWConfiguration.DacCtrl1Register" DspName="IC 1">00</action>
        <action instr="writeXbytes" len="2" addr="4" ParamName="IC 1.HWConfiguration.DacCtrl2Register" DspName="IC 1">41</action>
        <action instr="writeXbytes" len="2" addr="5" ParamName="IC 1.HWConfiguration.DacMutesRegister" DspName="IC 1">00</action>
        <action instr="writeXbytes" len="2" addr="6" ParamName="IC 1.HWConfiguration.DacVolumeRegistes0" DspName="IC 1">00</action>
        <action instr="writeXbytes" len="2" addr="7" ParamName="IC 1.HWConfiguration.DacVolumeRegistes1" DspName="IC 1">00</action>
        <action instr="writeXbytes" len="2" addr="8" ParamName="IC 1.HWConfiguration.DacVolumeRegistes2" DspName="IC 1">00</action>
        <action instr="writeXbytes" len="2" addr="9" ParamName="IC 1.HWConfiguration.DacVolumeRegistes3" DspName="IC 1">00</action>
        <action instr="writeXbytes" len="2" addr="10" ParamName="IC 1.HWConfiguration.DacVolumeRegistes4" DspName="IC 1">00</action>
        <action instr="writeXbytes" len="2" addr="11" ParamName="IC 1.HWConfiguration.DacVolumeRegistes5" DspName="IC 1">00</action>
        <action instr="writeXbytes" len="2" addr="12" ParamName="IC 1.HWConfiguration.DacVolumeRegistes6" DspName="IC 1">00</action>
        <action instr="writeXbytes" len="2" addr="13" ParamName="IC 1.HWConfiguration.DacVolumeRegistes7" DspName="IC 1">00</action>
        <action instr="writeXbytes" len="2" addr="14" ParamName="IC 1.HWConfiguration.AdcCtrl0Register" DspName="IC 1">40</action>
        <action instr="writeXbytes" len="2" addr="15" ParamName="IC 1.HWConfiguration.AdcCtrl1Register" DspName="IC 1">00</action>
        <action instr="writeXbytes" len="2" addr="16" ParamName="IC 1.HWConfiguration.AdcCtrl2Register" DspName="IC 1">00</action>
        <action instr="writeXbytes" len="2" addr="4" ParamName="IC 1.HWConfiguration.DacCtrl2Register" DspName="IC 1">40</action>
      </page>
    </ROM>

     Not sure if i need to change the XML or in the ADAU1452 register controls.

    Maybe i need to setup something in Clock control or Core Control.

    Please let me know

  • Hello Leithor,

    I can see the problem here. Your project is still at 48KHz.

    Let me share a few things about the sample rate system.

    I can see that you changed the fs at the top of Sigma Studio to 96KHz but that doesn't actually change the core sample rate. It's a software sample rate that Sigma Studio uses for calculating filter coefficients, compressors, timers and anything that needs timing. It's a timing reference for sigma studio to compile the project in an intended sample rate. This sample rate also should be the same as the core, otherwise filter curves and other timing related calculations will be wrong

    The 'startpulse' is the register that tells the sample rate of the core, it's an interrupt which tells the core to start processing the new sample. The startpulse can be set to internal clock generators, serial input/output port LRCLK, SPDIF incoming rate etc. It all depends on your application. By default, it will be the internal CGs.

    Then serial input and output port sample rate that you can find in the serial port registers. All must be a same rate, so that it will make sense in our system.

    Please refer this thread, you will have an idea about the sample rate system of sigmaDSP.

    Coming back to your issue, you didn't change the registers. The CG1 is set for 48KHz and the startpulse and serial ports are set to CG1, hence you are seeing 48KHz clock.

    You have to change the CG1's register like below. set it for N/M = 1/3.

    Let the startpulse be 'as is', which means Base_Fs like below (you don't need to change that)

    You don't need to change the serial port clocks as well, let it be for the default setting. which is CG1 and Fs.

    I will modify the project and attach it here, please try running that.

    And a thing to note here is that, For testing purposes, you can directly run my ADAU1466 project in your ADAU1452 Eval board.

    Both are pin, registers and algorithm compatible and has the same DSP power. The ADAU1466 has more memory than the ADAU1452 and SPDIF can go up to 192KHz whereas the ADAU1452 is limited to 96KHz SPDIF. 

    So, my ADAU1466 project will run in your your eval board without a problem. Once everything is fine then you can migrate your project to ADAU1452, anyway. I will attach the modified program here for your reference.

    I set the codec to be a serial clock slave, so the DSP is the master. Hope you will be okay with it. if you want to change that then you can edit the register's value in the XML file.

    96KHz_project_startupboot_codec ADAU1452_mod.dspproj

    Note that I haven't run or tested this modified project, I just changed the register and attached. I hope it will work as intended, if not, then try running my old project of ADAU1466, it was tested.

    I will test the ADAU1452 project and share it with you on Monday (if the attached project doesn't work as intended)

    Regards,

    Harish

  • Thank you, finally working on EVAL1452 board, now i will move on designing my own board, thanks again