2011-11-20 03:21 AM
I use the STM32F103RTE6, I cannot get the EXT interrupts to happen:
I do the following: - RCC config, all the IO port clock are set RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIO_DISCONNECT|RCC_APB1Periph_TIM2|RCC_APB1Periph_TIM3|RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE | RCC_APB2Periph_AFIO, ENABLE ); - NVIC config, NVIC_PriorityGroupConfig(NVIC_PriorityGroup_3); NVIC_InitStructure.NVIC_IRQChannel = EXTI9_5_IRQChannel|EXTI15_10_IRQChannel; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x1; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); - GPIO config, all the pins declared as inputs GPIO_InitStructure.GPIO_Pin = BUTTON_1|BUTTON_2|BUTTON_3|BUTTON_4; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; GPIO_Init(GPIOC, &GPIO_InitStructure); - EXTI Lines configured ???? Not sure here GPIO_EXTILineConfig(GPIO_PortSourceGPIOA|GPIO_PortSourceGPIOB|GPIO_PortSourceGPIOC, (RF_RX_PIN|BUTTON_1_PIN)); EXTI_InitStructure.EXTI_Line =(EXTI_LINE_RF|EXTI_LINE_BUTTON1); EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; EXTI_InitStructure.EXTI_LineCmd = ENABLE; EXTI_Init(&EXTI_InitStructure); EXTI_GenerateSWInterrupt(BUTTON_1); //test the interrupt !! Nothing ??? The STM32F10x_it.c has all the right functions Any suggestions Thanks Ben2011-11-20 04:43 AM
From your code it is not clear, what pins the buttons are connected to. If they are port pins [0..4] (like PC1, and so on), you should use EXTI0..EXTI4.
2011-11-20 07:30 AM
The PINS are on PORTS PC5 and PC10, accordingly the IRQ handler is supposed to be
void EXTI15_10_IRQHandler(void) I looked at the actual PR and SWIER registers they both show that the INTERRUPT happened when the button was pressed as well as the software INT. HOWEVER the IRQ rourtine is never called, hence somewhere there is still a registered not configured ???? But where. All seems 100% configured when I look in the code of the actual debugger chip regsiters :((((2011-11-20 07:59 AM
Maybe the name of the IRQ routine does not correspond the WEAK declaration of the default IRQ vector?
2011-11-20 08:23 AM
That, or the NVIC_SetVectorTable() is pointing to the wrong address.
GPIO_EXTILineConfig(GPIO_PortSourceGPIOC, BUTTON_1_PIN);2011-11-20 08:54 AM
OK issue found, It it the OR-ING together of the IRQChannels
This works NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQChannel; This doesn`t NVIC_InitStructure.NVIC_IRQChannel = EXTI9_5_IRQChannel|EXTI15_10_IRQChannel; Thx Ben2011-11-20 10:00 AM
Sorry missed that. Some API functions use bit vectors, other use indices, if in doubt look at the source/defines, or find some examples/equivalents.