Question
How to adjust sample frequency in DAC on Discovery F303
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);