当前位置:网站首页>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

边栏推荐
- 96. Different binary search trees (medium binary search tree dynamic planning)
- 2022年一级建造师考试什么时候才能报名?
- 776. 字符串移位包含问题
- Summary of common error types in JS
- imx6q gpio复用
- 842. 排列数字
- [virtual machine _2]-hyper-v and vmware/virtualbox cannot coexist
- 770. 单词替换
- Use REM to make the font size adaptive to the screen
- Research cup element recognition multi label classification task based on ernie-3.0 cail2019 method
猜你喜欢

imx6q gpio复用
![[CS231N]Lecture_ 2:Image Classification pipelin](/img/4f/de56b071560ada746c587a9dbc5f02.jpg)
[CS231N]Lecture_ 2:Image Classification pipelin

软考网络工程师

基于Ernie-3.0 CAIL2019法研杯要素识别多标签分类任务

JMeter installs third-party plug-ins plugins Manager

Ruiji takeout project - development of business development function Day2

(翻译)图技术简明历史

微信小程序剪切图片的功能

XXX port is already in use

Sword finger offer II 052. flatten binary search tree (simple binary search tree DFS)
随机推荐
使用webWorker执行后台任务
SQL injection less34 (post wide byte injection + Boolean blind injection)
771. 字符串中最长的连续出现的字符
The blueprint of flask complements openpyxl
When can I sign up for the 2022 class I constructor examination?
2021 mathematical modeling group B exercise
20-09-27 the project is migrated to Alibaba toss record (the network card order makes the service unable to connect to DB through haproxy)
Sword finger offer II 053. Medium order successor in binary search tree (medium binary search tree DFS)
Sword finger offer II 055. Binary search tree iterator (medium binary search tree iterator)
MySQL command (add, delete, check and modify)
Closure, prototype and original link
mysql create语句能不能用来建立表结构并追加新的记录
[connect your mobile phone wirelessly] - debug your mobile device wirelessly via LAN
Lotus 1.16.0 extend sector expiration time
Ruiji takeout project - development of business development function Day2
AWK空行过滤
Why doesn't the icon on the elment plus icon input display
职场pua但有道理
Lvs+keepalived high availability deployment practical application
98. Verify binary search tree (medium binary search tree DFS)