Discussing about 8channel DSP using Camilla DSP + Raspberry PI -- Interface options

As far as I understand PIs I2S system, there is only one clock. According to my knowledge this clock should me the same for RX and TX in a full duplex I2S application. Hence the changing buffer percentage you mentioned should be only seen on the software side?! From the interface view timing should me fixed and constant. Or I'm completely wrong?
Yes each sample is clocked syncronised. So the dalay of each samle is constant when the stream is not reset.
The trouble arises when two RPIs are used. Then we have 2 buffers and software that is not syncronised at all. If a all DSP is used, the latency difference between two DSPs are much smaller than two RPIs with linux and alsa
The proof is trying to have a to small byffer size. The buffer will overflow or underrun.
And we will never know how much the buffer is filled before alsa starts to read from the buffer.
So if ALSA starts forom the 36th sample in buffer on one RPI and from the 56 sample on the other there will be a constant 20 sample delay between the early reading RPI and the late reading RPI. And then you have clock drift on top of that during play
 
Last edited:
So if ALSA starts forom the 36th sample in buffer on one RPI and from the 56 sample on the other there will be a constant 20 sample delay between the early reading RPI and the late reading RPI. And then you have clock drift on top of that during play
This is a good advice. Thanks for this. From this point of view the XMOS based multichannel USB variant looks better. I have to admit this.
May I ask what the case would be if I switch from Raspi Hardware to "normal" PC Hardware? As I understood CamillaDSP can be run under normal Linux as well. Taking a conventional PC mainboard and adding 4x soundcards each having a TOSLINK input and output would work (for example 4x Sound Blaster Z SE)? Working in the meaning of handling so many channels (I guess each is 7.1) and in relation to the timing when using the 4 individual TOSLINK outputs? Most likely PCIe should be better than having 4 USB devices in timing accuracy. Is this correct?
 
I think the input buffer size is the most important parameter, as long it is ARM or intel hardware. Eg. system with advanced operating system and not a real-time operating system (RTOS) or non operating system prosessing
But this is a very complex topic that i have not dug myself into.
So i don't know how to get a predictable latency from a none microcontroller/DSP system. But i do know that the microcontroller/DSP selling point are predictable latency https://www.analog.com/en/technical-articles/planning-for-success-in-real-time-audio-processing.html
 
Last edited:
The Radxa CM5 compute module should have complete 8ch I2S in/out available, thanks to the clever use of three 100-pin headers, instead of just two on RPi CM4 (and on all other non-broadcom clones of the CM4). Of course it requires a special board designed, but that board can be combined with the I2S codecs. Radxa team says CM5 boards with integrated eMMC should become available within this month (for now only non-eMMC boards are available).

Their CM3 with the weaker RK3566 but all 8 channel I/O lines is readily available. Again an integration board is required.
 
Just a variant.... I use an RME Digiface USB - the toslink version. This gives me 4 pcs of stereo Toslink out for 8 channels. If I could find an unit that did: 4 toslink ADAT in -> 8 toslink 24/44 out, I could feed 16 channels... This contraption should have one common sync source possible so any deviation would stem from DAC toslink sync handling. I think it could be OK...

//
 
RME Digiface USB
can you say something about general Linux feasibility of this device? I was not sure about this because in the description special drivers were mentioned.

By the way another question: what is the recommended software for calculating FIR coefficients for very long linear phase filters for a 4 way system? I tested pyFDA what looks promising to me. But seems to have issues when using longer filter length (> 4096).

Initial measurements of the horns (when finished) can be done with a very simple 2.0 setup for each way individually. Hence I have some time left for introducing myself better to filter design ... Perhaps the initial measurements are so bad that I give up after the second smallest horn. I hope this is not the case. But the possibility exists. In comparison the companies like Avantgarde Acoustics I have nearly zero knowledge. But even in this state I do not understand all design decisions made by the experts.
 
may be I can direct the discussion even in another direction. As Elon told me, an engineer should not be happy to solve a problem that shouldn't exist. Perhaps this is the case with multichannel I2S as well. I mean all the typical devices to be connected are DACs or fully digital amplifiers. Both normally have USB inputs. To use 4 USB devices on one device perhaps is not a good idea because of timing uncertainty (I'm not sure wether it can be guaranteed that all audio data is packed into one stream everytime). But as far as I know MACOS gives the possibility of sound device aggregation. This means that one of the devices is taken as clock master, the others are slaves. Perhaps this is why MACOS is used by many sound professionals. Hence using a MAC as platform for camillaDSP is perhaps the most versatile and elegant way? A TOSLINK input maybe can be added using USB or the MAC is the streaming device itself.
 
Ad Radxa 8ch boards:

Radxa RK3568 CM3 + CM3 IO - 8ch OUT + 8ch IN (I2S1).

I tested the combo this week, the I2S runs stable at 8ch up to 384kHz. 768kHz is above the board HW capabilities http://lists.infradead.org/pipermail/linux-rockchip/2023-September/040677.html due to only 32-locations I2S-DMA FIFOs (RPi4B has 64-locations FIFOs, allowing safe 768kHz)

The USB-gadget (DWC3) works (but I did no tests, only noticed the working RNDIS composite function by default configured by Radxa).

Radxa RK3588S Rock5A - 8ch out, 6 ch in (I2S1) - missing SDI2


Radxa RK3588S CM5 - 4ch OUT + 4ch IN + 4ch OUT/IN (shared pins in the SoC) (I2S0), 8ch OUT + 8ch IN (I2S1 - SDI3 and SDO0 have onboard 2k2 pullup resistors (designed for the shared I2C6) but hopefully that should not hurt). That means CM5 should be usable for synchronous 16ch OUT (assuming the alsa "multi" plugin manages to start the DMA stream on both interfaces within the same audio frame which is likely), master/slave mode including MCLK IN.

No pinout for CM5-IO board available yet.

Maximum samplerate remains to be tested (I do not have any RK3588 yet), I would assume at least 384kHz as the I2S + DMAC IP cores of RK3588 seem identical to RK3568, extra I2S pcms are specced at 768kHz + their DMA controller clocked by the same clock), and the manufacturing process is 8nm (vs. 22nm).

specced max kHzon rk3588sDMACOUT-CHIN-CHlrclkmclksclksdi0sdi1sdi2sdi3sdo0sdo1sdo2sdo3
i2s0192x088m0GPIO1_C5_dGPIO1_C2_dGPIO1_C3_dGPIO1_D4_dGPIO1_D3_d - WIFI_PWR_ENGPIO1_D2_dGPIO1_D1_dGPIO1_C7_dGPIO1_D0_dGPIO1_D1_dGPIO1_D2_d
i2s1192x088m0GPIO4_A2_dGPIO4_A0_dGPIO4_A1_dGPIO4_A5_dGPIO4_A6_dGPIO4_A7_dGPIO4_B0_d - 2k2 pullupGPIO4_B1_u - 2k2 pullupGPIO4_B2_uGPIO4_B3_uGPIO4_B4_u
m1GPIO0_B7_d - HDMI_TX0_SCL_M0GPIO0_B5_dGPIO0_B6_dGPIO0_C5_uGPIO0_C6_uGPIO0_C7_dGPIO0_D0_dGPIO0_D1_u - 2k2 pullupGPIO0_D2_u - 2k2 pullupGPIO0_D4_uGPIO0_D5_u
¨
i2s2192x122m1GPIO3_B6_d - GMACGPIO3_B4_uGPIO3_B5_uGPIO3_B2_dGPIO3_B3_u
i2s3192x122m0GPIO3_A2_u - GMACGPIO3_A0_uGPIO3_A1_uGPIO3_A4_dGPIO3_A3_u
i2s4192x280DPTX0
i2s5768x280EDP0/HDMI0
i2s6768280EDP1/HDMI1
i2s7768208HDMIRX
i2s8192280DPTX1
i2s9768x208HDMI TX0
i2s10768208HDMI TX1
 
Last edited:
  • Like
Reactions: Dave Bullet and fb
This is really great info @phofman ... I have just finished build a Pi4B+CamillaDSP-based 8-channel DSP platform using the X6000-7.1 HDMI audio extractor board discussed in this thread.. it is all housed in a Pesante 3U case along with SMPS and 8 channels of amplification using the TPA3116 boards recommended by FauxFrench.
To take audio in from my TV and other equipment, I also created a custom ADC hat for the Pi, based around the CS5341 chip, although its performance is not that great (I'm guessing it needs an isolator). But that's another topic.
I am using this to drive 3-way speakers (so 2 channels for woofers, 2 for mids, 2 for tweeters and 2 spare) and CamillaDSP is the active crossover.

Anyway, it is working quite well. But one big problem is channel ordering for the HDMI extractor card, which is quite random. The channels will often start up in the order 7/8/1/2/3/4/5/6 or 8/1/2/3/4/5/6/7. Eventually, after some time, it fixes itself (I don't know why - I suspect some kind of resynchronisation gets triggered). My current workaround is just to leave it running 🙂

What I'm wondering, is whether I should consider a Radxa board for running this, and perhaps design a multi-channel DAC hat for the Radxa. The form factor of the Rock4C+ is identical to the RPi 4B, meaning that the holes I cut in the back panel of my case for the Pi will fit perfectly. Would you think the RK3399 chip is capable?

BTW, I know that multi-channel USB soundcards would work, and I have one, but the Pi's USB port faces externally so the soundcard would be outside, and I couldn't connect its outputs to the amplifiers which are inside the box. So this doesn't help me unfortunately.

(Incidentally I think the CM3 uses RK3566... RK3568 was in the Rock3A.. it's easy to type the chip number wrong!)
 
Just looking further, the Rock4C+ doesn't break out the I2S pins fully, so it's not feasible for more than 2 channels. I think my best option will be the Rock 5A. I2S0 is connected to an onboard codec, and I2S1_M1 pins are used for various other things. So the only real option is I2S1_M0.
As far as I can see, all pins are available on the 40p header except SDI1 and SDI2. Here is a table with the labels used in the Rock5A schematic

mclklrcksclksdo0sdo1sdo2sdo3sdi0sdi1sdi2sdi3
label
I2S1_MCLK_M0
I2S1_LRCK_M0
I2S1_SCLK_M0
I2S1_SDO0_M0
PWM14_M1
PWM15_IR_M1
SPDIF0_TX_M1
I2S1_SDI0_M0
I2C5_SCL_M2
I2C5_SDA_M2
GPIO4_B0
pin on 40p header3536124013111538nonenone32