2015-07-01 03:44 AM
Hello everybody,
I am developing an application with external interrupts on a falling edge of Pin PB3 on an STM32l151VB. With reuse of code I initialize the EXTI line twice using the function ''SYSCFG_EXTILineConfig''. While the second initialization the interrupt suddenly arises without the pin going down (checked with oscilloscope). The exact location is after removing the PORTB from the EXTICR1[3] field. From stm32l1xx_syscfg.c: tmp = ((uint32_t)0x0F) << (0x04 * (EXTI_PinSourcex & (uint8_t)0x03)); SYSCFG->EXTICR[EXTI_PinSourcex >> 0x02] &= ~tmp; No interrupt is pending right before I call the routine. The workaround is to simply not initialize the exti twice. I'd like to know why the interrupt occures nonetheless in order to understand what's going wrong. Thanks for your answers Alexander #exti #interrupts #stm32l1512015-07-02 01:48 PM
This is a well-deserved punishment for using the ''library'' ;)
The line SYSCFG->EXTICR[EXTI_PinSourcex >> 0x02] &= ~tmp; switches the output of the multiplexer from PB3 to PA3, and the subsequent line switches it back. If they are of opposite polarity, this creates both edges for the subsequent edge detector in the EXTI module. JW