2018-08-19 01:52 AM
I am writing code for the STM32F407G-DISC1 and STM32F760I-EVAL boards. I need to generate external interrupts in software and I need to be able to distinguish which pin (0, 1, 2, ... 15) each software generated interrupt is associated with. I understand that generating interrupts is done using NVIC->STIR, but this does not set any EXTI->PR bit so I can't tell which pin the interrupt is associated with. How can I achieve this? Is it possible to make the microcontroller assert the corresponding EXTI->PR bit, in addition to generating an interrupt in NVIC, somehow through software?
2018-08-19 04:21 AM
> which pin (0, 1, 2, ... 15)
The pins are named PA 0-15, PB 0-15 and so on. STM32 has several GPIO ports.
> I understand that generating interrupts is done using NVIC->STIR, but this does not set any EXTI->PR
EXTI itself can generate software interrupts too, look at the EXTI_SWIER register. This should set bits in EXTI_PR. To see how EXTI entries are associated with GPIO pins, look at SYSCFG_EXTICRn registers.
-- pa
2018-08-19 01:20 PM
if you can declare this function;
HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
it will interrupt you with the EXTI#
2018-08-20 12:42 AM
Thank you, EXTI_SWIER solved my problem perfectly.