The difference between STM32 interrupts and events

Publisher:紫菜包饭Latest update time:2017-09-26 Source: eefocusKeywords:STM32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

This figure is a schematic diagram of an external interrupt line or external event line. There is a slash on the signal line in the figure, and the annotation marked with the word 19 next to it indicates that there are 19 sets of such lines. The blue dotted arrow in the figure marks the transmission path of the external interrupt signal. First, the external signal enters from the chip pin numbered 1, passes through the edge detection circuit numbered 2, enters the interrupt suspension request register through the OR gate numbered 3, and finally outputs to the NVIC interrupt detection circuit through the AND gate numbered 4. This edge detection circuit is controlled by the rising edge or falling edge selection register. The user can use these two registers to control which edge is required to generate an interrupt. Because the selection of the rising edge or falling edge is controlled by two parallel registers respectively, the user can select the rising edge or the falling edge at the same time. If there is only one register control, then only one edge can be selected.

Next is the OR gate numbered 3. The other input of this OR gate is the software interrupt/event register. From this, we can see that the software can request an interrupt or event before the external signal. That is, when the corresponding bit of the software interrupt/event register is "1", the OR gate numbered 3 will output a valid signal regardless of the external signal.

An interrupt or event request signal passes through the OR gate number 3 and enters the suspend request register. Before this, the signal transmission paths of interrupts and events are consistent, that is, the level changes of external signals are recorded in the suspend request register.

The external request signal finally passes through the AND gate No. 4 and sends an interrupt request to the NVIC interrupt controller. If the corresponding bit of the interrupt mask register is "0", the request signal cannot be transmitted to the other end of the AND gate, thus realizing the interrupt masking.

After understanding the request mechanism of external interrupts, it is easy to understand the request mechanism of events. The red dotted arrow in the figure marks the transmission path of the external event signal. After the external request signal passes through the OR gate numbered 3, it enters the AND gate numbered 5. The function of this AND gate is similar to that of the AND gate numbered 4, which is used to introduce the control of the event mask register; finally, a jump signal of the pulse generator is converted into a single pulse and output to other functional modules in the chip. From this figure, we can also know that from the perspective of external excitation signals, the sources of interrupts and events can be the same. The reason why it is divided into two parts is that interrupts require the participation of the CPU, and the software's interrupt service function is required to complete the results generated after the interrupt; but events rely on the pulse generator to generate a pulse , and then the hardware automatically completes the result of this event. Of course, the corresponding linkage components need to be set up first, such as causing DMA operation, AD conversion, etc.;
a simple example: external I/O triggers AD conversion to measure the weight of external objects; if the traditional interrupt channel is used, I/O triggers to generate an external interrupt, the external interrupt service program starts AD conversion, and the interrupt service program submits the final result after the AD conversion is completed; if the event channel is used, the I/O trigger generates an event, and then the linkage triggers AD conversion, and the interrupt service program submits the final result after the AD conversion is completed; in comparison, the latter does not require software to participate in AD triggering, and the response speed is also faster; if the event is used to trigger the DMA operation, some linkage tasks can be completed without software participation.

Summarize:

It can be simply considered that the event mechanism provides a channel from triggering to generating results that is completely completed by hardware automatically, without the involvement of software, reducing the CPU load, saving interrupt resources, and improving the response speed (hardware is always faster than software). It is an effective way to use hardware to improve the CPU chip's ability to handle events;


Keywords:STM32 Reference address:The difference between STM32 interrupts and events

Previous article:STM32 register operation mode learning - GPIO
Next article:STM32 register operation mode learning-clock configuration

Recommended ReadingLatest update time:2024-11-16 09:30

STM32 serial port reception uses DMA double buffering
#define IMAGE_BUFFER_SIZE 100 //In words After testing, increasing this value did not improve the speed u32 Image_Buffer1 ={0}; u32 Image_Buffer2 ={0}; //OV2640 JPEG mode interface configuration void OV2640_JpegDcmiInit(void) { DCMI_InitTypeDef DCMI_InitStructure; DMA_InitTypeDef DMA_InitStructure; NVIC_InitTypeDef
[Microcontroller]
stm32 tick clock systick
The SysTick timer is bundled in the NVIC and is used to generate a SysTick exception (exception number: 15). The Systick part belongs to the NVIC control part. There are 4 registers in total. Their names and addresses are: STK_CSR, 0xE000E010 -- Control register STK_LOAD, 0xE000E014 -- Reload register STK_VAL, 0xE000E
[Microcontroller]
STM32 HardFault_Handler problem debugging method
I believe that many people have encountered the HardFault_Handler error when debugging STM32. People who have just started to use it must be most afraid of this error, because the cause of this problem is difficult to find. I have seen many people on the Internet give better debugging methods. When I debugged again, I
[Microcontroller]
Commonly used sending functions of USART in STM32
1. Interrupt mode void USART2_IRQHandler(void) //Serial port 2 interrupt service routine {  u8 u8Temp;  /*****************Send interrupt****************************************/  if (USART_GetITStatus(USART2, USART_IT_TXE) == SET)  {    if(TX2_cn == TX2_no)   {   DIS_485TX();   USART_ITConfig(USART2, USART_IT_TXE, D
[Microcontroller]
Question about using printf function in stm32
If you want to use printf in mdk, you need to redefine the fputc function and avoid using semihosting (semihosting mode). The default output device of the standard library function is the display. To output to the serial port or LCD, you must redefine the functions related to the output device called in the standard
[Microcontroller]
STM32 multiple serial ports share printf to print serial port data
(1) Problem description:  For multiple serial ports to share the printf function, most of the information found on Baidu suggests rewriting a xx_printf(format, ...). However, it is still inconvenient to use. As far as this problem is concerned, adding a judgment statement can solve it.  (2) Solution:  The printf func
[Microcontroller]
STM32 RCC principle
1. Clock source In STM32, there are 5 clock sources, namely HSI, HSE, LSI, LSE, and PLL.  ①HSI is a high-speed internal clock, RC oscillator, with a frequency of 8MHz;  ②HSE is a high-speed external clock, which can be connected to a quartz/ceramic resonator or an external clock source, with a frequency range of
[Microcontroller]
STM32 RCC principle
STM32 study notes - GPIO from library functions to registers
The example is a "Hello World" level running light experiment for a single-chip microcomputer. Although there is only one, the complete code is not given, but only the key parts are given to explain "how to call ST's library to complete the control of the hardware, and to track and analyze the library file code to the
[Microcontroller]
STM32 study notes - GPIO from library functions to registers
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号