Design advice for asynchronous operations requiring a delay using STM32F7
It has been difficult to find a full example to implement this correctly, but the following should be the proper way to do it (using EXTI0 for interrupt, using TIM2 for delay):

// 216Mhz clock
htim2.Instance = TIM2;
htim2.Init.Prescaler = 0; // PSC
htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
htim2.Init.Period = 216000000-1; // ARR
htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
htim2.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
...
void TIM2_IRQHandler(void)
{
  HAL_TIM_IRQHandler(&amp;htim2);
}
void EXTI3_IRQHandler(void)
{
    __HAL_TIM_SetAutoreload(&amp;htim2, (216.0 * delayInMicroseconds) - 1);
    __HAL_TIM_SetCounter(&amp;htim2, 0);
    HAL_TIM_Base_Start_IT(&amp;htim2);
}
// this is called internally, you just need to define it
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
    if(htim-&gt;Instance == TIM2)
    {
        HAL_TIM_Base_Stop_IT(&amp;htim2);
        HAL_GPIO_WritePin(Triac_Out_GPIO_Port, Triac_Out_Pin, GPIO_PIN_SET);
    }
}


It seems like you can't just dynamically modify htim2.Init.Period frequently, you must call SetAutoreload which changes the Period for you. I tried alternatively calling HAL_TIM_Base_Init() after changing the period but it introduces significant delay - so SetAutoreload is the way to go. After calling it you must also reset the timer counter to 0. In the callback, you need to stop the timer to prevent it from triggering on every interval.

Important Note: In my particular experiment as I was using both TIM2 and TIM3, I noticed TIM3 fires at an insanely fast rate compared to TIM2 with the same settings (on STM32F76xx). It took me a while to figure out the reason, but it's because TIM2 is a 32-bit timer and TIM3 is a 16-bit timer. IMO they (ST) should color code this or display the resolution in the STM32CubeMX software as it was not obvious at all which timers were different. I only discovered it when entering large Period (ARR) values in the UI and it didn't let me set the same value on TIM3, and later discovered this as merely a footnote in the ST STM32 Timer Datasheet . Switching to use TIM5 (the only other 32bit timer) fixed my problem - lost a day to this!