When I use both chanels, what args I need in HAL_TIM_Encoder_Start?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-02-08 3:22 PM
I use CubeMX to configure my timer 2 to use Encoder Mode: "Encoder Mode TI1 and TI2". In my code should I use
HAL_TIM_Encoder_Start(&htim2, TIM_CHANNEL_1)
or
HAL_TIM_Encoder_Start(&htim2, TIM_CHANNEL_2)
or
HAL_TIM_Encoder_Start(&htim2, TIM_CHANNEL_ALL)
or something else?
P.S. What means TI1?
Solved! Go to Solution.
- Labels:
-
STM32Cube MCU Packages
-
TIM
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-02-10 7:59 AM
Hi @dungeonlords789​ ,
Looking to the description of HAL_TIM_Encoder_Start in the driver stm32f4xx_hal_tim.c (for example):
/**
* @brief Starts the TIM Encoder Interface.
* @param htim TIM Encoder Interface handle
* @param Channel TIM Channels to be enabled
* This parameter can be one of the following values:
* @arg TIM_CHANNEL_1: TIM Channel 1 selected
* @arg TIM_CHANNEL_2: TIM Channel 2 selected
* @arg TIM_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected
* @retval HAL status
*/
So the last option is what you need to use.
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-02-10 7:59 AM
Hi @dungeonlords789​ ,
Looking to the description of HAL_TIM_Encoder_Start in the driver stm32f4xx_hal_tim.c (for example):
/**
* @brief Starts the TIM Encoder Interface.
* @param htim TIM Encoder Interface handle
* @param Channel TIM Channels to be enabled
* This parameter can be one of the following values:
* @arg TIM_CHANNEL_1: TIM Channel 1 selected
* @arg TIM_CHANNEL_2: TIM Channel 2 selected
* @arg TIM_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected
* @retval HAL status
*/
So the last option is what you need to use.
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
