Using Teensy Audio Library with SPI DAC (e.g. MCP4922)

Status
Not open for further replies.

buramu

Member
A (hopefully) quick question about the Teensy Audio Library and the Audio System Design Tool...

We're playing around with a Teensy 3.6 and a MCP4922 DAC and are now trying to configure our setup using the Audio System Design Tool. At first glance it doesn't look like SPI DACs are supported with this elegant Audio Library (we'd like to use AudioPlayQueue, etc.).

Is there a way to use SPI DACs using this system, or will it require handwriting all the low-level buffering logic etc.?

Thanks!
 
The only thing which you would need to hand write is a new output object. I2S and SPI are relatively similar, so starting from the I2S output object and inspired by the numerous DMA SPI libraries out there would be a good idea.
 
Is there a way to use SPI DACs using this system, or will it require handwriting all the low-level buffering logic etc.?

As Theremingenieur say, chances are that you'll have to write it. No SPI devices are supported at this point and I guess one reason is that SPI isn't generalized as easily as I2S, because there's no separate data stream / configuration bus, so the DMA stuff will have to handle/interleave both data and command bytes, which is going to be a more or less device specific affair.

FWIW, the last time I've looked I haven't come across a lot of useful pointers in the direction, but mmalex posted a more real-world/working DMA / SPI DAC example in this thread:

https://forum.pjrc.com/threads/4137...-on-Teensy-3-6?p=185389&viewfull=1#post185389

It's only half-there, because not using the PDB (like the Audio Library).

That said, personally, I don't think it's worth the effort for the humble MCP4922. Why not just use the onboard 12 bit DACs?
 
The MCP4922 chip has come up a couple times before...

https://forum.pjrc.com/threads/51846-Teensy-Audio-question

https://forum.pjrc.com/threads/49562-Audio-functionality-and-SPI-communication-again!-(Teensy-3-2)

I need to point out section 6.7 on page 32 of the datasheet is dead wrong. Sometimes we get people asking about MCP4922 because they believe they're going to get a cheap 24 bit DAC. It's a lie. If you put a lot of effort into matching those resistors, which involves taking the temperature-dependent output impedance of the amps inside the MCP4922, in practice you might achieve 14 or maybe even 15 bits performance. You're very unlikely to end up with performance better than just using an ordinary 16 bit DAC meant for audio.
 
Status
Not open for further replies.
Back
Top