cancel
Showing results for 
Search instead for 
Did you mean: 

How to reset STM32H7 timer/counter and how to set the encoder mode?

Louie88
Associate III

Hi,

I am new with the STM32H7 timer/counter. I found the LPTIM_PulseCounter example which was good starting point. But I have a couple of questions:

  1. How can a reset the counter manually (not via automatic reload) of LPTIMER1? I could not find any HAL_LPTIM_CounterClear(), HAL_LPTIM_Counter_Reset(), HAL_LPTIM_Counter_Write(0x0000) function in HAL LPTIM Generic Driver.
  2. As far as I think the LPTIMER1 is capable to count quadrature encoded signals. It has two inputs, I can set the ENCODER mode and I can start the encoder mode with HAL_LPTIM_Encoder_Start (LPTIM_HandleTypeDef * hlptim, uint32_t Period) function. But I guess the period parameter should be set to 0xFFFF in order not to allow autoreload function after PERIOD count.
  3. Does ENCODER mode work with 32-bit timers? No need to be LPTIMER.
  4.  I have STM32H747I-DISCO board. The input1 of the LPTIMER1 is in the Arduino connector PD12 (pin 10 of CN5). Is the Input2 of LPTIMER1 in the same CN5 connector but the next pin: pin 9 of CN5 (PD13)?
  5. Is there any example how to use LPTIMER1 as an encoder in STM32H747I-DISCO board?

Thanks for your help!

Louis

20 REPLIES 20
Thanks TDK! Thanks for your very valuable notes as well.
Best regards,
Louis