2

I'm trying to get a pair of I2S microphones working on a Pi2/Pi3. FWIW, it's a pair of http://www.invensense.com/wp-content/uploads/2015/02/ICS-43432_DS.pdf.

Here is some relevant output:

$ uname -a
Linux one 4.4.8-v7+ #880 SMP Fri Apr 22 21:55:04 BST 2016 armv7l GNU/Linux

All the right modules appear to be loaded:

$ lsmod | grep snd
snd_soc_bcm2835_i2s     6354  0
snd_bcm2835            25029  0
snd_soc_core          125885  1 snd_soc_bcm2835_i2s
snd_pcm_dmaengine       3391  1 snd_soc_core
snd_pcm                75698  3 snd_bcm2835,snd_soc_core,snd_pcm_dmaengine
snd_timer              19160  1 snd_pcm
snd                    51844  4 snd_bcm2835,snd_soc_core,snd_timer,snd_pcm

However:

$ arecord -l | sed 's/^/    /'
**** List of CAPTURE Hardware Devices ****

although

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

More diagnostic output that I deemed relevant can be found in https://gist.github.com/jayeye/00e45ae5534357d7098e25778106b5c0

As far as I can tell, i2s is enabled in the device tree, yet it appears as neither input nor output. FWIW, the microphones are working, I tested them on a Teensy 3.1.

Help?

/ji

3
  • This problem seems to be solved here Commented May 12, 2016 at 19:12
  • No, it is not. I have already posted on that thread. (Don't you think I would know how to use a search engine? It's the first hit if you search for "i2s microphone raspberry pi" :) ).
    – JayEye
    Commented May 12, 2016 at 22:45
  • It looks like ALSA SoC would have helped if there was support for the device(s) you have - but it is not obvious that that is the case. It may be that you will need to write your own "driver" perhaps using Joan's pigpio library or one of the others that enables you to utilise the I2S bus to talk to these devices (setting up the serial bus and gathering the data captured and then writing it out in the required audio file format)... of course someone might have already done this - so hopefully they will speak up here!
    – SlySven
    Commented May 18, 2016 at 19:14

1 Answer 1

2

As far as I understand, simply loading the ALSA SOC modules is not enough. I cannot post more than 2 links, so Google "ALSA SoC". I don't quite understand it myself, and haven't managed to make my system work right, but there is a driver for the platform, i.e. the computer; a driver for the audio codec; and a third driver to describe the combination of computer and audio codec!! Which you most likely have to write yourself. BUT there are some examples people have used.

In these examples, the Pi is simply instructed to assume there's some generic card attached and to send the I2S data without knowing anything about the card. It sounds good, maybe it will work OK for you, for me it plays at the wrong speed no matter what I do. The first such driver example is indeed in the thread mentioned above, near the middle: Plugh's famous loader. This one did not work for me in this form for several reasons. Carla's famous version of Plugh's famous loader did, however, albeit it plays way too fast. Others have reported it working without a hitch. See this much shorter thread: Carla's famous version. There is some extra info spread throughout the responses after she posted her code that allowed it to work for me, regarding /sys/debug/ something or other.

I for one have come to the conclusion that it will be easier to do this WITHOUT ALSA. ALSA is meant to be a generalized, all-purpose solution that can be modified for anything. I just want it to work for me, so I'm looking at the other option; the other option is manually using I2C or SPI to configure your codec/mic, and using the low-level ARM peripherals datasheet to configure the Pi's I2S, then coding your audio programs to write directly to the Pi's I2S transmit FIFO. I haven't done it yet. The ARM peripherals datasheet's explanation of the PCM/I2S registers is not exactly simple, but, unlike anything connected to ALSA, it's clearly and explicitly documented. Again, I can't post more than 2 links, so Google "ARM peripherals datasheet". Adafruit has it on their site, among others.

I also foolishly thought the presence of an ALSA driver with the name of my hardware meant it would be smooth sailing. Ironically, it's neither manual nor automatic. It's automatic that has to be set up manually, in a far more complicated way than doing it manually.

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.