aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32/stm32-h103/pwm_6step/pwm_6step.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/stm32/stm32-h103/pwm_6step/pwm_6step.c')
-rw-r--r--examples/stm32/stm32-h103/pwm_6step/pwm_6step.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/examples/stm32/stm32-h103/pwm_6step/pwm_6step.c b/examples/stm32/stm32-h103/pwm_6step/pwm_6step.c
index 505b3c8..bda8ff7 100644
--- a/examples/stm32/stm32-h103/pwm_6step/pwm_6step.c
+++ b/examples/stm32/stm32-h103/pwm_6step/pwm_6step.c
@@ -124,9 +124,6 @@ void tim_setup(void)
/* Reset TIM1 peripheral */
timer_reset(TIM1);
- /* Clock division. */
- timer_set_clock_division(TIM1, TIM_CR1_CKD_CK_INT);
-
/* Timer global mode:
* - No divider
* - alignment edge
@@ -136,6 +133,12 @@ void tim_setup(void)
TIM_CR1_CMS_EDGE,
TIM_CR1_DIR_UP);
+ /* Reset prescaler value. */
+ timer_set_prescaler(TIM1, 0);
+
+ /* Reset repetition counter value. */
+ timer_set_repetition_counter(TIM1, 0);
+
/* Enable preload. */
timer_enable_preload(TIM1);