SPI-DAC / DMA-Driven SPI on Teensy 3.0/3.1?

Status
Not open for further replies.

syso2342

Well-known member
For my synthesizer project I am using an external DAC (AD5668) (SPI compatible) and currently
only using shiftOut for the protocol. I want to make it faster by using DMA-SPI.
Is there any guideline how to start with DMA programming? It's fairly new to me.
 
If you are using shiftOut, it sounds as if you are using software SPI emulation (bit-banged SPI). Teensy has hardware SPI, the first step to make it faster would be to use that.
 
First, I highly recommend getting it working with normal SPI usage, such as the SPI library.

Before you can use DMA, you'll probably need to convert your code to using the SPI native registers directly. When you call SPI.transfer(), quite a bit of code runs to do stuff for you. You'll need to become familiar with the exact native registers used.

DMA to the SPI port probably requires composing your message as 32 bit numbers to write to the SPI "push" register.

There's a new DMAChannel class in 1.20-rc1 which makes DMA much simpler to understand. The only documentation is comments in DMAChannel.h and some conversation on this forum.

http://forum.pjrc.com/threads/25778...emplate-function?p=49730&viewfull=1#post49730
 
AD5668 is an octal 16bit DAC so for each update you are sending 8 X 2 = 16 bytes of data, then bringing LDAC low to cause all 8 channels to update together. The Minimum SCLK period is 20nS (50MHz) so this is a fast SPI device which can take as little as 2.65us (16 * 8 * 20ns) for a full update.
 
AD5668 is an octal 16bit DAC so for each update you are sending 8 X 2 = 16 bytes of data, then bringing LDAC low to cause all 8 channels to update together. The Minimum SCLK period is 20nS (50MHz) so this is a fast SPI device which can take as little as 2.65us (16 * 8 * 20ns) for a full update.


What I have now (without SPI Library and without DMA) is:
https://gist.github.com/DatanoiseTV/4e40429eecf90b88dcf5
 
Last edited:
Is this meant for audio CV? Just wondering why the need for extreme speed?
Also for Audio CV. But also for Digital Oscillators. Furthermore the SPI is also used by 3 more components at my board
including an 8-Channel SPI ADC with a 4051-based multiplexer for 64 potentiometers.
 
Status
Not open for further replies.
Back
Top