cancel
Showing results for 
Search instead for 
Did you mean: 

Bug Report: HAL_TIM_OnePulse_Start() [STM32CubeF2 V1.9]

PPark.1
Associate II

HAL_TIM_OnePulse_Start() sets both Channel 1 and Channel 2 output enable bits. This results in a conflict with the input signal.

/**

 * @brief Starts the TIM One Pulse signal generation.

 * @param htim TIM One Pulse handle

 * @param OutputChannel 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

 * @retval HAL status

 */

HAL_StatusTypeDef HAL_TIM_OnePulse_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel)

{

 /* Prevent unused argument(s) compilation warning */

 UNUSED(OutputChannel);

 /* Enable the Capture compare and the Input Capture channels

  (in the OPM Mode the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2)

  if TIM_CHANNEL_1 is used as output, the TIM_CHANNEL_2 will be used as input and

  if TIM_CHANNEL_1 is used as input, the TIM_CHANNEL_2 will be used as output

  in all combinations, the TIM_CHANNEL_1 and TIM_CHANNEL_2 should be enabled together

  No need to enable the counter, it's enabled automatically by hardware

  (the counter starts in response to a stimulus and generate a pulse */

 TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE);

 TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_ENABLE);

 if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)

 {

  /* Enable the main output */

  __HAL_TIM_MOE_ENABLE(htim);

 }

 /* Return function status */

 return HAL_OK;

}

The comment in the code appears to misunderstand the meaning of enabling the input channel - the CCnE bit in the TIMx_CCER register is the Output Enable, and therefore should not be set for the input channel.

The unused OutputChannel channel parameter should therefore be used to determine which channel should be enabled as the output, and only that channel should have its CCnE bit set.

2 REPLIES 2
eBirdman
Senior

Two years later I have the same function bug in STM32H7 Cube library. Still ignores the Output Channel passed parameter and enables Channel 1 and 2 instead.

Are the bug reports ignored?

>>Are the bug reports ignored?

Well I don't think there's a specific person or daemon you getting stuff flags and logged into the internal bug management system.

This coupled with generally quite poor QA, any real-world usage/testing, tend to make things more frustrating than necessary.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..