cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7, end of period interrupt

lonejack
Associate III

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.

1 ACCEPTED SOLUTION

Accepted Solutions
lonejack
Associate III

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

Remove the OnePulse setup and start.

View solution in original post

1 REPLY 1
lonejack
Associate III

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

Remove the OnePulse setup and start.