Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of STM32 interrupts and events

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail the example analysis of STM32 interruptions and events. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

An analogy of the three concepts of event, interruption and interruption

For example, a teacher gives lessons to the students in the classroom. Students in class may make all kinds of actions, such as taking notes, gasping, flipping through schoolbags, talking, etc., which are collectively referred to as events, some of which the teacher often turns a blind eye to and continues his class; while some behaviors may lead to the suspension of the teacher's class, such as talking, and warning, criticizing or correcting the students' behavior, and then continue the class. We take the teacher to stop teaching because of some behavior of the students, and produce follow-up actions, and then the process of class is understood as an interruption or interruption response. We interpret the student behavior that may lead to the interruption of the teacher's class as an interruption event.

Combined with the specific running process of ST MCU

In the process of ST MCU operation, there will be many kinds of events, such as pin level change, counter overflow, DMA null, FIFO non-null, AD conversion end, timeout, peripheral enable, initialization, etc., some of these events will not cause interrupts, such as peripheral enable or partial initialization actions will not cause interrupts, some events may lead to interrupts, such as counter overflow The end of the AD conversion, etc., these are interrupt events. Of course, whether these interrupt events can eventually trigger subsequent interrupts depends on whether the interrupt enable of the interrupt event is enabled, whether the relevant interrupt vector controller [NVIC] is configured, and finally let the CPU kernel participate and complete the subsequent interrupt service actions.

Since an event that can trigger an interrupt may be configured with an interrupt event or a non-interrupt event, there are two possibilities in the trigger configuration of the related event, namely, to allow the generation of interrupts or to prohibit the generation of interrupts. As a result, the concepts of event mode and interrupt mode are introduced in the ST MCU reference manual when it comes to how events are triggered.

Examples

For example, the level jump of the GPIO port of STM32 can basically trigger external interrupts. However, in the specific configuration, we can decide whether to enable or disable the interrupt function of the related feet according to the need, so as to choose different event triggering modes, namely event mode and interrupt mode. If you do not want the level jump event to trigger an interrupt, configure it to event mode, otherwise, configure it to interrupt mode

Conceptual distinction

Interrupts that need to be triggered and handed over to NVIC to handle, that is, those with interrupt functions in the software, are called interrupts.

Do not trigger the interrupt, directly to the peripheral (rg,ADC), there is no interrupt function on the software, called the event.

If an interrupt is triggered and there is an interrupt function in the software, it is called an interrupt event.

This is the end of the article on "sample Analysis of STM32 interruptions and events". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report