NVIC of stm32f407

Publisher:独行侠客Latest update time:2018-09-20 Source: eefocusKeywords:stm32f407  NVIC Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

5. NVIC


       The interrupt vector nesting controller is used to manage all interrupts and events, including interrupt enable and disable, and interrupt priority. This belongs to the kernel, so ST's reference manual has little description of it, but it is very important. To understand it, you need to read ARM's "Cortex™-M4 Devices Generic User Guide".

 

Related registers

Translated from "Cortex™-M4 Devices Generic UserGuide". If there are any errors, please refer to the original text.

 

Interrupt enable register NVIC_ISER[8]

There are 8 interrupt enable registers in total. ISER[0] sets the enable of interrupts 0 to 31, ISER[1] sets the enable of interrupts 32 to 63, and so on. The following takes ISER[0] as an example:


[31:0] SETENA Interrupt Set Enable Bit.
Write:
0 = No effect
1 = Enable interrupt.
Read:
0 = Interrupt is disabled
1 = Interrupt is enabled

To enable interrupt 0, write 1 to bit 0 of the register. To enable interrupt 38, write 1 to bit 6 of NVIC_ISER[1], and so on. For information on which interrupt corresponds to which interrupt number, refer to the Position column in Chapter 9, Table 30. Vector table in the reference manual "RM0090 Reference manual".

 

 

 

Interrupt disable register NVIC_ICER[8]

There are 8 interrupt disable registers in total. ICER[0] sets interrupts 0 to 31 to disable, ICER[1] sets interrupts 32 to 63 to enable, and so on. The following takes ICER[0] as an example:


[31:0] SETENA Interrupt Set Enable Bit.
Write:
0 = No effect
1 = Disable interrupt.
Read:
0 = Interrupt is disabled
1 = Interrupt is enabled

The following registers are all 8, only ***R[0] is used as an example

 

 

 

Interrupt pending setting register NVIC_ISPR[8]


[31:0] SETPEND interrupt pending set bit.
Write:
0 = No effect
1 = Change interrupt status to pending.
Read:
0 = Interrupt is not pending
1 = Interrupt is waiting to be processed.

 

 

 

Release interrupt pending register NVIC_ICPR[8]


[31:0] CLRPEND interrupt clear pending bit.
Write:
0 = No effect
1 = Remove pending state of interrupt.
Read:
0 = No interrupt is pending
1 = Interrupt is pending.

 

 

 

Interrupt activation bit register NVIC_IABR[8]


[31:0] Interrupt active flag:
0 = Interrupt inactive
1 = Interrupt active.

Reading this bit will read 1 if the corresponding interrupt status is as an active or active and pending.

 

 

 

 

Interrupt Priority Register NVIC_IPR[60]


       The interrupt priority registers are 60 32-bit registers, and the st structure uses 240 8-bit byte arrays NVIC->IP[240] to map them, each corresponding to an interrupt priority.

There are two types of ARM interrupt priorities: preemption priority and response priority.

        An interrupt with a high preemptive priority can be responded to during the interrupt processing with a low preemptive priority, that is, interrupt nesting, or an interrupt with a high preemptive priority can nest an interrupt with a low preemptive priority.

         When the preemptive priority of two interrupt sources is the same, there will be no nesting relationship between the two interrupts. When one interrupt arrives, if another interrupt is being processed, the later interrupt will have to wait until the previous interrupt is processed. If the two interrupts arrive at the same time, the interrupt controller decides which one to process first based on their response priority; if their preemptive priority and response priority are equal, the order of their ranking in the interrupt table determines which one to process first.

        Interrupt priority grouping is to divide the priority register, separating which bits are response priority and which bits are preemption priority. As for how to set the grouping, it depends on a register that does not belong to NVIC.

 

 

 

Application interrupt and reset control register SCB_AIRCR


What we need to look at here are bits [31:16] and [10:8]. Bits [31:16] are identification codes used to protect this register from accidental modification, and bits [10:8] are the setting bits for the interrupt priority grouping.

[31:16]

Write: VECTKEYSTAT
Read: VECTKEY
RW Registration key:
Read as 0xFA05
When writing, write 0x05FA to VECTKEY, otherwise the write will be ignored.

 

[10:8] Interrupt priority

Each ARM M4 interrupt priority is designed to be 8-bit programmable. Specifically, stm32f4 only leaves 4 bits of 16 levels of programmable priority for the user, of which the lower 4 bits are occupied. That is to say, the priority grouping of stm32f4 is shown in the following table:

[10:8]

Split Point

Preemption priority bit

Response priority bit

Preemption priority number

Response priority number

0b011

xxxx

[7:4]

none

16

1

0b100

xxx.y

[7:5]

[4]

8

2

0b101

xx.yy

[7:6]

[5:4]

4

4

0b110

x.yyy

[7]

[6:4]

2

8

0b111

yyyy

none

[7:4]

1

16

 

 

 

The last NVIC register

Software trigger interrupt register NVIC_STIR


When the USERSETMPEND bit of SCB_CCR is 1, unprivileged user programs can write to this register.

[31:9] Reserved.
[8:0] INTID ID number interrupt trigger,
range 0-239. For example, 0x03 specifies interrupt IRQ3 trigger.


Keywords:stm32f407  NVIC Reference address:NVIC of stm32f407

Previous article:EXTI (operation register) of stm32f407
Next article:DAC of stm32f407 (operation register)

Recommended ReadingLatest update time:2024-11-16 20:47

Summary of driver modification errors for STM32F407 Ethernet external clock source
In the sample code: void ETH_GPIO_Config(void) {      GPIO_InitTypeDef GPIO_InitStructure;     /* Enable GPIOs clocks */     RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOB |                          RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOE |                          RCC_AHB1Periph _GPIOG, ENABL
[Microcontroller]
STM32F407 implements matrix keyboard program
I'm working on a project related to buttons recently, and I use a matrix keyboard. There are few programs related to matrix keyboards on the Internet, so I wrote one and posted it for your reference. The GPIO ports used in the program are PD0--PD7. As for the principle of the matrix keyboard, I won't describe it one b
[Microcontroller]
STM32F405 and STM32F407CAN configuration
The CAN configurations of STM32F405 and STM32F407 are slightly different. The difference is that 407 has an additional level pull-up and pull-down mode, so be sure to pay attention to this when configuring. Secondly, to open CAN2, CAN1 must be opened, because CAN1 is the master and CAN2 is the slave; after opening the
[Microcontroller]
STM32F407 advanced timer dead zone complementary PWM (operation register)
There are many functions of the advanced timer, and here we only introduce the dead zone complementary PWM output function. In fact, the dead zone complementary PWM is not much different from the PWM configuration of the general timer, except that it is necessary to set several bits in the multi-CCER register and the
[Microcontroller]
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号