### Author Topic: n00b tech question: how fast can I pump DAC data out?  (Read 9745 times)

#### cnd

• Newbie
• Posts: 4
##### n00b tech question: how fast can I pump DAC data out?
« on: January 21, 2014, 06:48:01 am »
I want to synthesize a triangle wave output at 44.1hz
In a tightly coded output loop, what's the resolution going to be on my triangle wave?
How many DAC values am I going to be able to push out in 1/44100 of a second?

Sorry the question is so basic - my new DigiX arrived today, but the Arduino IDE crashes every time I access it, so I'm unable to "just do it" and count myself, but I urgently need to know the answer.

Thanks heaps if anyone knows (or can work it out)!!

Chris.

#### dfarrell

• Newbie
• Posts: 30
##### Re: n00b tech question: how fast can I pump DAC data out?
« Reply #1 on: January 21, 2014, 08:55:29 am »

In one place you say 44.1hz, in another 1/44100.  Do you mean 44.1Khz?

It looks like the DAC can output (84MHz/2)/25 =1.68M  (1ch) samples per second.  To feed the DAC at this rate you would need to use the PDC (DMA).  Standard libraries do not use the PDC.  With my math you can put out 38,095 updates per 44.1Hz, or 38 per 44.1KHz.

Why do  you need multiple samples are 44.1KHz?  I would assume 44.1KHz is the sample rate? Data more than twice this is wasted.

#### cnd

• Newbie
• Posts: 4
##### Re: n00b tech question: how fast can I pump DAC data out?
« Reply #2 on: January 21, 2014, 10:40:39 pm »
Yes, I meant Khz.  Thanks for that rapid answer.  I'm trying to generate a particular output waveform of that period, which is why I need higher data rates.

Thanks for the clues about DMA - sounds exactly what I need.

#### dfarrell

• Newbie
• Posts: 30
##### Re: n00b tech question: how fast can I pump DAC data out?
« Reply #3 on: January 22, 2014, 05:53:40 pm »
For a challenge I wrote some code to drive the DAC with a ramp table via DMA.  DMA can write 32 samples to form a 50KHz waveform with the DAC free-running.  I added triggering via TCO and ran the same ramp pattern synchronous at 45KHz, works well.  One problem you may have (using a timer trigger) is there are no attainable products close to (44100 x 32) that come near 42MHz.  You would need an external (44.1KHz x 32) clock to be able to synchronously trigger the conversions.  You could also reprogram the PLL of the CPU to get even factors but this could affect quite a few other things.

One clarification, it takes 26 clocks per conversion, 1 to start, 25 to convert so max speed is (84/2)/26 = 1.62Ms/s.  And a note, the analog range seems to be 0.58V to 2.7V for  0..4095 codes. All tests are with a Iduino Due Pro clone.
« Last Edit: January 23, 2014, 08:44:52 am by dfarrell »