cancel
Showing results for 
Search instead for 
Did you mean: 

How to adjust sample frequency in DAC on Discovery F303

xuan
Associate
Posted on April 29, 2014 at 03:47

Hi,

I am running the peripheral example of DAC on Discovery F303VC board, and I cannot figure out how sample rate can be adjusted. My assumption is that it has to do with the following part, but the number (in red) is against my calculation. Please help, thanks!

X

----------------

static void TIM_Config(void)

{

  TIM_TimeBaseInitTypeDef    TIM_TimeBaseStructure;

  

  /* TIM2 Periph clock enable */

  RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);

  

  /* Time base configuration */

  TIM_TimeBaseStructInit(&TIM_TimeBaseStructure); 

  TIM_TimeBaseStructure.TIM_Period = 0xFF;  

       

  TIM_TimeBaseStructure.TIM_Prescaler = 0x0;       

  TIM_TimeBaseStructure.TIM_ClockDivision = 0x0;    

  TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;  

  TIM_TimeBaseInit(TIM2, &TIM_TimeBaseStructure);

  /* TIM2 TRGO selection */

  TIM_SelectOutputTrigger(TIM2, TIM_TRGOSource_Update);

  

  /* TIM2 enable counter */

  TIM_Cmd(TIM2, ENABLE);
2 REPLIES 2
Posted on April 29, 2014 at 04:55

Yes, while it will also depend on the configuration of the DAC, and the DMA, you should be able to control the sample rate via the TIM period up to the maximal rate of the DAC.

Not sure I have an example for the F3, but there is an
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
xuan
Associate
Posted on April 30, 2014 at 00:22

Btw the link at the end of your reply is not working. But thanks for the help.