how long an interrupt handler executes
i want to measure the time an interrupt handler costs.
1. set a specified pin low at the beginning of the interrupt handler and high at the end of the interrupt handler like this:
void EXTI4_IRQHandler(void)
{
/* USER CODE BEGIN EXTI4_IRQn 0 */
HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_RESET);
/* USER CODE END EXTI4_IRQn 0 */
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_4);
/* USER CODE BEGIN EXTI4_IRQn 1 */
// ...
// codes omitted
// ...
HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_SET);
}2. measure the signal at the pin by an oscilloscope.
then the duration the signal keeps low is the time an interrupt costs.
is it possible to measure the duration in units of us?