I want to use the external quartz crystal (32.768kHz) as the ETR (external trigger input).
Currently I'm using the HardwareTimer library.
How can I change the clock source for example the Timer1 on the STM32L452RE?
Thank you
Change Timer clock source
Re: Change Timer clock source
Hi @MystikReasons,
Current implementation of HardwareTimer does not support ETR management. And there is no plan to do it.
But it is still possible to use STM32 HAL API (which are usable directly within Arduino sketch) to use ETR as clock source.
When you say
Because it is not possible to use LSE as a source of timer (General purpose Timer TIMx). Using ETR requires an external square signal connected to ETR pin.
Nevertheless it is possible to use LSE as source of LPTimer (LowPower Timer) but it is not in use in Arduino. You can still use STM32 cube HAL/LL to use LPTIM. And because LPTIM peripheral is completly different than TIM, using LSE as source of clock will not go through ETR but will be configured directly thanks to RCC (Reset and Clock Control).
Current implementation of HardwareTimer does not support ETR management. And there is no plan to do it.
But it is still possible to use STM32 HAL API (which are usable directly within Arduino sketch) to use ETR as clock source.
When you say
do you mean LSE crystal ?the external quartz crystal (32.768kHz) as the ETR
Because it is not possible to use LSE as a source of timer (General purpose Timer TIMx). Using ETR requires an external square signal connected to ETR pin.
Nevertheless it is possible to use LSE as source of LPTimer (LowPower Timer) but it is not in use in Arduino. You can still use STM32 cube HAL/LL to use LPTIM. And because LPTIM peripheral is completly different than TIM, using LSE as source of clock will not go through ETR but will be configured directly thanks to RCC (Reset and Clock Control).
-
- Posts: 2
- Joined: Tue May 26, 2020 12:24 pm
Re: Change Timer clock source
Hi @ABOSTM
Yes I meant the LSE crystal.
Thank you for your detailed explanation and sorry for the delay, I was on vacation.
Yes I meant the LSE crystal.
Thank you for your detailed explanation and sorry for the delay, I was on vacation.