当前位置:网站首页>STM32 - external interrupt application (exti) (use cubemx to configure interrupts)
STM32 - external interrupt application (exti) (use cubemx to configure interrupts)
2022-07-28 22:37:00 【Green hedgerow bamboo maple】
stay STM32 in , Most events are invisible , But almost all events are bound with terminal functions , So we usually turn on the interrupt function to use the corresponding event
EXTI: Expand interrupt and event controllers , yes stm32 A peripheral on , It can capture some events such as the level change of external input line ,EXTI After capturing the event , You can also generate corresponding EXTI Some terminals of interrupts and so on
EXTI Of 2 Features : Capture events such as external input , Generate EXTI Interrupt and other interrupt requests

When the level of the input line changes , It will be detected by the edge detection circuit , Then the rising edge trigger selector and the falling edge trigger selector will select this signal , For example, the falling edge trigger register is set , At the same time, the edge detection circuit detects that the level is changed by 1-0, Then this signal will pass through the OR gate , This is the hardware trigger , alike , The interrupt request of the software interrupt event register can also pass through the OR gate , It is called software trigger , The signal passes through the OR gate , If the event shield does not shield the signal , Then the signal will reach the pulse generator , Initiate interrupt request , Goods wake up CPU, The interrupt request will reach the request pending register through the OR gate , If the interrupt mask register does not mask the request suspend register , This interrupt request will be sent to NVIC
Use CubeMX Configure interrupts
1. First, configure the system clock , Select the external crystal oscillator

2. Set the maximum frequency

3. Get into GPIO, Start interrupt configuration , Click on any pin , choice EXTI term
We can refer to the reference manual , Know which event line the pin is on

4. Set the trigger mode

5. Set interrupt priority

6. Code output settings

7. The generated code

The automatically generated code has completed the configuration just now

The generated code can be copied into your own project
The triggering process of interruption :
Trigger EXTI interrupt ,CPU Get the offset stored in the interrupt vector table , That's the entry address , Finally, jump to the interrupt service function
The following are the service functions in the interrupt vector table , When an interrupt is triggered ,CPU It'll be here , Offset according to the terminal number , Get the offset address ,EXTI Be triggered , It will jump to the red box in the following figure

边栏推荐
- Sword finger offer II 055. Binary search tree iterator (medium binary search tree iterator)
- [connect your mobile phone wirelessly] - debug your mobile device wirelessly via LAN
- Ngx+sql environment offline installation log (RPM installation)
- Which is the file transfer command in the basic services of the Internet
- [Ruiji takeout project]day4 - dish management
- XXX port is already in use
- [virtual machine _2]-hyper-v and vmware/virtualbox cannot coexist
- Ruiji takeout - background login function development
- [binary tree] pseudo palindrome path in binary tree
- Ecmasript 5/6 notes
猜你喜欢

Baidu map usage

The function of wechat applet to cut pictures
![[connect set-top box] - use ADB command line to connect ec6108v9 Huawei Yuehe box wirelessly](/img/ab/624e9a3240416f8445c908378310ad.png)
[connect set-top box] - use ADB command line to connect ec6108v9 Huawei Yuehe box wirelessly

842. 排列数字

Ngrok intranet penetration

What are the main functions and uses of LCR tester

Sword finger offer II 052. flatten binary search tree (simple binary search tree DFS)

【CVPR 2021】Cylinder3D:用于LiDAR点云分割的圆柱体非对称3D卷积网络

php二维数组如何删除去除第一行元素

flask之蓝图 补充openpyxl
随机推荐
Ecmasript 5/6 notes
[connect your mobile phone wirelessly] - debug your mobile device wirelessly via LAN
flask之蓝图 补充openpyxl
Container configuration starts redis cluster single machine 6 nodes 3 Master 3 slave
JMeter installs third-party plug-ins plugins Manager
SSH password free login
[leetcode] maximum depth of binary tree
AWK空行过滤
Win11 how to open software notification
使用webWorker执行后台任务
Openresty request authentication
MySQL built-in functions
Leetcode integer exercises integer inversion
Lvs+keepalived high availability deployment practical application
Log4j vulnerability elk platform processing method (logstah5.5.1)
Can the MySQL create statement be used to create a table structure and append new records
[CVPR 2021] cylinder3d: cylindrical asymmetric 3D convolution network for LIDAR point cloud segmentation
gprs网络指的是什么
Ultra detailed visual studio 2019 running littlevgl (lvgl) simulator
Sword finger offer II 058. schedule (medium design segment tree treemap ordered set)