STM32F4外部中断响应时间

2019-07-20 03:29发布

  请问各位大虾,STM32F4从收到一个外部中断指令到进入中断响应函数,IO翻转需要多久时间呢
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
24条回答
edmund1234
2019-07-22 19:57
本帖最后由 edmund1234 于 2019-3-5 16:38 编辑
icesight2018 发表于 2019-3-5 16:02
正点原子的模版设置的应该就是72mhz。我看了一下程序应该没错。


我认真的算了一下

这段是在arm官网找到的
Cortex-M3 TRM (for example, revision 'I') states that the interrupt latency on entry is 12 cycles and the latency on exit is also 12 cycles. This is a typographical error in the Cortex-M3 TRM. The Cortex-M3 has a latency on exit of ten cycles, just like the Cortex-M4.

The processor has three main physical interfaces to its memory system; I-Code and D-Code  each accessing addresses below 0x20000000, and System accessing addresses 0x20000000 and higher. The 12 cycle latency requires that a nine cycle stack push can take place on one interface (typically the System interface) in parallel with a six cycle vector table read and interrupt handler fetch on other interfaces (typically I-Code). If these operations cannot be performed in parallel, they will have to be performed one after the other, increasing the latency. The ability to perform these memory accesses in parallel depends upon both the hardware design providing the relevant memory blocks at suitable addresses, and software programming of the location of the vector table, interrupt handler code, and stack in those memories
外部中断信号需要10ns脉冲宽 ~约1个时钟
中断延迟需 12个时钟
压栈 9个时钟
从VECTOR获取中断向量 6个时钟
判断中断的指令 ?建议你把这一部分屏蔽来测试
io翻转的指令周期?用
GPIOE->BSRR = GPIO_BSRR_BS_8;    这一句应是需时5个时钟
EXTI->PR = EXTI_PR_PR6;
GPIOE->BSRR = (GPIO_BSRR_BS_8<<16);

这样更改后一共为36时钟, 即0.5us(500ns)

如果说你的延迟是在这范围内就是合理, 否则就是还有别的错误

一周热门 更多>