Skip to main content
Graduate
May 1, 2024
Solved

STM32H7, end of period interrupt

  • May 1, 2024
  • 1 reply
  • 970 views

Hi, I'm using a timer to create a software delay on a high prio task (HPTask with FreeRTOS).
The MCU used is STM32H755ZI.

My target is:

  • use a timer and arm an interrupt which duration will be 250 usec;
  • suspend the HPTask
  • on the timer END PERIOD interrupt restart the HPTask

To reach this result I used TIM17 and OnePulse API.
This is my setup on main from CubeMX:

htim17.Instance = TIM17;
htim17.Init.Prescaler = 200;
htim17.Init.CounterMode = TIM_COUNTERMODE_UP;
htim17.Init.Period = 10000;
htim17.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
htim17.Init.RepetitionCounter = 0;
htim17.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
if (HAL_TIM_Base_Init(&htim17) != HAL_OK)
{
Error_Handler();
}
if (HAL_TIM_OnePulse_Init(&htim17, TIM_OPMODE_SINGLE) != HAL_OK)
{
Error_Handler();
}
This is my setup to generate the delay:
HAL_TIM_Base_Init(&htim17);
HAL_TIM_Base_Start_IT(&htim17);
HAL_TIM_OnePulse_Start(&htim17, 0U);

Now...  I reached something that is usable but not exactly what I want.
The interrupt receives two events. Before to start and at the end of the pulse.
Is it possible (also adopting different strategies) to get only on single interrupt at the end of the period?
Thank you in advance,
C.

    This topic has been closed for replies.
    Best answer by lonejack

    My mistake, lack of knowledge on this framework...

    Remove the OnePulse setup and start.

    1 reply

    lonejackAuthorAnswer
    Graduate
    May 6, 2024

    My mistake, lack of knowledge on this framework...

    Remove the OnePulse setup and start.