AnsweredAssumed Answered

Problem with multiple EXTI on the same Port

Question asked by tainado on Aug 19, 2013
Latest reply on Oct 29, 2014 by Ahmed Talaat
Hey guys !

I have a problem with my STM32F100 Board - I'd like to have PC.0 as EXTI_Line_0 and PC.1 as EXTI_Line_1.

Here is my configuration:
01.EXTI_InitTypeDef EXTI_InitStructure;
02.NVIC_InitTypeDef NVIC_InitStructure;
03.GPIO_InitTypeDef GPIO_InitStructure;
04. 
05./* Enable GPIO Port C */
06.RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC,ENABLE);   
07. 
08./* PC.12 as Output (LED) */
09.GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12;
10.GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
11.GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
12.GPIO_Init(GPIOC, &GPIO_InitStructure);
13.     
14./* Inputs and EXTI */
15.GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_0 | GPIO_Pin_1 ;
16.GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;      
17.GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;  
18.GPIO_Init(GPIOC, &GPIO_InitStructure); 
19. 
20./* Selects PC Pins as EXTI Lines */
21.GPIO_EXTILineConfig(GPIO_PortSourceGPIOC, GPIO_PinSource0);
22.GPIO_EXTILineConfig(GPIO_PortSourceGPIOC, GPIO_PinSource1);
23.           
24./* Configure two bit for preemption priority */
25.NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
26. 
27./* EXTI */
28.NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQChannel;
29.NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
30.NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
31.NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
32.NVIC_Init(&NVIC_InitStructure);
33. 
34.NVIC_InitStructure.NVIC_IRQChannel = EXTI1_IRQChannel;
35.NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
36.NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
37.NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
38.NVIC_Init(&NVIC_InitStructure);
39.     
40.EXTI_InitStructure.EXTI_Line = EXTI_Line0;      // PC.0
41.EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
42.EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;     
43.EXTI_InitStructure.EXTI_LineCmd = ENABLE;
44.EXTI_Init(&EXTI_InitStructure);
45. 
46.EXTI_InitStructure.EXTI_Line = EXTI_Line1;      // PC.1
47.EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
48.EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;     
49.EXTI_InitStructure.EXTI_LineCmd = ENABLE;
50.EXTI_Init(&EXTI_InitStructure);

The IRQ Handlers are configured to do nothing but toggle a LED:
01.void EXTI0_IRQHandler(void)
02.{
03.    if(EXTI_GetITStatus(EXTI_Line0) != RESET)
04.    // Ensure get EXTI line 0 pending bit
05.    {
06.         
07.        GPIO_WriteBit(GPIOC,GPIO_Pin_12, 1);
08. 
09.        EXTI_ClearITPendingBit(EXTI_Line0);
10.        // Clear the EXTI line 0 pending bit
11.    }
12.}
13. 
14. 
15.void EXTI1_IRQHandler(void)
16.{
17.    if(EXTI_GetITStatus(EXTI_Line1) != RESET)
18.    // Ensure get EXTI line 1 pending bit
19.    {
20.         
21.        GPIO_WriteBit(GPIOC,GPIO_Pin_12, 0);
22. 
23.        EXTI_ClearITPendingBit(EXTI_Line1);
24.        // Clear the EXTI line 1 pending bit
25.    }
26.}

My problem now is, that EXTI1 IRQ handler is never executed, and EXTI0 IRQ is executed by PC.1!

How is this possible? Did I forget something in the configuration? 

I am assuming that the wiring is correct.

thanks in advance

Outcomes