2016-09-30 09:14 AM
Hello,
I am trying to create sine wave generator using DAC and DMA based on STM32L476.The goal is to obtain exactly 100KHZ, 10KHZ frequencies with maximum possible number of samples.Thus I have set APB timer for DAC to 72MHZ, timer period to 15 and sample sizes to 48 for 100kHz and 480 for 10kHz. This combination gives ideal frequency results.However I need more than 480 samples for 10Khz.If the sample pool is set to say 800, timer period to 9 then the result frequency is never exact there is en error of 1-2%. Why is that? Does the DAC/Timer combination require some special timing considerations?2016-09-30 10:58 AM
Period is normally an N-1 value, if you set it to 15 (0..15) it is dividing by 16. 72000000/16 = 4500000, 72000000/10 = 720000
Show your code, it is a lot easier than guessing.