当前位置:网站首页>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 .
边栏推荐
- Management and use of DokuWiki (supplementary)
- 导电滑环磨损快的原因
- Buildroot system for making raspberry pie cm3
- Classic application of MOS transistor circuit design (1) -iic bidirectional level shift
- MySQL之MHA高可用集群
- Detailed explanation of SQL server stored procedures
- STM32 tutorial triple ADC interleaved sampling
- C#,数值计算(Numerical Recipes in C#),线性代数方程的求解,LU分解(LU Decomposition)源程序
- Basic embedded concepts
- STM32 virtualization environment of QEMU
猜你喜欢

Compilation warning solution sorting in Quartus II

Explain task scheduling based on Cortex-M3 in detail (Part 1)

UEFI development learning 5 - simple use of protocol
![Halcon's practice based on shape template matching [1]](/img/68/206eed7502fbf108a929aa9365b1ae.jpg)
Halcon's practice based on shape template matching [1]
![C WinForm [get file path -- traverse folder pictures] - practical exercise 6](/img/8b/1e470de4e4ecd4fd1bb8e5cf23f466.jpg)
C WinForm [get file path -- traverse folder pictures] - practical exercise 6

Beijing Winter Olympics opening ceremony display equipment record 3

Circleq of linked list

Classic application of MOS transistor circuit design (2) - switch circuit design

Arduino uses nrf24l01+ communication

Let's briefly talk about the chips commonly used in mobile phones - OVP chips
随机推荐
Installation and use of libjpeg and ligpng
Ble encryption details
[trio basic from introduction to mastery tutorial 20] trio calculates the arc center and radius through three points of spatial arc
Arduino uses nrf24l01+ communication
Semiconductor devices (III) FET
My-basic application 2: my-basic installation and operation
Management and use of DokuWiki (supplementary)
C#,数值计算(Numerical Recipes in C#),线性代数方程的求解,LU分解(LU Decomposition)源程序
Sql Server的存儲過程詳解
Talk about the circuit use of TVs tube
Programming knowledge -- basis of C language
Matlab2018b problem solving when installing embedded coder support package for stmicroelectronic
Network communication model -- Network OSI tcp/ip layering
Design a clock frequency division circuit that can be switched arbitrarily
Drive LED -- GPIO control
The firmware of the connected j-link does not support the following memory access
Detailed explanation of pragma usage
Consul installation
Network communication process
Soem EtherCAT source code analysis I (data type definition)