24

The Pi has a standard 3.5mm audio jack, but this cannot be used for audio input

However, we've got a load of GPIO pins on various interfaces. Would it be possible to recieve analog audio into the Pi via the GPIO?

Elinux tells me:

It is also possible to reconfigure GPIO connector pins P1-12 and 13 (chipset GPIO 18 and 21) to provide an I2S (a hardware modification may be required [12]) or PCM interface. However, PCM_FS and PCM_DIN (chipset pins 19 and 20) are needed for I2S or PCM.

There seem to be references to this I2S connection all over the place, but nowhere giving a clear yes or no.

  • No, the audio jack is output only according to this quetsion. – Frepa Jan 6 '13 at 13:26
  • @Frepa, yup, didn't see that, I've voted close. – ACarter Jan 6 '13 at 13:28
  • Edited the question, can I do it through GPIO? – ACarter Jan 6 '13 at 15:27
  • Of course you can get audio input using GPIO and ADC. I'm on going to do such project soon so I will post my results if you want. – dicoder Feb 28 '13 at 13:03
  • Please do post them! ;) – ACarter Feb 28 '13 at 17:42
13

The Peripherals datasheet for the BCM2835, used on the Raspberry Pi, gives you the answer in Chapter 8. I quote:

"The PCM audio interface is an APB peripheral providing input and output of telephony or high quality serial audio streams. It supports many classic PCM formats including I2S."

20 pages of information on this subject alone.

Like you said: not all the pins are available from the GPIO connector! PCM_FS and PCM_DIN (the one you probably need) are not on the GPIO connector, you'll need to check the schematic to see if you can reach those in some way.

UPDATE:

According to the schematics you're out of luck:

enter image description here

Sadly connected to nothing! No chance to get anything connected to that!!

But something odd is going on, if these pins are the actual missing I2S pins then the V2.0 board should also not have these pins on a connected. But the documentation states that is does have these pins available on the newly added connector P5. These are connected to different pins then the wiki says... This needs a little further investigation... soon more....

  • It was all looking so hopefull... I can get the output, but not the in! Thanks for finding that :) – ACarter Jan 6 '13 at 16:33
  • Hmmm, I don't seem to be able to find any reference of the PCM pins in the schematic... – ACarter Jan 6 '13 at 16:35
  • Me neigther, but I'm not finished looking yet, but chances don't look very good. – ikku Jan 6 '13 at 16:35
  • "Eben shouts from the bath that he's not actually sure we have lost it - it may just be hidden behind some GPIO muxes." (not looking too good) – ACarter Jan 6 '13 at 16:37
  • 1
    I guess I checked that already some time ago, that might be the reason why I ordered a USB audio plug on ebay like this one – ikku Jan 6 '13 at 16:39
13

As shown here you can get I2S via P5:

http://elinux.org/RPi_Low-level_peripherals#P5_header

And here is a kernel driver for using it:

http://blog.koalo.de/2013/05/i2s-support-for-raspberry-pi.html

  • 1
    welcome to Raspberry Pi Stack Exchange! it's usually better if you don't post a link only answer (what if the linked resource becomes unavailable?), would you consider editing your answer to summarize salient points from the webpages you linked? – nc4pk May 21 '13 at 15:20
  • 4
    @Koalo 's work on the I2S driver is admirable, he should be given 2K rep just for blessing us with his presence. – Dog Ears May 24 '13 at 11:04
  • i must admit my ignorance and beg u to explain a little bit more: where is that p5 connector ? i have Hardware : BCM2835 Revision : a02082 it's a pi3 model B – L.Trabacchin Jan 21 '18 at 17:02
  • The PI 3 has the relevant pins integrated in the main connector. – koalo Jan 22 '18 at 9:59
5

What revision of the board is this? The Rev B 512M has all four PCM pins mapped to the P5 connector. You'll have to add your own pins to the board but use the under side to still make use of the GPIO connector on the front.

On the schematic, Page 2, bottom left, look BCM2835-IO2 chip for the GPIO28-31 pins labelled as GEN7-10 corresponding to PCM Clk, Fs, DIn, DOut mapping to the P5 holes 3-6 respectively. This pin out would provide PCM when assigned as the Alt2 functionality.

gb

protected by Community Sep 28 '16 at 10:57

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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