STM32 learning EXTI

Publisher:独行于世Latest update time:2018-10-07 Source: eefocusKeywords:STM32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

EXTI has two functions: one is to generate an interrupt, the purpose is to pass the input signal to NVIC, further run the interrupt service function, realize the function, at the software level; the other is to generate an event, the purpose is to generate a pulse signal for other peripherals to use, this is the circuit level signal transmission, at the hardware level. EXTI is mounted on the APB2 bus. EXTI0 to EXTI15 are used for GPIO, and EXTI16-EXTI22 are used for specific peripheral interrupt/event lines.

1. Initialize the GPIO that needs to be interrupted

2. Initialize EXTI to generate interrupts/events

Enable SYSCFG clock. To use GPIO external interrupt, you must enable SYSCFG clock.

Connect the EXTI interrupt source to the GPIO

Initialize the EXTI structure

1.EXTI interrupt/event line selection, EXTI_Line:EXTI_Line0 -EXTI_Line22 selection, but in the STM32 library function there is also External interrupt line 23 Connected to the LPTIM Wakeup event.

2.EXTI_Mode mode selection, choose to generate interrupt or generate event

3.EXTI_Trigger, select rising edge trigger or falling edge trigger

4.EXTI_LineCmd, whether to enable the EXTI line

Select EXTI interrupt source

3. Configure NVIC

Configuring NVIC Priority Groups

Configuring interrupt sources

Configuring preemption priority

Configure the priority of grabbing children

Enable interrupt channel 

4. Write interrupt service function


Keywords:STM32 Reference address:STM32 learning EXTI

Previous article:STM32 Learning IIC
Next article:STM32 learning DMAM-M mode

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号