2014-04-28 06:47 PM
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);2014-04-28 07:55 PM
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 an2014-04-29 03:22 PM
Btw the link at the end of your reply is not working. But thanks for the help.