2
\$\begingroup\$

i have a MEMS mic with digital I2S output. What is the easiest way to test that my microphone communicates right? No need to verify the sound, i just need to verify on bit level that communication occurs. For example how can i test it with an oscilloscope?

input and outputs are listed: enter image description here

data sheet: link

\$\endgroup\$
  • \$\begingroup\$ Is it an I2S master device (generates its own clock) or slave device (requires a clock from a master)? (my money is on slave) \$\endgroup\$ – Majenko Oct 29 '14 at 11:48
  • \$\begingroup\$ Yes it's a slave. I need to update the post. \$\endgroup\$ – vasf Oct 29 '14 at 11:52
  • \$\begingroup\$ Provide it the required signals, and see what comes out of SD. You need 2 clocks and a chip enable, though I'm not sure what WS is - never seen that on I2S before. \$\endgroup\$ – Majenko Oct 29 '14 at 12:00
  • \$\begingroup\$ You could use a cheap eval board for a micro with I2S interface. Maybe TI launchpad (Tiva). \$\endgroup\$ – Spehro Pefhany Oct 29 '14 at 12:04
  • \$\begingroup\$ @Majenko-notGoogle: i also am trying to figure out the clock frequency and how WS works but i will try to figure out from data sheets. \$\endgroup\$ – vasf Oct 29 '14 at 12:09
3
\$\begingroup\$

You need to provide 2 clocks - one is a division of the other.

The main clock is the "bit clock", aka the Serial Clock. This is one clock per data bit transferred, and 32 bits of data per sample.

The secondary clock, normally known as LRCLK is the left / right channel clock. This divides the data stream into pairs of samples, one for the left channel, one for the right. This is 64x slower than the serial clock, and is known as one "frame".

So a frame consists of two samples, each 32 bits in size (only 24 bits of that 32 are actually used).

Now comes the elusive WS pin. The "Word Select" pin. This is actually the LRCLK pin of I2S. It selects which of the two samples, left or right, is currently being requested. It is compared to the state of the L/R pin, which is normally hard wired to either Vcc or GND, and if it matches then the microphone clocks its latest sample out through the serial data pin. If it doesn't match, then the serial data line is high impedance.

It's designed like this so you can have two microphones on one I2S bus. One would have its L/R pin tied high, and one with L/R tied low, so as the LRCLK alternates it activates each microphone in turn, and you get a stereo signal.

Theoretically it should be possible to tie the L/R pin to the WS pin so it is always seen as the current word is valid, and the same microphone would respond to both left and right channels.

The bit clock should be 64× the desired sample rate. So if you want 44100Hz sampling, that's 44100 frames per second, or 88200 samples per second, or 2822400 bits per second, so a 2822400Hz clock.

So in summary:

Apply a 2822400Hz clock to SCK. Apply the same clock / 64 to WS (44100Hz). Tie L/R either HIGH or LOW. CHIPEN should be tied HIGH to enable the microphone as a whole.

By the way, the clocks must be synchronised - so one should be derived from the other.

You should then see data coming out of SD.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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