2014-08-13 08:50 AM
With the HAL_TIM_PWM_Start() command CCxNE the flag is not set in the register CCER.
In the initialisation the function HAL_TIM_PWM_ConfigChannel() call TIM_OCx_SetConfig(). Here the flags CCxE and CCxNE in register CCER are reseted. In the function HAL_TIM_PWM_Start() only the flag CCxE ist setted. If I set the flag CCxNE in the debugger, the PWM works fine.Is this a bug
or
do I have to
configure
something else
?
Attached the files generated by STM32CubeMX. The main.c file was supplemented with the timer start. #stm32-complementary-pwm-ccxne2014-09-16 05:32 AM
sConfigOC.OCNPolarity = TIM_OCNPOLARITY_HIGH;
sConfigOC.OCNIdleState = TIM_OCNIDLESTATE_RESET;
Best RegardsWith the HAL_TIM_PWM_Start() command CCxNE the flag is not set in the register CCER.
In the initialisation the function HAL_TIM_PWM_ConfigChannel() call TIM_OCx_SetConfig(). Here the flags CCxE and CCxNE in register CCER are reseted. In the function HAL_TIM_PWM_Start() only the flag CCxE ist setted. If I set the flag CCxNE in the debugger, the PWM works fine.Is this a bug
or
do I have to
configure
something else
? Attached the files generated by STM32CubeMX. The main.c file was supplemented with the timer start.2014-09-17 01:17 AM
Hi
the ''HAL_TIM_PWM_start(..) '' command I see in your main.c is only dedicated to the ''positive channel''. To use the complementary channel , and consequently to set the CCxNE bit of CCER register , another start command have to be called -> HAL_TIMex_PWMN_Start(&htim8,TIM_CHANNEL_3); This function is located in stm32f4xx_hal_tim_ex.h and an include of this .h file is already done in stm32f4xx_hal_tim.h so no need to add it again /* USER CODE BEGIN 2 */ HAL_TIM_Base_Start(&htim6); HAL_TIM_PWM_Start(&htim8,TIM_CHANNEL_3);HAL_TIMex_PWMN_Start(&htim8,TIM_CHANNEL_3);
/* USER CODE END 2 */ hope this help2014-09-23 12:21 AM
Hi
the
additional command
HAL_TIMex_PWMN_Start(&htim8,TIM_CHANNEL_3);
helps.But in the current
HAL
version, it
must
be written as:
HAL_TIM
E
x_PWMN_Start(&htim8,TIM_CHANNEL_3);
Thanks to all
for help