Post Go back to editing

ADAU1467 I2S OUTPUT in SLAVE_MODE

Category: Software
Product Number: ADA1467
Software Version: Sigma Studio 4.7 Rev 1831

Hello, 

I'm currently considering Adau1467 for an industrial project but I can not achieve I2S_slave output configuration with the ADA1467Z board.

 
I have an external MCU generating I2S clock as follow :

BCLK : 512kHz ---------->  connected to BCLKOUT_0
LRCLK :16kHz -----------> connected to LRCLK_OUT0

Then I try to generate simple SIN WAVE with ADA1467 and send it to SDATA0  AS A I2S :


When BLCK is in master_Mode, it works great. I can see I2S signal on SDATA_OUT0 pin.

When I put BLCK and LRCK in slave_MODE , I have no signal on  SDATA_OUT0 pin.

I think I am missing something but I can't get it.




My configuration for slave_MODE is :


Can you help me getting ADA1467 output working in slave_mode ?   Also, what does Slave_domain 0 / 1 / 2 / 3 refers to ? 
Thank you very much for your time and work. 

William

Parents
  • Hello William,

    Do you have some external device sending BCLK and LRCLK to the BLCKOUT_0 and LRCLKOUT_0 pins? 

    The domains 0/1/2/3...

    There are four sets of clock pins for the four serial ports. They are associated with the serial port names, 0/1/2/3. 

    So SDATAOUT_0, BCLKOUT_0 and LRCLKOUT_0 are all tied to serial port 0. 

    So if you connect some external device to send clocks to let's say. serial port 0. Then you set serial port 0 to slave from domain 0. So the data on SDATA0 pin will be clocked in from that external clock. 

    Then if you connect a second SDATA line from that same external device, then you connect it to SDATA1. Then set serial port 1 to slave to domain 0. Then they both will be clocked in from the same clocks coming in on serial port 0 clock pins. 

    One little detail. If you set serial port 0 to be a master. Then it outputs clocks on its pins. but it DOES NOT output any signal on the domain 0 internal bus. So selecting clock domain 0 from serial port 1 will not work because there are no clocks there. What you would do in that case is set serial port 1 to be a master and set it to the same internal clock source. 

    Now, one other issue. You have SigmaStudio set to a sample rate of 48kHz. I am assuming you have the DSP core start pulse also set to 48kHz. So if you send 48kHz data out of a serial port that is running at 16kHz then you are throwing out 2 out of every 3 samples and will have a lot of out of band energy and you most likely will have aliasing if you send it audio higher than 8kHz. 

    If you want to convert the sampling rate then use the ASRC. 

    Include your project. 

    Dave T

  • Hello Dave, 

    Thank you very much for these explanations. I still have a little trouble using I2S in slave_mode. 

    When i check SDATA_OUT0 with OUTPUT0 as master_mode (blck and lrck in master_Mode) then everything works. I can hear my SIN in OUT2 (CH4 and CH5)

    Then I switch to slave_mode (domain 0) for with external BLCK and LRCK (512khz and 16khz respectively, same as in master_mode). theses clocks are generated by an external MCU. 

    Now I still get signal but not goot signal, white only noise :






    It seems the SIN is not correctly sent to output when ouput is in slave_mode.

    If you have any inputs, we would really appreciate. 

    Thank you

    William


    poc_i2s4_.dspproj

  • Hello William,

    You run your project at 16KHZ (software fs) but your core clock and start pulse are in 48kHz. Your serial output port is also set for 48kHz. You will be having trouble in maintaining the timing.

    If you want to set your core rate as 16kHz then you should set N/M=1/18 in the clock generator.

    It seems you are using our Eval board. So, your CODEC is running at 48kHz since there is no codec booting program I can find. 

    Your codec is running at 48kHz, is that why you set your serial output port as 48kHz? Any way if you set your core rate as 16k and set serial port as 48kHz then you are duplicating samples.

    There are so many random set ups in serial input and output ports. Are you using all four serial ports?

    If possible, can you please attach your hardware set up? Have you tried giving individual grounds between signals?

    When i check SDATA_OUT0 with OUTPUT0 as master_mode (blck and lrck in master_Mode) then everything works. I can hear my SIN in OUT2 (CH4 and CH5)

    This means that, you run your core and serial output port at 48kHz (Since the CG was 1/6 then the serial port was using CG1 and fs as a rate). Have you changed the sample rate at the top to 48KHZ? If you haven't changed that and it was only 16kHz means you will not be getting the correct frequency at the output. You might have heard the output, but it was three times the input frequency.

    you said: Then I switch to slave_mode (domain 0) for with external BLCK and LRCK (512kHz and 16kHz respectively, same as in master_mode). theses clocks are generated by an external MCU. 

    Your BCLK and LRCLK was never 512kHz and 16kHz when serial port was set as in master mode. Your BCLK was 1.53MHZ (2*16*48kHz) and your LRCLK was 48kHz. 

    So you should have to sync everything, the software fs,core rate, start pulse (it's an interrupt) and serial port rate. Then only your system will work as expected.

    You can use ASRCs for converting things and you are also using external clocks. So ASRC is recommended. 

    And the screen shot that you sent, we can't identify anything with this digital data screen shots alone.

    Finally, Consider the given points and make everything in sync. Do you really need your processing at 16kHz? Give us a bit more info if possible.

    Kindly let us know about your status.

    Regards,

    Harish

  • Hello William,

    In addition to what Harish said, you might want to look at this post regarding taking screenshots of I2S signals so we can gather some more information and possibly some clues. 

    (+) How to Take Meaningful Screenshots of I2S Audio Signals - Q&A - Audio - EngineerZone (analog.com)

    As Harish said, we need more information regarding your system and why you are using 16kHz fs? A block diagram that includes clocking and data paths would be useful. 

    Dave T

  • Hello Dave and Harish,

    Thank you for all those informations.

    It's all a bit confusing about how to configure the core clock, start pulse and what are they purpose.

    What I'd like to do is to send a sine wave to my nrf board then send it back from the nrf to the ADAU1467 and from ADAU1467 to the DAC in order to hear it in my headphones. Moreover the communication between my DSP and my uC has to be I2S with uC being Master and DSP being slave. If it's easier to do it with a sampling frequency of 48kHz, it'll will maybe help to better understand the process but I might have to change it to 16kHz.

  • Hello Dave and Harish,

    I hope you are well,

    I've been reading the datasheet of the Eval board in details and I've understood it better, I think. If I understood it well, there is two I2S connections between the ADAU1467 and the codec AD1937 (one for the 8 outputs and one for the 4 inputs). For those two connections, the ADAU is the master and the AD1937 is the slave. This part I don't really need to change it but what I want to do is to add an I2S communication between my MCU and the ADAU1467. This communication would have to transmit audio from the ADAU to the MCU but also the other way (MCU to ADAU). For this communication the MCU have to be the master and the ADAU the slave.

    For this case (communication between MCU and ADAU), do I need two I2S connections (as it is done for the codec) one for the data in and one for data out or only one I2S connection is enough ?

    Can the ADAU be master for some I2S communications (with the codec) and slave for some I2S communications (withe the MCU) ?

    Have a nice day,

    Kind regards,

    William.

  • Hello William,

    I think. If I understood it well, there is two I2S connections between the ADAU1467 and the codec AD1937 (one for the 8 outputs and one for the 4 inputs)

    In ADAU1467 Eval board, one serial input port (port 2) and one serial output port (port 0) are connected to the CODEC AD1937 (4 ADC, 8 DAC).

    Usually, each serial port will have a BCLK, LRCLK and SDATA pins. This SDATA pin may carry I2S or TDM signals. However, ADAU1463/ADAU1467 processors will have eight SDATAIO pins. These are extra pins which carry the data with the reference of respective serial port clocks. These pins have to be configured in the serial port section. Refer SDATAIO section in the datasheet for more info.

    In this eval board, serial input port 2 uses SDATA _IN2 pin for carrying channels 32-33 and SDATAIO4 for carrying channels 36-37. So, four inputs from the ADC.

    serial output port o uses SDATA_OUT0 pin for carrying channels 0-1, SDATAIO5 for carrying channels 4-5, SDATAIO6 for carrying channels 8-9, SDATAIO7 for carrying channels 12-13. So, eight outputs to the DAC.

    what I want to do is to add an I2S communication between my MCU and the ADAU1467. This communication would have to transmit audio from the ADAU to the MCU but also the other way (MCU to ADAU). For this communication the MCU have to be the master and the ADAU the slave

    If you want to send the audio data from the DSP to external device, then use one of the serial output ports and set the external device as clock slave (The DSP is sending BCLK, LRCLK) and the other way is, if you are bringing in an audio to the DSP from an external device, then set one of the serial input ports as clock slave (The DSP is receiving BCLK, LRCLK from the external device). Since the clocks are from outside you should use the ASRC.

    How are you planning? The MCLK source to the DSP is your MCU? Are you going to omit the on-board crystal oscillator?

    A block diagram would be helpful.

    Can the ADAU be master for some I2S communications (with the codec) and slave for some I2S communications (withe the MCU) ?

    You can let the serial output port 0 as master (it is connected to the codec) and you can use different serial ports as slave (ex, you can set one of the serial input ports as slave for getting the BCLK, LRCLK and data from MCU). There are four serial input and output ports. You can configure each port as Master/slave. 

    I'm not sure whether I have answered your question or not. So, please help me with a block diagram with which serial port you are going to use or how many total channels you want and also what sample rate you are planning.

    Regards,

    Harish

  • Hi Harish,

    Thank you very much for this detailed answer.

    Please find attached the block diagram explaining what I'm trying to do. Does it seems correct for you ?

    Regarding the serial port for the I2S communication with the MCU, can I use one of the input or ouptut ports with a SDATAIO line to do receive and transmit to the MCU with only one BCLK and one LRCLK ?

    Moreover, I'd like to work in 16kHz but I think it can't be achieve on my eval board due the on-board crystal oscillator but if I use the MCLK from my MCU would it be possible ?

    Have a nice day,

    Kind regards,

    William

    PDF

Reply
  • Hi Harish,

    Thank you very much for this detailed answer.

    Please find attached the block diagram explaining what I'm trying to do. Does it seems correct for you ?

    Regarding the serial port for the I2S communication with the MCU, can I use one of the input or ouptut ports with a SDATAIO line to do receive and transmit to the MCU with only one BCLK and one LRCLK ?

    Moreover, I'd like to work in 16kHz but I think it can't be achieve on my eval board due the on-board crystal oscillator but if I use the MCLK from my MCU would it be possible ?

    Have a nice day,

    Kind regards,

    William

    PDF

Children
  • Hello William,

    CODEC and DSP: 

    You can use data pins SDATA_IN2 for channels 32-33 and SDATAIO4 for channels 36-37. In this way you can get the input channels to the core. Similarly, you can use the SDATAIO5 pin for output channels 4-5. For this process DSP is the BCLK, LRCLK master.

    MCU and DSP: 

    MCU to DSP: Let's say serial input port 3 (you have headers (J8) in the Eval board). Connect the BCLK, LRCLK and DATA pins from your MCU to the serial input port 3. Set this serial input port 3 as BCLK, LRCLK slave in the serial port section. Since the clocks are external. Route the signals thru ASRC.

    If you are sending the MCLK to the DSP from your MCU means the ASRC part is not necessary. Anyway, please refer the attached project with ASRC routing.

    Are you going to send 12.288Mhz from your MCU by bypassing the crystal oscillator? Then you have to modify the Eval board a bit. The external master clock has to be connected to the XTALIN/MCLK pin (The center pin of port J3) of this DSP. Before that you have to remove the 0Ω resistor R35 which shorts XTAL OSC and XTALIN/MCLK. If you didn't remove that then the source of the MCLK is the on-board oscillator because the XTAL OSC and XTALIN/MCLK pins are shorted. (Refer the schematics in the user guide). 

    DSP to MCU: Let's say serial output port 1 (you have headers (J19) in the Eval board). Connect the BCLK, LRCLK and DATA pins from serial output port 1 of your DSP to MCU. It's better to use DSP as BCLK, LRCLK master. So set the serial output port 1 as master (just leave the settings as it is. It is master by default).

    ASRC: (just refer this section if you want)

    I'm getting the digital audio inputs from channels 40-41 of serial input port 3 and by using ASRC 0, I'm syncing it to the core rate and get those signals in to the core for processing.

      

    After certain processing, I'm sending the signal to the ASRC output channels 2-3. ASRC channels 2-3 belongs to ASRC 1 and synching it to the core rate and send it out directly via serial output port 0 (channels 0-1).

    Ignore the serial input channel tab here.

    The ASRC output part is really not necessary here. You can send that directly to serial out. since the signal is already in the core rate. Anyway, please note this as well, In case you are running at different rates it would be necessary.

    I2C:  Reg this portion in your block diagram

     Are you self-booting from a uC? Or you are programming the DSP from Sigma studio?

    Codec at 16Khz: 

    As you mentioned, it is not possible to run the codec at 16Khz in our Eval board. Since the DSP is sending the MCLK to the codec and the MCLK is derived from the on-board crystal oscillator which is producing 12.288Mhz.

    To run your codec at 16Khz, you have to bypass the PLL section and MCLK to the codec must be 8.192Mhz. It is not possible to produce this frequency from our Eval board. You have to use an external oscillator or any other source for this exact frequency. You knew this already from your old post.

    You have to unsolder the codec, especially the MCLK pin which is coming from the DSP. You should have to remove the resistor R10 for that. Refer the eval board schematics for more info.

    Again, Is there any particular reason that you are running everything at 16Khz? like saving MIPS or something?

    Moreover the communication between my DSP and my uC has to be I2S with uC being Master and DSP being slave. If it's easier to do it with a sampling frequency of 48kHz, it'll will maybe help to better understand the process but I might have to change it to 16kHz.

    I think this is not a big deal at 48Khz. The entire process is very easy if it is 48Khz. Please let me know if you have any other problem.

    And please refer the attached schematic and the block diagram for better understanding of what I explained. 

    routing.dspproj

    In this example, I'm running everything at 48Khz nominal sample rate.

    Regards,

    Harish

  • Hello Harish,

    Thanks again for this very detailed answer. I have a better understanding of the whole process now.

    I still have a few questions.

    - Regarding the MCLK, you mentioned 12.288MHz but our MCU can only provide 4.xx MHz, is that a problem or can we still use it ?

    - Our product is embedded and we are limited in peripheral interfaces which means we only have one BCLK and one LRCLK pin, is there any way to use it for both in and out I2S data ?

    - I C section, right now I'm booting the DSP through SigmaStudio but when I'm done with the I2S part I'll focus on how to boot the DSP through I2C with my MCU.

    - And finally about sampling frequency, I'll check with the team why we want to use 16kHz.

    Regards,

    William

  • Hello Harish,

    I've managed to implement the block diagram you made using the ADAU and a MCU, the only difference is that for bos port the MCU is the master and the clock is the same for both port. Do you have any idea regarding the other questions from my last reply ?
    I'm now focusing on Dsp configuration using I2C through an MCU.

    Have a nice day,

    Regards,

    William.

  • Hello William,

    I'm glad that you managed to implement things in your side.

    Regarding the input MCLK, please refer the table below for different combinations of MCLK input frequency with the system clock frequency.

    You can find here that by changing pre divider and feedback divider settings you can end up with different system clock frequencies for different input MCLK frequency. This is taken from table 20 from page 31 of the datasheet.

    Keep in mind that any changes in the system clock frequency will affect the MIPS.

    The nominal is 6144 instructions per sample which is 294.912MHz/48KHz.

    Regarding booting your DSP, below are the recent posts where we discussed on interfacing DSP with MCU in I2C. please refer that, kindly do reply if any clarification is needed.

    working tutorial, eval adau 1467 and teensy4.1 to control it, in C - Q&A - Audio - EngineerZone (analog.com)

    working tutorial, eval adau 1467 and ESP32 to control it, in C - Q&A - Audio - EngineerZone (analog.com)

    Regards,

    Harish

  • Hello Harish,

    Thank you very much,

    I'll have a look at those thread. Could you confirm that it is possible to flash the whole ADAU using a MCU and I2C communication ?

    Have a nice day,

    Kind regards,

    William.

  • Hello William,

    Yes, you can self-boot from MCU in the same way as you do from an EEPROM. Most of the MCU will have enough memory to hold the SigmaDSP program for selfboot. Anyway, check your memory unit as well.

    You can access addresses of any parameters like gain value, filter Coeff, etc. in run time by using I2C or SPI. 

    Start from here: Interfacing SigmaDSP Processors with a Microcontroller [Analog Devices Wiki]

    Regards,

    Harish