AnsweredAssumed Answered

STM32f4 discovery timing problem

Question asked by Sitnikov.Vjacheslav on Dec 6, 2011
Latest reply on Dec 8, 2011 by Clive One
I tried to build examples from stm32f4discovery_fw package for stm32f4-dicovery board. And I have a incorrect CPU timing settings.
Some examples.
I tried to make TIM_PWM_Output example with 2.5kHz PWM.
  /* Compute the prescaler value */
  PWM_pulse_freq = 1680000;
  PrescalerValue = (uint16_t) ((SystemCoreClock /2) / PWM_pulse_freq) - 1;
  /* Time base configuration */
  TIM_TimeBaseStructure.TIM_Period = ( PWM_pulse_freq / 2500 ) - 1;
  TIM_TimeBaseStructure.TIM_Prescaler = PrescalerValue;
  TIM_TimeBaseStructure.TIM_ClockDivision = 0;
  TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
  CCR1_Val = TIM_TimeBaseStructure.TIM_Period >> 1;
  TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure);
In this case I have 832Hz output signal.
I tried to make simple FreeRTOS example. I used task where one of leds toggled with and vTaskDelay-functions called. Configured delay time is 100ms - real time delay 311ms.
I used Eclipse IDE, project configured as described here.
As far as I understand problem is in HSE/HSI settings.
What kind of settings I need to change/set?
Why software examples (used default  settings) does not worked as described?