Post Go back to editing

Port0 (or Port1 out) be the clock master and Port1 input be a slave without physically wiring the clock pins between them — i.e. let the DSP sync internally?

Category: Software
Product Number: ADAU1467

Hi 

I am using  below setup 

- Serial Output port -1 as master

- LRCK_OUT1 & BCLK_OUT1 are connected to codec

- SDATA_OUT1 driving 2ch (I2s) data to codec (SDATA_OUT1 --> CODEC_DIN)  

Now i am trying to read  serial data from same codec (SDATA_IN1 <-- CODEC_DOUT) , how to achieve this without physically connecting LRCK_IN1 & BCLK_IN1 ? 

means 

can   Port1-out be the clock master and Port1-input be a slave without physically wiring the clock pins between them — i.e. let the DSP sync internally?

or should I connect LRCK_OUT1 --> LRCK_IN1  & BCLK_OUT1-->BCLK_IN1 ?

regards

nagendra 

  • Hello Nagendra,

    Just set the input port 1 as master and let the BCLK_IN and LRCLK_IN1 unconnected and connect the SDATA_IN1 to CODEC_DOUT. Since the CODEC uses BCLK_OUT1 and LRCLK_OUT1 for syncing, it just works for the input port too. Because serial output clocks and input clocks are derived from internal clocks, it will be the same. The serial input data from CODEC will be properly clocked in.

    I assume the CODEC uses single set of clocks for CODEC's serial input and output.

    Hope you can understand what I'm saying. Let me know if you have any questions.

    Regards,

    Harish

  • hello Harish 

    my requirement is more complex that i explained, i actually want to understand the capability of DSP ADAU where i need to get multiple I2S (2ch data) from various slave codecs , so planning to use SDATAIOX pins as well , in this context 

    out-port1 as master 

    bclk_out1 & LRCK_out1 --> 3x codecs (ADAU is master) 

    data_out-1 ---> codec 1 

    sdataio-1 --> codec 2 

    sdataio-2 --> codec 3

    now the issue is Input , how to mange , all 3 codecs has Dout  as well 

    so planning to use

    IN-Port-1 as input , configuring as slave, 

    bclk_in-1 & LRCK_in-1 are NC (not connected) 

    data-in-1  <--- codec 1 

    sdataio-3 <--- codec 2

    sdataio-4 <--- codec 3 

    can I use the way i have explained with out connecting BCLK_out-1 and LRCK_out-1 with  BCLK_IN1 and LRCK_IN1 ?

    can ADAU sync internally by selecting LRCK source as "slave from clock domain 1/2/3 etc" ? 

    i tried my best to explain, is my configuration works ? wat is the use of "slave from clock domain 1/2/3" ? setting ?

    regards

    Nagendra 

      

  • Hello Nagendra,

    I will 100% backup Harish on this. Let me explain a few little details that might help you. 

    The "Slave" clock busses for the Serial input ports are ONLY available to the serial input ports to choose from. For there to be a signal on these busses at least one serial INPUT port needs to be set as a slave to a physical pin and there needs to be a clock on that pin. Then it will distribute this clock to other serial input ports to choose to slave to those same clocks. 

    The same thing applies to the serial OUTPUT ports. At least one serial output port needs to be a slave to an external clock appearing on a physical pin. Then the other serial output ports can slave to those same clocks. 

    Here are the tricks and little details that are not obvious. These "slave" busses for the serial input ports and the serial output ports are NOT interconnected!! They are different ports! So a serial input port cannot slave to a clock appearing on a serial output port pin! The opposite is also true. An output port cannot slave to an input port. You HAVE to jumper clocks to one set of serial input clock pins and one set of serial output clock pins to have both ports slave to the same external clocks. 

    Next, issue:... When a serial port, either input or output port, is set to be a "master", it DOES NOT feed that signal onto these internal slave busses. So for instance, if you set serial output port 0 to be a clock master and then set serial output port 1 to slave from serial output port 0, there will be no clocks on the slave bus!! Because serial output port 0 is not a slave!!

    Just set serial output port 1 to also be a master and it will have the same clock as port 0. You do not have to actually connect anything to the clock pins. In fact, you can "steal" one to be a GPIO if needed!

    The same thing applies to the serial input and output ports. Since you are sending clocks from serial output port 1 to all three codecs. All you need to do is set any port that is receiving serial data from these codecs to be a master from the same internal clock source that serial output port 1 is set to. This is the same clock!! 

    This also applies to sending serial data to the codecs. The serial data has to be clocked out so therefore you must set those ports to be a master even though nothing is connected to the pins. Internally, we need clocks to clock the data out. 

    One problem you run into is a timing problem. For the serial data from the codec to the DSP is the worse case. The clock edge has to "travel" to the codec. The codec has to sense this transition internally and then fetch the new data bit. Then it has to apply this new data bit to the pin on the codec. This takes time and a lot in some cases. Then the data has to "travel" to the DSP and then the DSP has to sense that the pin is high or low, which takes time but not too much, so the round trip from the clock edge going out to the SDATA from the codec appearing internally in the DSP can be long. the PCB layout is a part of this and any fly-wires will be worse!! If you are attempting to operate at 192kHz fs then you will have trouble with timing of the data and might see a lot of errors. I would first try to operate at 48kHz and see what works then try to bump up the speed to 96kHz then to 192kHz and see if issues start coming up. Then it is another discussion. 

    It is always better for the clocks to come from the source of the data. So from the DSP for the serial output port and from the codecs for the DSP serial input ports. To avoid needing sample rate converters the MCLK for the DSP and the codec needs to be the same source. Either the exact same MCLK or the CLKOUT pin of the DSP needs to feed the MCLK into the codec.  

    I hope this helps. Diagrams would be helpful and I have not made a video of this topic yet... 

    Dave T

  • Hello Dave 

    thanks a lot for your explanation, I believe I got some clarifications. 

    now what i tried was, 

    - configured serial-in-port-1  as master , but I did not connect BCLK_in1 and LRCK_in1 they are floating 

    - now connected Codec DataOut to SDATA_IN1 and able to received Audio data well from my codec on channels 16 & 17 in Sigmastudio

    I have probed LRCK_IN-1 and LRCK-OUT-1 and they are perfectly in Sync , even BCLK as well.  

    (Both Serial Port-IN-1 and Serial-port-out-1 are master) 

    this solved my issue partially.. 

    But I am not able to receive serial data from SDATAIO2 on input channel 20&21 of sigma studio even after below configuration 

    (connected codec Dout to SDATAIO2 instead of SDATA_IN for testing)  

    kindly help me 

    regards

    nagendra 

  • Hello nagendra,

    There are many places where one register setting might mess this up. 

    From what you wrote above I want to double check that all of these serial data streams are I2S formatted data? So stereo and 32 bit wide slots etc. Correct?

    So please send over your project. 

    I have an example file for our eval boards. This one uses serial port 2 but the idea is the same. Here is the setting in the SDATAIO registers. It will look familiar to you. 

    Serial input port 2 is setup this way:

    Then in the project I pick up the audio this way: (keep in mind I was using port 2 not port 1. )

    Yes, there are some illogical register settings telling to use TDM4. This is because internally we do that but the signal coming in on the eval board were stereo I2S. 

    In addition, do not forget to change the MP pins to the correct usage. (I have been guilty of that oversight!!! LOL)

    See if this helps. 

    Otherwise, send over your project.

    Dave T

  • hello Dave

    below is my port-in-1 setting 

    I am able to receive 2 ch data from SDATA_IN1 well 

    but i need to receive 2 more channels form SDATAIO-1 from another codec 

    if i change the channels to 4 , 32 bit per channel , my BCLK is doubled and this is effecting codec 

    I guess there is a confusion here, why i need to change to 4 channel ? 

    for PORT-1-OUTPUT to driver 6 channels independent i did not change this setting at all, still i am able to driver 6 different channels on port1-0-output 

    SDATA_OUT1 => 2 ch 

    SDATAIO-2  => 2 ch

    SDATAIO-3 => 2 ch 

    similarly : my target is to capture 6 channel audio from PORT-1-IN

    to receive more channels on IN_PORT_1 need to change channel configuration which is effecting Bit clock , which is not intended for my design , so can you please check below schematic and guide me how to configure in SS ?

    target :

    - drive 3 set of  stereo channels to 3x codecs independently  

    - receive 3 set of  stereo channels from same codecs 

    - using INPUT PORT-1 and OUTPUT PORT-1  with extra SDATAIOX pins 

    each codec support LRCK (I2S) , BCLK, DIN and DOUT only , No separate clocks for DIN and DOUT for Codec

    regards

    nagendra 

  • Hello nagendra,

    There is an internal bug and I think you missed one little detail. Your connection setup should be fine. You are driving the LRCLK and BCLK from the serial output port. Do NOT change that port to be four channels. ONLY change the serial input port to 4 channels. 

    That port according to your diagram does not go to the codecs so it should not be a problem.

    Only set serial input port 1 for 4-channels. 

    Dave T

  • Hello Dave 

    thank you  for clarification

    so, to receive more channels on serial-port-in-1 , I have to configure "serial input port " to 4 channel , its clear, and its working tested with Serial-IN-2 port on EVK (I am sure same would applicable to Port-IN-1) 

    just one clarification, the above schematics should work well, even Port-IN-1 is configured as salve right ? (to be tested ) 

    regards

    nagendra 

  • Hello nagendra,

    Yes, port configuration would be the same with the exception of the difference between Input port 1 and input port2. Assuming you are starting the numbering as we did in the datasheet with input port 0. So ports 0 and 1 can go up to TDM16 or, 16 inputs. Serial ports 2 & 3 can only go up to TDM8. So in your case using the SDATAIO pins you will only be able to get four channels into serial input port 2. You set it up for TDM-4 and get two channels from each set of four. 

    Whether the serial port is a clock slave or master makes no difference with how it works. Assuming the clocks are correct. IF the clocks are from a source that uses a different MCLK then you will have to route the signal through an ASRC but that is after the serial port. 

    Dave T