How do you feed so many channels into the Pi?

Moderator: flatmax

Post Reply
pepijndevos
Posts: 1
Joined: Mon Mar 12, 2018 5:02 pm

How do you feed so many channels into the Pi?

Post by pepijndevos » Mon Mar 12, 2018 5:22 pm

I'm looking into feeding multiple audio channels from an FPGA into the Pi.
I've been looking into I2S, but so far it appeared to only support two channels.
How are you doing it? You mentioned you use an FPGA, but while I can find your PCB design, I can't find your code.

I did find the kernel driver, but I'm not really sure what is going on.
My guess is that you have these multiplexing pins that the FPGA toggles to indicate the actual channel.
Like you extended the LRCLK to 4 bits. What is this code doing?
https://github.com/raspberrypi/linux/bl ... #L134-L192

I also find references to the CS42448 chip, which you seem to be using.
I think this is the codec for that? Is this where the multiplexing happens?
https://github.com/raspberrypi/linux/bl ... -cs42448.c

I may be able to just abuse your driver with the help of a logic analyser, but I'd rather figure out how to adapt it to my needs.

mhelin
Posts: 2
Joined: Thu Mar 15, 2018 10:56 pm

Re: How do you feed so many channels into the Pi?

Post by mhelin » Fri Mar 16, 2018 8:16 pm

The code you highlighted was for setting the multiplier for the clock for current sample rate. In addition in the probe function there is the reset which restarts the FPGA from the beginning of the first audio frame. The FPGA just frames the data to I2S format and relies to ALSA to keep up in sync. If a failure happens (xrun or something) the interface just has to be reset. It's as simple as it gets. The usual stereo 24-32 bit I2S is not any better on RPi hardware, as the FIFO is only 32-bit wide which means if you miss a word you will have the right and left sample swapped. If this happens with Octo without any errors detected the consequence is that input or output channels (they have independent FIFO's) will rotate.

To make the system more robust you could flag the first the sample in a frame in the LSB's of the 32-bit sample word, but then the driver should check the sync for each sample, or let's say for each 8th sample, and raise an error if the LSB is not set.

I wish the audio quality of Octo was better. Also it would be nice to be able to record 16 channels at least in 16 bits. It's prefectly possible using the I2S/PCM GPIO I/O. You just have to dither the 24-bit samples to 16-bit ones in FPGA code. Also when you use 16-bit format for recording you better have analog compressor/limiter between the mic pre's and and the ADC. There was the Behringer MDX4600 which is 4-channel dynamic processor, don't know if it's made anymore.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests