I'm not ready to start this project yet; just feeling around for what's available.
I think I want a custom PCB (I can do that myself) that has:
- An Analog Devices DSP chip for audio processing (ADAU1452 or similar, compatible with SigmaStudio)
- A Raspberry Pi GPIO header for:
- Stereo I2S audio into the DSP
- SPI to program the DSP*
- A connector to carry TDM-8 from the DSP to an off-board set of class-D amp chips (TI TAS5720M or similar)
*HiFiBerry has a Python-based, MIT-licensed driver that runs on the Pi, to connect SigmaStudio on Windows, through the Pi's IP address and SPI interface, to the DSP:
https://github.com/hifiberry/hifiberry-dsp---
So far, so good. But since the DSP has a bunch more I2S/TDM ports that can be driven independently (up to 48 channels total in each direction), I was also thinking to have at least an 8-channel feed back to the Pi via USB. Maybe use it as a sort of "audio debugger interface" or whatever. Don't really know yet. So anyway, that needs a TDM-8 to 8-channel USB audio converter of some kind.
Don't need any smarts there; just a dumb bit-for-bit shuffling from one protocol to another (
maybe change endianness, but that's all), and USB standards compliant so it doesn't need a special driver. (which probably exists only for Windoze and not for the Pi where I need it)
---
All I've seen so far that even attempts to do that is from XMOS, and that's a 64-pin, 16-core microcontroller that needs to be understood and programmed! I've seen some open-source projects that use that chip in exactly that way, doing nothing else, and they also provide the binary and instructions to program it, but it seems like a ridiculous overkill for just that application.
Is there really no dedicated chip to do just that? I think a 10- to 16-pin package would be plenty: 2 for USB, 3-4 for TDM audio, 2 for power, and some hardware configuration pins. Extract the audio clock from TDM, and the USB clock from the 1ms USB frames with a DFLL like the newer PIC's do, so no external clock needed. (or derive the TDM clock from USB if it's running as a TDM master) Drop that chip on my custom PCB, wire it up, and forget it's even there.
I wouldn't be surprised if it's actually a bidirectional thing with TDM-8 each direction, so that'd be okay too.
---
I thought briefly about using a PIC16F1454 as a bare minimum pin count, using SPI and an edge detector to read the TDM data and running a really tight loop just to keep up. But I saw pretty quick that the lack of DMA and the low instruction rate for CPU-based data-shuffling, would probably kill that deal. 48kHz, 8 channels, 32 bits/channel = 12.3MHz clock = 1.5Mbytes/sec, compared to the 1454's instruction rate of 48MHz/4 = 12MIPS. That's about 7.8 instruction cycles per byte; and despite having a hardware peripheral for the signalling, its USB stack is still CPU-intensive, at least on that scale!
(Let's see...polled USB stack, interrupt-driven data transfer...is that even possible with a new high-priority interrupt every 7-8 instruction cycles? Or would the ISR run over itself, and/or the USB host give up for lack of response?...)
A PIC18 or AVR that has a DMA module might have a fighting chance; but by the time I get that, I'm already getting close to the XMOS in terms of overall size and basic management, and so I might as well learn and use what already works.
---
As an "XY solution", it would also be okay instead, to have a hobbyist-accessible DSP chip with multichannel USB audio
built-in, in addition to some GPIO for encoders and LEDs, and a TDM-8 port for the DACs, but I haven't seen one of those either.