I²S Audio

Hello and a beautifull tuesday to all.

Im not a pro at programing but maybe you can help me.

I have been searching for some magnetic Pickups with microphone and a preamp for my acustic Bass. Gues what...
Everything is way to expensive. So lets diy...

I ordered some Microphone shields and xmc to Go from Infineon and some DAC's...

All devices use I2S and now the big question:

Can i use a Input and a Output Bus at the same time?

Can i use a Input and a Output Bus at the same time?

Yes.

You have to use an Arduino that has I2S capability though.

I2S busses can have inputs and outputs, as many as the chip supports in fact, each input and output is
a stereo pair.

Something like a Teensy with I2S audio support and audio library might be a good choice here, and I
think some of the Adafruit boards support this too.

Note I2S signals need to be very short, they cannot survive over a long cable, should be kept local.

g-evil:
I ordered some Microphone shields and xmc to Go from Infineon

Does that mean you purchased this board?
https://www.infineon.com/cms/en/product/evaluation-boards/s2go-memsmic-im69d/

and some DAC's...

I have no guesses for what "some DAC" means you actually have.

All devices use I2S and now the big question:

Can i use a Input and a Output Bus at the same time?

The answer is maybe. It really depends on whether the I2S devices you have are compatible. Since you didn't say which things you have, I can't just look at them and offer you advice specific to the actual items you have. So instead here's some generic tips.

I2S comes in 2 basic types, called master & slave. Both can transmit or receive or transfer in both directions, so don't mix these up with data direction. The master vs slave distinction is about the direction of the clock signals, or in other words which device is controlling the audio sample rate. I2S masters output the clock signals (BCLK, LRCLK, sometimes also MCLK). Obviously you can't connect 2 masters together, since they'll both try to drive those same signals, which won't work and could possibly even damage the hardware.

So if you have an Arduino compatible board that acts as a I2S master (with bidirectional data), and you have a mic that's an I2S slave, and a DAC that's also a I2S slave, you could connect all 3. You'd wire the clocks from the master to the clock pins on both slave devices. Then you'd connect the data output of the mic to the data input on the microcontroller board. Also on the DAC, you'd connect the microcontroller's data output to its data input.

If your DAC is an I2S master, it will try to transmit the BCLK and LRCLK signals. To make that work, if the I2S mic is a slave device (I'm not familiar with this particular part, but every I2S MEMS mic I've seen has been an I2S slave) you would need the microcontroller board to be able to work in I2S slave mode, where it listens for the clocks rather than creates them.

The other small detail is the ratio of BCLK to LRCLK. Most DAC chips are very flexible and will automatically work for any reasonable ratio of those clocks. Again, I'm not familiar with this particular part, but every I2S MEMS mic I've seen has rigidly required the BCLK to LRCLK to be exactly 64. Most of them also work over a range of LRCLK (sample rate) frequencies that does not go very low. So before selecting a board, check what sample rates and BCLK/LRCLK ratio it supports.

Another small detail is whether you need MCLK. Some slave devices (often DACs) require an MCLK signal, which is just a faster clock in sync with BCLK. Typically MCLK is between 11 to 25 MHz, with 256 times LRCLK being the most common. If any of the I2S slave devices need MCLK, then whatever I2S master you use had better create it. Even if everything else is compatible, if you have a DAC chip that absolutely requires MCLK and no way to get that MCLK signal, then it can't work. The same could be true of your I2S mic, but so far all the ones I've seen do not use MCLK.

I'm the author of the Teensy audio library, and as the risk of shamelessly promoting Teensy, I can tell you some details about what it does and does not support. Teensy 3.2, 3.5 and 3.6 have a single I2S port, which supports both master and slave mode. In normal stereo mode, those boards use BCLK/LRCLK ratio = 64. In master mode, these boards output MCLK. Those also have a 4 channel mode which uses BCLK/LRCLK ratio = 32. Teensy 4.0 and 4.1 have two I2S ports. Both support master mode, and both output when MCLK in master mode. The 1st one also supports slave mode, but when in slave mode (the external device is in control of the sample rate) you can't use the other I2S port. The software does not (yet) have the ability to stream audio between multiple interfaces running at different sample rates (though I hope to add that someday...) So even though it has 2 ports, the software can't (yet) run them at different sample rates, so to use both they must both be in master mode.

I believe some of the Arduino MKR boards and some of Adafruit's products support I2S. Which modes and parameters they support, I can not say. But hopefully this lengthy message at least gives you some good background to be able to ask the right questions and understand the answers well enough to made good decisions about which board to buy & use.

You might also consider in the future being more specific when asking strangers on the internet for tech help. Had you said clearly (with exact part number or links to datasheets) exactly which devices you purchased, this message could have been answers directly addressing the devices you bought, rather than this generic description. But lacking info, that's the best I can do for you.

1 Like