Skip to main content
Mk.11
Associate
August 15, 2020
Solved

how to create create milli seconds delay function using timer in stm32cubeide using stm32f103c8t6

  • August 15, 2020
  • 1 reply
  • 1847 views

..

This topic has been closed for replies.
Best answer by waclawek.jan
  • set up a timer ARR and PSC so that timer_input_clock_period * (TIMx_PSC+1) * (TIMx_ARR+1) = required_time
  • set TIMx_CR1.OPM = 1
  • set TIMx_CR1.CEN = 1
  • wait until TIMx_CR1.CEN = 0

JW

1 reply

waclawek.jan
waclawek.janBest answer
Super User
August 15, 2020
  • set up a timer ARR and PSC so that timer_input_clock_period * (TIMx_PSC+1) * (TIMx_ARR+1) = required_time
  • set TIMx_CR1.OPM = 1
  • set TIMx_CR1.CEN = 1
  • wait until TIMx_CR1.CEN = 0

JW

Piranha
Principal III
August 15, 2020

You mean +1 not -1 for times related to PSC and ARR values. =)

waclawek.jan
Super User
August 15, 2020

Indeed, thanks, I edited my post to avoid confusion.

JW