cancel
Showing results for 
Search instead for 
Did you mean: 

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

Mk.11
Associate II
 
1 ACCEPTED SOLUTION

Accepted Solutions
  • 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

View solution in original post

3 REPLIES 3
  • 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

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

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

JW