Skip to main content
Mk.11
Associate
Aug 15, 2020 8:21 AM UTC
Solved

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

..

This topic has been closed for replies.
waclawek.jan
waclawek.janBest answer
Super User
Aug 15, 2020 8:47 AM UTC
  • 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

3 replies

waclawek.jan
waclawek.janBest answer
Super User
Aug 15, 2020 8:47 AM UTC
  • 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
Aug 15, 2020 9:08 AM UTC

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

waclawek.jan
Super User
Aug 15, 2020 10:35 AM UTC

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

JW