Its being a few days i am trying to achieve something that I dont really know if possible.
Arduino Zero), I am using a timer and a
DAC to produce a sine wave.
The required frequencies are 100Khz to 3Mhz. I know its sounds too much, but according to my calculations its possible- I would like to know if I am wrong with my software approach.
Pseudo is this :
1.I create a look-up table of a sine wave = array of a sine samples that holds N samples 2.I use a timer with a pre scale of 1, where the clock speed is 48Mhz 3.Each timer tick I produce from the DAC 1 sample from the sine wave 4.To change frequencies I am changing the timer top counter value.
If we try to speak about the max frequency, according to Nyquist , a 3MHz sine must be sampled with at least 6MHz sample rate, and my sine array has 15 samples, means 45Mhz sampling rate.(=good)
Then the sine frequency is :
sineF= TimerF*sineSamples = TimerF*15
Than means I need a timer frequency of :
TimerF=15*sineF = 15*3Mhz=45MHz
So, both are good, the timer max f can be 45Mhz, and the sampling rate is good according to Nyquist.
The only concern here, is if the DAC can do that(speed), and if changing the timer frequency fast enough (even every period) is acceptable.
Is this whole software approach true ? If its not, producing a square wave probably possible,since it requires much less speed, but then, can you turn it into a nice clean sin wave with filters?