Skip to main content
alexanderpolleti9
Associate II
July 1, 2015
Question

EXTI occures after disabling it in SYSCFG->EXTICR

  • July 1, 2015
  • 1 reply
  • 814 views
Posted on July 01, 2015 at 12:44

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 #stm32l151
This topic has been closed for replies.

1 reply

waclawek.jan
Super User
July 2, 2015
Posted on July 02, 2015 at 22:48

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