cancel
Showing results for 
Search instead for 
Did you mean: 

Common Ext IT 15_9, Two Interrupts allways occur

a_
Associate II
Posted on April 30, 2013 at 08:37

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

&sharpdefine

LID_OVC_PIN GPIO_Pin_13

// GPIOD 13:

Overcurrent

Pin for the lid (input)

&sharpdefine

LID_OVC_SPEED GPIO_Speed_50MHz

&sharpdefine

LID_OVC_MODE GPIO_Mode_IN_FLOATING;

&sharpdefine

LID_OVC_PORT GPIOD

&sharpdefine

LID_OVC_PORT_SOURCE GPIO_PortSourceGPIOC

&sharpdefine

LID_OVC_PIN_SOURCE

GPIO_PinSource13

&sharpdefine

LID_OVC_EXTI_LINE EXTI_Line13

&sharpdefine

LID_OVT_PIN GPIO_Pin_14

// GPIOD 14:

Overtemperature

Pin for the lid (input)

&sharpdefine

LID_OVT_SPEED GPIO_Speed_50MHz

&sharpdefine

LID_OVT_MODE GPIO_Mode_IN_FLOATING;

&sharpdefine

LID_OVT_PORT GPIOD

&sharpdefine

LID_OVT_PORT_SOURCE GPIO_PortSourceGPIOC

&sharpdefine

LID_OVT_PIN_SOURCE GPIO_PinSource14

&sharpdefine

LID_OVT_EXTI_LINE EXTI_Line14

LOCK_OVT_PIN GPIO_Pin_15

// GPIOD 15:

Overtemperature

Pin for the Block (input)

 

&sharpdefine

BLOCK_OVT_SPEED GPIO_Speed_50MHz

 

&sharpdefine

BLOCK_OVT_MODE GPIO_Mode_IN_FLOATING

 

&sharpdefine

BLOCK_OVT_PORT GPIOD

 

&sharpdefine

BLOCK_OVT_PORT_SOURCE GPIO_PortSourceGPIOC

 

&sharpdefine

BLOCK_OVT_PIN_SOURCE GPIO_PinSource15

 

&sharpdefine

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

&sharpdefine

EXTI_LINE_OVC_LID EXTI_Line13

&sharpdefine

EXTI_LINE_OVT_LID EXTI_Line14

&sharpdefine

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);

}

 

else

if

(

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);

else

if

(

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!

#exti
4 REPLIES 4
jpeacock2399
Associate II
Posted on April 30, 2013 at 15:51

Nothing obvious in the code, but it might be related to the incoming signal.

First, what happens if more than one IRQ triggers?  Your service routine only checks for the firsta ctive and ignores the rest.  That menas as soon as you exit the service routine is called again.

Second, it looks like you check for a low on the pin after an interrupt request.  Since it's edge triggered there's no guarantee the pin will still be low by the time you poll it.  It is implicit that the pin was low long enough to trigger the interrupt; you don't need to poll it unless it's a noisy input...in which case you will be getting spurious interrupts.

It's not clear from description just what the problem is.  It sounds like the interrupt routine is working.

  Jack Peacock

a_
Associate II
Posted on May 03, 2013 at 07:19

Thanks for caring for my code!

A few things:

- Polling the Pins: I actually have noisy pins which trigger that Interrupt. In normal condition of the device the pins are never supposed to drops down. If one pin drops down and causes an interrupt, it stays down. It only becomes when as soon as i enter the ISR (this is the idea)

- More Interrupts at the same time: Is really no Problem. I have a lot of time to Response. So it doesnt matter if a handle a particular Interrupt at the second jump in the ISR

My problem is, in the debug board I´m working on right now that all 3 debug lines are nailed to 3.1V but the two new Interrupts still occur. They occur all the time. If my program is running and I set a breakpoint in the ISR after

'' else

if

(

EXTI_GetITStatus

(EXTI_LINE_OVT_LID) !=

RESET

) '' ((EXTI_LINE_OVT_LID) != ) ''it stops. Which means there kind of was an Interrupt - but on the hardware side, there cannot be an Interrupt whin steady high pins.

Thanks a lot.
a_
Associate II
Posted on May 06, 2013 at 12:49

Weekend helps finding Errors :)

The Problem was that position of GPIO_EXTILineConfig!

I configured the first line, and then set the Parameters to init that particular line.

After that, I configured the next line and initiated it.

I kind of handled the Lines (config, init) in blocks or ''in a row''

It actually has to be that first of all, all configurations of my 3 lines need to be done. After that all lines can be initiated.

I´m just telling to inform u about that, maybe it will be interesting for you once!

Wish u a pleasant week :)
Posted on May 06, 2013 at 13:26

>It actually has to be that first of all, all configurations of my 3 lines need to be done. After that all lines can be initiated.

I fail to see why would that make any difference.

JW