Question
Cannot set EXTICR register in STM32F205
Posted on June 21, 2012 at 00:14
Following the example for the STM3240G I set up the KEY pushbutton (PG15) as an external interrupt:
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOG, ENABLE); // enable port
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE); // enable external interrupts
SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOG, EXTI_PinSource15); // KEY switch IRQ
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; // inputs
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; // external pull-ups
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; // slow inputs
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15;
GPIO_Init(GPIOG, &GPIO_InitStructure); // PG15 KEY pushbutton
// Enable the EXTI line 15 on falling edge for KEY pushbutton
EXTI_ClearITPendingBit(EXTI_Line15); // clear pending IRQs
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Line = EXTI_Line15; // set up irq trigger
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; // falling edge on button push
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn; // KEY irq vector (shared)
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = GPIODEV_EXT_PRIORITY;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
I verified the SYSCFG is enabled, RCC_APB2ENR is set to 0x4000 (SYSCFG clock on). However, after I do the
SYSCFG_EXTILineConfig call the SYSCFG->EXTICR4 register is still set to 0x0000. Pin PG15 is not linked to EXTI No interrupt occurs.
Is there some setting which holds SYSCFG in reset? The obvious suspect is the SYSCFG peripheral clock but it shows as enabled.
The PG15 pin itself is working. The pushbutton shows up in the GPIOG->IDR register, so the problem seems to be the SYSCFG EXTICRn registers. I tried directly writing to the EXTICR4 register (0x6000, G15) but it reads back as zero.
Jack Peacock
#syscfg-exti