cancel
Showing results for 
Search instead for 
Did you mean: 

how to use exti event mode?

ctc.ctc
Associate II
Posted on November 13, 2016 at 10:37

I'm using stm32f4discovery to study exti,

I can use exti interrupt mode to get button trigger,

but I have no idea what's the event mode,

I only know event mode will not triger interrupt,

so I do not declare NVIC function and use blow code to get event, but no work,

so how can I use exti event mode ?

if(EXTI_GetFlagStatus(EXTI_LineX) != RESET){

           if(EXTI_GetITStatus(EXTI_LineX) != RESET){

                EXTI_ClearFlag(EXTI_Line5);                                                                        

                do_something(xxxxxx);

     }

}

#exti-event
2 REPLIES 2
Posted on November 13, 2016 at 14:38

Pretty sure EXTI_GetITStatus(EXTI_LineX) is extraneous.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Walid FTITI_O
Senior II
Posted on November 14, 2016 at 10:57

Hi ctc.ctc, 

To configure the EXTI on the bottom pin PA0 you should connect it to EXTI Line 0 as the SYSCFG_EXTICR1 register indicate in reference manual

http://www.st.com/content/ccc/resource/technical/document/reference_manual/3d/6d/5a/66/b4/99/40/d4/DM00031020.pdf/files/DM00031020.pdf/jcr:content/translations/en.DM00031020.pdf

.

To be eable to receive the interrupt/event on the EXTI0 when pushing the buttom, you should proceed like the following:

- Enable clock for both Pin Port (Port A) and SYSCFG peripheral

- Configure the pin (PA0) as input

- Connect EXTI Line0 to PA0 pin through configuring the indicated SYSCFG register

- Configure EXTI Line0 in interrupt mode and rising/ falling or both edge sensitive.

- Configure and enable EXTI Line0 , set it to lowest priority through NVIC register.

Since you are using Standard library, I recommend that you refer to the example ''EXTI_Example'' in

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32-standard-peripheral-libraries/stsw-stm32065.html

, which shows how to configure external interrupt lines. In this example, 2 EXTI lines (EXTI Line0 and Line15) are configured  to generate an interrupt on each rising and falling edge, respectively. 

Example is at this path:STM32F4xx_DSP_StdPeriph_Lib_V1.7.1\Project\STM32F4xx_StdPeriph_Examples\EXTI\EXTI_Example

You can use either the

http://www.st.com/en/embedded-software/stm32cubef4.html

library wich is a HAL library for All STM32 devices.

-Hannibal-