Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

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

  1. #1
    Junior Member
    Join Date
    Oct 2016
    Posts
    17

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

    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!

  2. #2
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    1,788
    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.

  3. #3
    Junior Member
    Join Date
    Apr 2017
    Posts
    19
    Quote Originally Posted by buramu View Post

    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/41371...l=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?

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,153
    The MCP4922 chip has come up a couple times before...

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

    https://forum.pjrc.com/threads/49562...!-(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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •