AnsweredAssumed Answered

Common Ext IT 15_9, Two Interrupts allways occur

Question asked by m.mueller on Apr 30, 2013
Latest reply on May 6, 2013 by waclawek.jan
Hi together,

I´ve got a problem which I just can not fix... I can´t figure out what is wrong. It would be very kind to help me out.

It´s all about Interrupts. I want to use 3 external Interrupts comming from the Hardware to the 3 Pins. The pins are 13,14,15, so they use the common ISR 15_9.

That part of the code (and Hardware) is an extension of an old Project with only one interrupt.

My Problem is that die both new Interrupts always occur. So i jump every time in the ISR and check which IT occured. both new ITs occure frequently. The voltage on that pins is 3.2 V. Both Interrupts are defined as falling edge.

Thanks for looking through the code and help me! :)


GPIO Pins Settings

#define LID_OVC_PIN GPIO_Pin_13 // GPIOD 13: Overcurrent Pin for the lid (input)#define LID_OVC_SPEED GPIO_Speed_50MHz
#define LID_OVC_MODE GPIO_Mode_IN_FLOATING;
#define LID_OVC_PORT GPIOD
#define LID_OVC_PORT_SOURCE GPIO_PortSourceGPIOC
#define LID_OVC_PIN_SOURCE GPIO_PinSource13
#define LID_OVC_EXTI_LINE EXTI_Line13

#define LID_OVT_PIN GPIO_Pin_14 // GPIOD 14: Overtemperature Pin for the lid (input)
#define LID_OVT_SPEED GPIO_Speed_50MHz
#define LID_OVT_MODE GPIO_Mode_IN_FLOATING;
#define LID_OVT_PORT GPIOD
#define LID_OVT_PORT_SOURCE GPIO_PortSourceGPIOC
#define LID_OVT_PIN_SOURCE GPIO_PinSource14
#define LID_OVT_EXTI_LINE EXTI_Line14

LOCK_OVT_PIN GPIO_Pin_15 // GPIOD 15: Overtemperature Pin for the Block (input)
#define BLOCK_OVT_SPEED GPIO_Speed_50MHz
#define BLOCK_OVT_MODE GPIO_Mode_IN_FLOATING
#define BLOCK_OVT_PORT GPIOD
#define BLOCK_OVT_PORT_SOURCE GPIO_PortSourceGPIOC
#define BLOCK_OVT_PIN_SOURCE GPIO_PinSource15
#define BLOCK_OVT_EXTI_LINE EXTI_Line15

BLOCK_OVT_PIN GPIO_Pin_15 BLOCK_OVT_SPEED GPIO_Speed_50MHz BLOCK_OVT_MODE GPIO_Mode_IN_FLOATING BLOCK_OVT_PORT GPIOD BLOCK_OVT_PORT_SOURCE GPIO_PortSourceGPIOC BLOCK_OVT_PIN_SOURCE GPIO_PinSource15 BLOCK_OVT_EXTI_LINE EXTI_Line15
//------------------------------------------------------------------------------------------------------------------------------
External line definitions
#define EXTI_LINE_OVC_LID EXTI_Line13
#define EXTI_LINE_OVT_LID EXTI_Line14
#define EXTI_LINE_OVT_BLK EXTI_Line15
//------------------------------------------------------------------------------------------------------------------------------

void

ExtInt_Configuration(void)

{
EXTI_InitTypeDef EXTI_InitStructure; 
// EXTI from LID Overcurrent  

GPIO_EXTILineConfig(LID_OVC_PORT_SOURCE, LID_OVC_PIN_SOURCE);
EXTI_InitStructure.EXTI_Line = LID_OVC_EXTI_LINE; //13
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
EXTI_ClearITPendingBit(LID_OVC_EXTI_LINE);
 

// EXTI from LID Overtemp 
GPIO_EXTILineConfig(LID_OVT_PORT_SOURCE, LID_OVT_PIN_SOURCE);
EXTI_InitStructure.EXTI_Line = LID_OVT_EXTI_LINE; //14
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
EXTI_ClearITPendingBit(LID_OVT_EXTI_LINE); 

// EXTI from Block Overtemp 
GPIO_EXTILineConfig(BLOCK_OVT_PORT_SOURCE, BLOCK_OVT_PIN_SOURCE);
EXTI_InitStructure.EXTI_Line = BLOCK_OVT_EXTI_LINE;//15
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
EXTI_ClearITPendingBit(BLOCK_OVT_EXTI_LINE);

 

//------------------------------------------------------------------------------------------------------------------------------

NVIC Config.
There are some more (working) Interrupts here, removed them to keep it short.
pre 0, Sub 0
pre 0, Sub 1
pre 1, Sub 0
pre 1, Sub 1
pre 1, Sub 2
pre 2, Sub 0
pre 3, Sub 0

//Enable the EXTI15_10 Interrupt
NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 4;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);

//------------------------------------------------------------------------------------------------------------------------------

ISR

The first IT is working, which means it does not always occur like the other (new) ones.

void

EXTI15_10_IRQHandler(void)

{
if(EXTI_GetITStatus(EXTI_LINE_OVT) != RESET)
{

if(GPIO_ReadInputDataBit(TEMP_ERR_N_PORT, TEMP_ERR_N_PIN) == 0x00)EH_SetErrorCode(EB_ID_SVC, ERR_OVT);
else
EH_ClearErrorCode(EB_ID_SVC, ERR_OVT); 

// Clear the power fail EXTI line pending bit
//EXTI_ClearFlag(EXTI_LINE_OVT);
EXTI_ClearITPendingBit(EXTI_LINE_OVT);
}

 elseif(EXTI_GetITStatus(EXTI_LINE_OVC_LID) != RESET)
{
if(GPIO_ReadInputDataBit(LID_OVC_PORT, LID_OVC_PIN) == 0x00)
{
EH_SetErrorCode(EB_ID_SVC, ERR_OVC_LID);
EXTI_ClearITPendingBit(EXTI_LINE_OVC_LID);
}
else
EH_ClearErrorCode(EB_ID_SVC, ERR_OVC_LID);
// Clear the power fail EXTI line pending bit/
//EXTI_ClearFlag(EXTI_LINE_OVC_LID);
EXTI_ClearITPendingBit(EXTI_LINE_OVC_LID);

elseif(EXTI_GetITStatus(EXTI_LINE_OVT_LID) != RESET)
{
if(GPIO_ReadInputDataBit(LID_OVT_PORT, LID_OVT_PIN) == 0x00)
{
EH_SetErrorCode(EB_ID_SVC, ERR_OVT_LID);
}
else
EH_ClearErrorCode(EB_ID_SVC, ERR_OVT_LID); 

// Clear the power fail EXTI line pending bit
EXTI_ClearITPendingBit(EXTI_LINE_OVT_LID);
//EXTI_ClearFlag(EXTI_LINE_OVC_LID);

}
}


Thank you very much for helping me!

Outcomes