Electrical – use Timer Input capture interrupt and GPIO interrupt on same line

interruptsmicrocontrollerstm32timer

I use Timer Input Capture of STM32L476RG.Is it possible if a timer capture based on interrupt will disable normal EXTI interrupt on the same line? For example TIM2_CH1 can be input capture on PA0. Does it mean I cant use PB0 as a normal external interrupt?

Best Answer

Is it possible if a timer capture based on interrupt will disable normal EXTI interrupt on the same line?

As far as I know, it won't be disabled, both interrupts will be generated according to your timer and EXTI configuration. You can e.g. configure the timer capture interrupt to catch rising edges, and EXTI to catch falling edges.

If both are configured to act e.g. on rising edges, then both interrupt handlers will be called, one after the other. Priority levels in NVIC will decide which interrupt handler runs first, and the other is called immediately when the first handler returns.

For example TIM2_CH1 can be input capture on PA0. Does it mean I cant use PB0 as a normal external interrupt?

You can use both pins at the same time as interrupt sources.

The source for EXTI0 is selected by the SYSCFG->EXTICR1 register bits 0-2. If you write 001 (binary) to these bits

SYSCFG->EXTICR1 = (SYSCFG->EXTICR1 & 0xFFFFFFF80LU) | 1;

then EXTI0 will be connected to PB0, and PA0, PC0 etc will be ignored by EXTI.