cancel
Showing results for 
Search instead for 
Did you mean: 

[CubeMX BUG/REQUEST] add USER CODE to HAL_TIM_PeriodElapsedCallback if a timer is used for timebase (freertos)

valentin
Senior
Posted on May 18, 2016 at 01:20

The title says it all.

I'm using the freertos middleware and configured CubeMX to use tim7 as timebase.

As a result, CubeMX generates the stm32f3xx_hal_timebase_TIM.c file and in there defines the IRQ Callback

void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)

{

  HAL_IncTick();

}

This is rather unfortunate, though, as without user code I cannot modify it to use other timers as well.

Suggestion, change it to:

void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)

{

/* USER CODE START 1 */

/* USER CODE END 1 */

if (htim->Instance == TIMxx) {

  HAL_IncTick();

}

/* USER CODE START 2 */

/* USER CODE END 2 */

}

And place this at the bottom of the main.c file. Otherwise I cannot include needed headers etc.

NOTE: TIMxx is the timer which was selected as timebase.

Thanks!
4 REPLIES 4
Walid FTITI_O
Senior II
Posted on May 18, 2016 at 15:53

Hi Valentin,

I will communicate your feedback to our CubeMx team .

-Hannibal-

valentin
Senior
Posted on June 07, 2016 at 04:41

Thanks a lot!

stm32cube-t
Senior III
Posted on October 06, 2016 at 17:22

Dear Valentin,

Issue fixed since STM32CubeMX release 4.15.

Best regards

valentin
Senior
Posted on October 24, 2016 at 22:35

Great job!

Thanks for fixing that!