cancel
Showing results for 
Search instead for 
Did you mean: 

How to correctly set the sampling frequency of the PWM for DMA ?

JRatt.2
Associate II

I am trying to build a guitar pedal using the nucleo-64 F446RE. And I'm trying to configure my CODEC using DMA. Furthermore, figure 1 below shows my CODEC output, the green sine wave (500Hz/1Vpp) is the input and the yellow sine wave is the output. Note that you can still see "squares" in the output wave.

0693W00000aIBfoQAG.jpgfigure 1. sine wave.

My ADC is set to 12-bits, right alignment and 144 cycles. I'm using timer 2 to trigger the adc, and in the timer configuration, the clock source is set to internal, which according to the datasheet, should be the 16Mhz RC oscillator. The counter period is set to 354, this is because my desired sampling freq is 45kHz and 16Mhz/45kHz = 355.5. I would like to know if there is anything I can do to get rid of those "squares" and improve my frequency response, while maintaining a sampling frequency of 45kHz?

OBS: I know my output is being rectified, this is because the ground rail of the Nucleo-64 F446RE is connect to an LED, according to the datasheet.

0 REPLIES 0