The basic concept is that I2S Audio runs on SPI1 on the PI3. The PI2/PI3 have 2 SPI’s (SPI1 and SPI0). With SPI0 evidently being a full featured interface with two enable pins, while SPI0 has only one enable pin.
It does appear possible to run 4 audio streams on I2S thru SPI0. The speaker Bonnet would have 2 streams for stereo output, and the MEMS mic would have 2 streams for stereo input. To wire them together causes contention in the drive currently. With two different drivers to drive two different audio functions on the same bus. I have limited knowledge on how to use either SPI thru the new kernel interfaces (device tree).
The Adafruit Speaker Bonnet uses I2S and a MISO (Master In Slave Out) pin. The I2S mic uses a MOSI (Master Out Slave IN) pin. I2S is via SPI1.
The speaker out uses snd_bcm2835, and mic in uses a kernel module you have to build.
At the moment the two are conflicted;
[ 3.540234] i2c /dev entries driver [ 3.644933] my_loader: loading out-of-tree module taints kernel. [ 3.650534] request module load 'bcm2708-dmaengine': 0 [ 3.650955] register platform device 'asoc-simple-card': 0 [ 3.651115] Hello World :) [ 3.841256] systemd-udevd: starting version 215 [ 4.285633] gpiomem-bcm2835 3f200000.gpiomem: Initialised: Registers at 0x3f200000 [ 4.334938] snd-hifiberry-dac soc:sound: pcm5102a-hifi <-> 3f203000.i2s mapping ok [ 4.546427] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null) [ 4.621951] bcm2835-i2s 3f203000.i2s: Trying to bind component to card "snd_rpi_simple_card" but is already bound to card "snd_rpi_hifiberry_dac" [ 4.621966] asoc-simple-card asoc-simple-card.0: ASoC: failed to instantiate card -19
So what would the next steps be to have both types of I2S audio working, microphone in, and speaker output through the same SPI1?
I already looked some at the kernel my_loader.c and other c sources. Not being familiar with Kernel module compiling it has some very special changes.
I think the easiest way to have both I2S devices working on the same Raspberry PI would be to use the two separate SPI’s one for each task. It wasn’t immediately apparent on how to do this, so I think it requires ‘digging’ to find a solution.
MEM’s mic module;
It’s just a start.
So these two bits of info talk about using SPI0, and that it has two enable pins out on the pin header.