cancel
Showing results for 
Search instead for 
Did you mean: 

EXT Interrupts not happening ?

benbb
Associate II
Posted on November 20, 2011 at 12:21

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

Ben
6 REPLIES 6
ColdWeather
Senior
Posted on November 20, 2011 at 13:43

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.

benbb
Associate II
Posted on November 20, 2011 at 16:30

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  :((((

ColdWeather
Senior
Posted on November 20, 2011 at 16:59

Maybe the name of the IRQ routine does not correspond the WEAK declaration of the default IRQ vector?

Posted on November 20, 2011 at 17:23

That, or the NVIC_SetVectorTable() is pointing to the wrong address.

GPIO_EXTILineConfig(GPIO_PortSourceGPIOC, BUTTON_1_PIN);

 

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
benbb
Associate II
Posted on November 20, 2011 at 17:54

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

Ben

Posted on November 20, 2011 at 19:00

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.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..