2016-12-24 01:50 PM
Hi,
I use a Stm32 Nucleo L476 board and I am trying to interface a quadrature encoder to TIM4 in the Encoder Mode using STM Cube
My problem is that i don't know how to read the value of the timer using the functions of the TIM HAL module driver (stm32l4xx_hal_tim.c) Thank you
#encoder-mode #stm32l4xx #quadrature-encoders2016-12-26 05:11 AM
Hi
mika.belloula
,'My problem is that i don't know how to read the value of the timer using the functions of the TIM HAL module driver (stm32l4xx_hal_tim.c)'
To have idea about how to use the timer HAL driver,I recommend you to start with timer examples under the STM32L4 firmware package :
STM32Cube_FW_L4_V1.6.0\Projects\STM32L476RG-Nucleo\Examples\TIM-Nesrine-
2016-12-26 10:34 AM
Hello
Thank you Nesrine- for your advice
I saw the examples of the timer, unfortunately for me l did not the example of the timer in quadrature mode
Maybe I have misplaced the problem
I would just like to read the value of the counter using the functions of the HAL library 'stm32l4xx_hal_tim.c' but I do not find a function that allows me this in this mode of operation.
If not is what I have to do by counting the number of interuption generated by the signals coming from the sensor or should I use the HAL_TIM_ReadCapturedValue function, in this case I have two channels for the timer
Sorry for my english
thank you
2016-12-26 12:39 PM
The timer only has a single counting element, TIM4->CNT or TIM_GetCounter(htim->Instance)
The channel compare latches TIM4->CCR1 and CCR2 do not play a role.
2016-12-26 02:54 PM
Hi,
Thank you so much , Clive One
Now I understood that my real problem is that I misunderstood the notation ♯ define __HAL_TIM_GET_COUNTER (__ HANDLE__) \
((__HANDLE __) -> Instance-> CNT) in the file stm32l4xx_hal_tim.h
Thank you once again