当前位置:网站首页>STM32 --- NVIC interrupt
STM32 --- NVIC interrupt
2022-07-05 08:15:00 【chen_ bx】
STM32---NVIC interrupt
brief introduction
CM3 The kernel support 256 A break , Which includes 16 Kernel interrupts and 240 External interrupts , And have 256 The programmable interrupt settings of the .STM32 Not used CM3 Everything about the kernel , It's just a part of it .STM32 Yes 84 A break , Include 16 Kernel interrupts and 68 Maskable interrupts , have 16 Level programmable interrupt priority .
STM32F103 Above the series , It's just 60 Maskable interrupts ( stay 107 The series has 68 individual )


preemption & Response priority difference :
High priority preemption priority can interrupt the ongoing low preemption priority interrupt .
Preempt interrupts of the same priority , A high response priority cannot interrupt a low response priority interrupt .
Preempt interrupts of the same priority , When two interrupts occur at the same time , Which response has the highest priority , Which comes first .
If the preemption priority and response priority of two interrupts are the same , It depends on which interrupt occurs first ;
Interrupt parameter initialization function
void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct);
The structure is as follows
typedef struct
{
uint8_t NVIC_IRQChannel; // Set interrupt channel
uint8_t NVIC_IRQChannelPreemptionPriority;// Set response priority
uint8_t NVIC_IRQChannelSubPriority; // Set preemption priority
FunctionalState NVIC_IRQChannelCmd; // Can make / Can make
} NVIC_InitTypeDef;
Initialize instance
NVIC_InitTypeDef NVIC_InitStructure;
NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;// A serial port 1 interrupt
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=1 ;// Preemption priority is 1
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2;// Sub priority bit 2
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;//IRQ Channel enable
NVIC_Init(&NVIC_InitStructure); // Initialize... According to the parameters specified above NVIC register
Interrupt priority setting steps
① After the system is running, set the interrupt priority group first . Call function :
void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup);
During the execution of the whole system , Set interrupt packet only once .
② For each interrupt , Set the corresponding preemption priority and response priority :
void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct);
③ If you need to suspend / Jie hang , View the current activation status of the interrupt , Call related functions respectively .
边栏推荐
- [trio basic tutorial 18 from introduction to proficiency] trio motion controller UDP fast exchange data communication
- Introduction of air gap, etc
- 2021-10-28
- Live555 push RTSP audio and video stream summary (I) cross compilation
- Development tools -- gcc compiler usage
- Some thoughts on extracting perspectives from ealfa and Ebeta
- [trio basic tutorial 17 from getting started to mastering] set up and connect the trio motion controller and input the activation code
- Network port usage
- Verilog -- state machine coding method
- Keil use details -- magic wand
猜你喜欢

Brief discussion on Buck buck circuit

Briefly talk about the identification protocol of mobile port -bc1.2

【论文阅读】2022年最新迁移学习综述笔注(Transferability in Deep Learning: A Survey)

Several important parameters of LDO circuit design and type selection

List of linked lists
![Shape template matching based on Halcon learning [viii] PM_ multiple_ models. Hdev routine](/img/13/22a1915329f58acd54c40176f6f301.jpg)
Shape template matching based on Halcon learning [viii] PM_ multiple_ models. Hdev routine

Keil use details -- magic wand

Classic application of MOS transistor circuit design (1) -iic bidirectional level shift

Basic embedded concepts

Management and use of DokuWiki
随机推荐
Halcon's practice based on shape template matching [1]
More than 90% of hardware engineers will encounter problems when MOS tubes are burned out!
My-basic application 2: my-basic installation and operation
C WinForm [change the position of the form after running] - Practical Exercise 4
C WinForm [exit application] - practice 3
Solutions to compilation warnings in Quartus II
导电滑环磨损快的原因
C WinForm [help interface - send email] - practice five
Anonymous structure in C language
Use indent to format code
[trio basic tutorial 17 from getting started to mastering] set up and connect the trio motion controller and input the activation code
Measurement fitting based on Halcon learning [II] meaure_ pin. Hdev routine
Take you to understand the working principle of lithium battery protection board
Embedded composition and route
Soem EtherCAT source code analysis I (data type definition)
Define in and define out
[tutorial 19 of trio basic from introduction to proficiency] detailed introduction of trio as a slave station connecting to the third-party bus (anybus PROFIBUS DP...)
Bluetooth hc-05 pairing process and precautions
STM32 tutorial triple ADC interleaved sampling
What are the test items of power battery ul2580