STM32F303RET6 Timer PWM Output Not working as expecte
I am trying to configure a PWM output pin. Ive managed to get it working, however the results are not as expected, and i cannot understand whats happening.
Currently my timer clocks are running at 64MHz.
I've setup a timer with the follow values, and it works in producing a 10kHz PWM. The prescalar being 64, should give a frequency of 1MHz. As 64/64=1. Then the Period being 100 should be freq/100 resulting in 0.01MHz. Which is 10kHz. This pwm shows up perfectly on my oscilloscope.
htim1.Instance = TIM1;
htim1.Init.Prescaler = 64-1;
htim1.Init.CounterMode = TIM_COUNTERMODE_UP;
htim1.Init.Period = 100-1;
htim1.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
htim1.Init.RepetitionCounter = 0;
htim1.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;However if i change the Period value to 10-1, i would expect a PWM of 100KHz. However I dont get a PWM signal any more. The signal just goes HIGH, and does not change.
htim1.Instance = TIM1;
htim1.Init.Prescaler = 64-1;
htim1.Init.CounterMode = TIM_COUNTERMODE_UP;
htim1.Init.Period = 10-1;
htim1.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
htim1.Init.RepetitionCounter = 0;
htim1.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;What am I doing wrong?
