Lanqiao Cup Embedded-Interrupt Related

Foreword :
I wrote this blog. On the one hand, I am now in the review stage, consolidating the knowledge I learned more than two months ago, and forgot a lot (this is also the main purpose of writing notes). On the other hand, I share the problems I encountered when learning embedded and some pitfalls for Xiaobai.

First, clarify a few concepts, so that it is convenient to understand and not rote:

Interrupts are not peripherals!

The CM3 core supports 256 interrupts, 16 core interrupts and 240 external interrupts, and has 256 levels of programmable interrupt settings. But stm32 does not use all of the CM3 kernel.

STM32 has 84 interrupts, of which 16 core interrupts and 68 maskable interrupts, with 16 programmable interrupt priority levels, the F103 series is a bit less, only 60 maskable interrupts.

Interrupt management method: Group STM32 interrupts, group 0~4, and set a preemption priority and response priority for each interrupt.

Regarding preemption and response, it must be clear: preempt interrupts with the same priority,High response priority cannotInterrupt interrupts with low response priority. When the preemption priority is the same and two interrupts occur at the same time, the one with the higher response priority is executed first. and alsoThe smaller the value, the higher the priority

Generally, only one interrupt priority group is set.

Functions related to interrupt settings are in the misc.c file. The name of each interrupt service function should be found in the startup file startup_stm32f10x_md.s.

Specific configuration steps:

1. Determine the interrupt group (I usually write it at the beginning of the main function, after all, a project is only set once)
2. Call NVIC——Init() to configure the interrupt function.
3. Write interrupt service function.

Just write this, think of it and add it~~

Guess you like

Origin blog.csdn.net/qq_43690936/article/details/105158264