Skip to main content
nkatch
Associate II
August 7, 2019
Question

Using LSE as timer source for TIM2, etc. STM32L053

  • August 7, 2019
  • 1 reply
  • 986 views

Hi,

I've seen mentioned in a couple of places that it is possible to drive timers (other than LPTIM) using the LSE. I can't actually find much more than this though...

Can LSE be used to drive TIM2 on the STM32L053, for example? If so, how is it acheived please?

Thanks

This topic has been closed for replies.

1 reply

nkatch
nkatchAuthor
Associate II
August 7, 2019

I think I've found it, which is always the way. You search for hours... You ask a question on a forum... Then you find the answer yourself.

In the Option Register (OR) for the timer, there is a field called ETR_RMP. Writing "101" to ETR_RMP connects LSE to the ETR (external trigger) input of the timer.

Oh, I forgot, then you have to select ETR as the counter clock:

LL_TIM_SetClockSource(TIM2, LL_TIM_CLOCKSOURCE_EXT_MODE2);