10
\$\begingroup\$

I am working with the I2S audio protocol in one of my projects and I'd like to use it in one of my final projects for a class of mine. Quite honestly though, I don't entirely understand the MCLK line. You'd think, "Oh that just stands for Master Clock" and you might be right but since everything has to do with audio and sampling rates, I get confused.

I'm using the CS42436 in software mode: in short it takes in 3 signals (that I'm questioning).

MCLK - Master Clock (Input) - Clock source for the delta-sigma modulators and digital filters.

SCLK - Serial Clock (Input) - Serial clock for the serial audio interface. Input frequency must be 256 x Fs

FS - Frame Sync (Input) - Signals the start of a new TDM frame in the TDM digital interface format.

Can somebody explain how to use these clock signals in reference to this picture?

I2S Protocol

I know the middle signal is the serial clock, but the other two I don't understand at all.

\$\endgroup\$
0

5 Answers 5

8
\$\begingroup\$

The top signal is Frame Sync (FS). FS is used to indicate whether the audio is for the left or right channels. Don't think of them as "left" and "right" though, those are just arbitrary names. Think of them as channel 0 (FS clear) and channel 1 (FS set), time-division multiplexed onto a single communications link.

The bottom signal is the serial data that is being clocked into(?) your MCU.

MCLK is not visible in that diagram. It is the clock that is used by the audio codec (in your case, a CS42436) to time and/or drive its own internal operation. It is a relatively high frequency; a common value is 256*Fs (where Fs is the sample rate, e.g. 44.1kHz). Values in the range of 10-60MHz are pretty typical.

\$\endgroup\$
11
  • 3
    \$\begingroup\$ It really depends on the codec and your accuracy requirements. In your case, from my brief glance at the CS42436 datasheet (p33 s5.4.1), it looks like you need to supply it with either 256*Fs or 512*Fs to get it to function correctly. You'll need to examine your MCU's datasheet to see if it has a PLL that it can use to supply the I2S MCLK with a precisely tailored frequency to suit the codec's needs (e.g. 11.2896MHz for 44.1ksps @ 256*Fs). \$\endgroup\$
    – markt
    Commented Mar 12, 2014 at 1:49
  • 1
    \$\begingroup\$ > Why does MCLK exist? It's the clock input of the digital circuitry (DSP or whatever there is) of the DAC. Some DACs require it, some make it themselves, some can accept external oscillator on PCB. \$\endgroup\$
    – PkP
    Commented Dec 20, 2016 at 7:07
  • 2
    \$\begingroup\$ @endolith, you typically cannot choose freely which one you use. Since two clocks are never the same, both ends of the connection must use the same clock to derive the sample clock. If one end consumes samples at 96000.1 Hz and the other end produces them at 96000.2 Hz you will have pops, clicks and horribilities in the sound. So the first thing to do is to consider who is the data master, who is the data slave, who is the clock master and how does the clock slave derive the sample clock from clock master clock. All variations are possible in i2s, see spec for "i2s enhanced" \$\endgroup\$
    – PkP
    Commented Mar 2, 2017 at 9:21
  • 2
    \$\begingroup\$ @endolith, the best arrangement is the one where the analog interface is the clock master, e.g. in case of DAC the DAC is the clock master and the microcontroller generates samples to match the clock from the DAC. And in the case of ADC, the ADC is the clock master and produces samples and the MCU consumes the samples at the ADC rate. These two rates are not the same, so in case of having both ADC and DAC, you will need to either set one of them to be the clock slave or do sample rate conversion in a DSP. 96.00001 kHz is not the same sample rate as 96.00002 kHz! \$\endgroup\$
    – PkP
    Commented Mar 2, 2017 at 9:24
  • 3
    \$\begingroup\$ @endolith, you're right. It's a tradeoff between EMI and the sound quality, as clock reconstruction can never be perfect. If you're making the PCB, connect the trace anyway, then decide if you want to use it or not. I'd use the 12MHz trace and only optimize it away if the EMI becomes a real problem. I also suggest that you add a footprint for some filter component to the trace (perhaps equip it with short circuit in the beginning). \$\endgroup\$
    – PkP
    Commented Mar 2, 2017 at 14:27
2
\$\begingroup\$

Serial clock is not 256 * Fs, Serial clock is your sampling freq (Fs) * # of bits / channel * # of channels. for ex, 2 channels for Stereo and 1 channel for Mono.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ So it's a bit clock (BCLK)? \$\endgroup\$
    – endolith
    Commented Nov 4, 2016 at 15:39
  • \$\begingroup\$ For this chip, SCLK actually is mandated to be 256 * Fs. But that would not be the case historically. \$\endgroup\$ Commented Apr 27, 2018 at 14:02
1
\$\begingroup\$
  1. Frame Sync or LR (left Right channel) clock or generally called word sync, which is the sample rate you are playing or capturing the audio files.

  2. Bit clock or called I2S clock which derived by Frame Sync * no.of channel (in I2S it 2 , ie L and R) and no.of bits per channel (depends on the sampling format 8, 16, 32 bit modes)

  3. This is real sampled PCM data to record or play over I2S data lines (either in or out).

Master clock (Mclk): Mlck is derived from LRCK and SCK when operating in Master mode (For synchronising internal peration of audio codec). This can be enabled/disabled in slave mode also (When master is not able to give mclk).

\$\endgroup\$
0
\$\begingroup\$

The Master clock generates the timing of the i2s stream, so bitclock and frame sync signals are derived from it. It can be derived by a Crystal connected to the DAC (i2s-master). Or, it may be the CPU providing a MCLK to the DAC, that is still master.

\$\endgroup\$
0
\$\begingroup\$

The MCLK is not part of the I2S protocol. A codec or a DAC should receive PCM signals, not I2S, although PCM and I2S are similar. I2S means inter IC sound so it is mentioned to be connected to another IC's I2S interface.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.