cancel
Showing results for 
Search instead for 
Did you mean: 

STM32Cube: TIM OnePulse/PWM/OC configuration issue

cube sphere
Associate II
Posted on July 30, 2014 at 12:31

Hi,

setting up timer TIM1 in OnePulse mode does not work on channel 3 and 4.

As I figured out, only channels 1 and 2 are handled by HAL_TIM_OnePulse_ConfigChannel.

Finally, I have the following issues to be discussed.

Any comments are welcome.

1. The controller reference manual does not contain such a restriction. Does anyone can tell why channels beyond 2 are disallowed?

2. Why does a configuration request for channels 3 and 4 response with HAL_OK despite they are not accepted by the function HAL_TIM_OnePulse_ConfigChannel?

3. There is a missing assertion in HAL_TIM_PWM_ConfigChannel:

assert_param(IS_TIM_FAST_STATE(sConfig->OCFastMode));

In function HAL_TIM_OC_ConfigChannel there is such a assertion despite this configuration parameter is not used.

Thanks.

#stm32cube-onepulse-pwm
1 REPLY 1
Posted on September 11, 2014 at 10:59

Hisphere,

You can find below answers to your questions:

1.

There is no really such restriction to use Timer in the One Pulse mode. You've just to call HAL_TIM_OnePulse_Init() to Set/Reset the OPM bit. If you need to implement, in addition, the example described within the reference manual, where a TIM channel is used as a trigger and another one as an output channel for the one pulse generated signal, you can use the following provided APIs:

HAL_TIM_OnePulse_Start()
HAL_TIM_OnePulse_ConfigChannel()

By the way, the STM32CubeMX tool offers, a checkbox ''one pulse'' to enable/disable the OPM bit.

2.

Although they are not accepted by the function HAL_TIM_OnePulse_ConfigChannel(), the configuration requests for channels 3 and 4 response with HAL_OK. This is due to the disable of the IS_TIM_OPM_CHANNELS assert.

3.

Yes, we confirm that an assert is missed. In fact, the fast mode acts only in PWM mode. 0690X00000603QzQAI.jpgThus, the OCFastMode parameter is not used in this case, and the assert should be removed, because we don't care on its value. We take all feedbacks and suggestions into consideration and are working hard to improve the STM32Cube experience for everyone. Regards.