7

I want to connect multiple I2S ADCs to RaspberryPi and record multi-channel audio. I calculated that it requires copying GPIO input port to RAM at 3072kHz (or every 0.33µs). I want to do it using DMA.

I know that PiBlaster (PWM) and PiFM (radio transmitter) use DMA but the lowest sampling period was about 4µs.

So, is reading GPIO at 3072kHz possible, using DMA?

The detailed calculations why I need 3072kHz are on RaspberryPi forum: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=44&t=55799 . Here I'm asking only about GPIO and DMA throughput.

adiblol
  • 71
  • 1
  • 1
  • 3

3 Answers3

3

I wrote a C++ library called v3c-raspi. You can download it from SourceForge.

I wrote an example program that tries to do just what you want, called "i2s".

Unfortunately it experiences a "program anomaly" anywhere from straight away to a couple of seconds after it starts - it looks like something else uses dma channel 0 and leaves rubbish in the block address register.

I could get the Raspberry Pi to process about 16 million DMA control blocks per second (in another test).

The i2s microphones I'm planning to use are the Analog Devices ADMP441 which output 24 bit audio.

At 48kHz that's a bit clock frequency of 48000 x 32 = 1.536 MHz. The code toggles the clock using dma as well, so we double the frequency to 3.072MHz.

Add in PWM pauses and you double the number of control blocks again to 6.144 million, still well within the 16 million I could get out of the rpi.

I reported a bug about this very issue to Raspbian but no responses yet.

I solved most of the problems - see linux-rpi-kernel mailing list 2013-November, message 000734 for more.

It's limited to about 2M samples/sec so you could capture 22.1 kHz samples from 8 stereo pairs with it.

1

Just see this.

Raspberry-Pi-DMA-Example

https://github.com/Wallacoloo/Raspberry-Pi-DMA-Example

Hender
  • 111
  • 1
0

The GPIO pins cannot handle such speeds. I've found that the max read speed of the GPIO header is about 1kHz. The max the UART can handle is about 1Mbaud for stable communication and 4Mbaud is the max the kernel can handle. Anything higher than 1Mbaud requires USB or Ethernet. According to documentation, you can access DMA, whose speed is substantially faster than that of the UART. It also bypasses the CPU, making the operation cheaper in the long run.

Nielsvh
  • 193
  • 1
  • 12