dannyf and AndreasF,
The reason i did it is because on the HAL Driver Description document there´s a section called: How to use this driver in the TIM part, this section states the following:
1. Initialize the TIM low level resources by implementing the following functions
depending from feature used :
? Time Base : HAL_TIM_Base_MspInit()
? Input Capture : HAL_TIM_IC_MspInit()
? Output Compare : HAL_TIM_OC_MspInit()
? PWM generation : HAL_TIM_PWM_MspInit()
? One-pulse mode output : HAL_TIM_OnePulse_MspInit()
? Encoder mode output : HAL_TIM_Encoder_MspInit()
2. Initialize the TIM low level resources :
a. Enable the TIM interface clock using __TIMx_CLK_ENABLE();
b. TIM pins configuration
? Enable the clock for the TIM GPIOs using the following function:
__GPIOx_CLK_ENABLE();
? Configure these TIM pins in Alternate function mode using
HAL_GPIO_Init();
3. The external Clock can be configured, if needed (the default clock is the internal clock
from the APBx), using the following function: HAL_TIM_ConfigClockSource, the clock
configuration should be done before any start function.
4. Configure the TIM in the desired functioning mode using one of the initialization
function of this driver:
? HAL_TIM_Base_Init: to use the Timer to generate a simple time base
? HAL_TIM_OC_Init and HAL_TIM_OC_ConfigChannel: to use the Timer to
generate an Output Compare signal.
? HAL_TIM_PWM_Init and HAL_TIM_PWM_ConfigChannel: to use the Timer to
generate a PWM signal.
? HAL_TIM_IC_Init and HAL_TIM_IC_ConfigChannel: to use the Timer to
measure an external signal.
? HAL_TIM_OnePulse_Init and HAL_TIM_OnePulse_ConfigChannel: to use the
Timer in One Pulse Mode.
? HAL_TIM_Encoder_Init: to use the Timer Encoder Interface.
5. Activate the TIM peripheral using one of the start functions depending from the
feature used:
? Time Base : HAL_TIM_Base_Start(), HAL_TIM_Base_Start_DMA(),
HAL_TIM_Base_Start_IT()
? Input Capture : HAL_TIM_IC_Start(), HAL_TIM_IC_Start_DMA(),
HAL_TIM_IC_Start_IT()
? Output Compare : HAL_TIM_OC_Start(), HAL_TIM_OC_Start_DMA(),
HAL_TIM_OC_Start_IT()
? PWM generation : HAL_TIM_PWM_Start(), HAL_TIM_PWM_Start_DMA(),
HAL_TIM_PWM_Start_IT()
? One-pulse mode output : HAL_TIM_OnePulse_Start(),
HAL_TIM_OnePulse_Start_IT()
? Encoder mode output : HAL_TIM_Encoder_Start(),
HAL_TIM_Encoder_Start_DMA(), HAL_TIM_Encoder_Start_IT().
6. The DMA Burst is managed with the two following functions:
HAL_TIM_DMABurst_WriteStart() HAL_TIM_DMABurst_ReadStart()
Which is the reason why I configured the GPIO registers, because it says so in the manual UM1725 page 728. But I´ll try so find a shorter version. Either that or go to the standard library.