Skip to main content
xuan
Associate
April 29, 2014
Question

How to adjust sample frequency in DAC on Discovery F303

  • April 29, 2014
  • 2 replies
  • 705 views
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);
    This topic has been closed for replies.

    2 replies

    Tesla DeLorean
    Guru
    April 29, 2014
    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 VenmoUp vote any posts that you find helpful, it shows what's working..
    xuan
    xuanAuthor
    Associate
    April 29, 2014
    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.