stm32F4的NVIC和中断

本文详细介绍了STM32F4的中断控制器NVIC的结构和使用,包括中断使能、清除、挂起状态设置与清除、优先级设置等,并提到了外部中断/事件控制器EXTI的配置流程,强调了硬件中断和事件选择的配置步骤。此外,还讨论了如何通过EXTI连接GPIO引脚来触发中断。
摘要由CSDN通过智能技术生成
ARMv7-M provides an interrupt controller as an integral part of the ARMv7-M exception model.
ARMv7-M supports level-sensitivie and pulse-sensitive interrupt behavior. 
Pulse interrupt sources must be held long enough to be sampled reliably by the processor clock to ensure they are lated and become pending. Pulses held for a clokc period act linke edge-sensitive interrupts. These can become pending again while the interrupt is active.
level-based interrupts becomes pending, and then make the interrupt active. The interrupt Service Routine then acesses the peripheral, causing it to seassert the interrupt. If the interrupt is still asserted on return from the ISR, it becomes pending again.

The NVIC supports the following features:
• NVIC interrupts can be enabled and disabled by writing to their corresponding  Interrupt Set-Enable or  Interrupt Clear-Enable register bit-field. The registers use a write-1-to-enable and write-1-to-clear policy,  both registers  reading back the current enabled state of the corresponding (32) interrupts. 
When an interrupt is disabled, interrupt assertion causes the interrupt to become pending, but the interrupt  cannot become active. If an interrupt is active when it is disabled, it remains in the active state until this is  cleared by a reset or an exception return. Clearing the enable bit prevents any new activation of the associated  interrupt.
An implementation can hard-wire interrupt enable bits to zero if the associated interrupt line does not exist, or hard-wired them to one if the associated interrupt line cannot be disabled.
• Software can set or remove the pending state of NVIC interrupts using a complementary pair of registers, the  Set-Pending Register and  Clear-Pending Register. The registers use a  write-one-to-enable and  write-one-to-clear policy, and a read of either register returns the current pending state of the corresponding  32 interrupts. Writing 1 to a bit in the Clear-Pending Register has no effect on the execution status of an active  interrupt.  It is IMPLEMENTATION DEFINED for each interrupt line supported, whether an interrupt supports either or both  setting and clearing of the associated pending state under software control.
•  Active bit status is provided to enable software to determine whether an interrupt is inactive, active, pending,
or active and pending.

The following are registers related to NVIC. 

Interrupt Controller Type register, ICTR
Purpose shows the  number of interrupt that the NVIC supports.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值