STM32F4 Interrupts: Clearing and related questions.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-04-26 2:49 AM
Posted on April 26, 2013 at 11:49
Hi
Just some general questions on interrupts:I assume that external interrupts need to be be cleared. There are some forum threads that are suggesting that this is done ''automatically'' and it does not need to be coded. I'm going with something like this (assuming that they do need to be cleared)extern ''C'' void EXTI4_IRQHandler() { if (EXTI_GetITStatus(EXTI_Line4 ) != RESET) { EXTI_ClearITPendingBit(EXTI_Line4 ); NowDoSomethin(); } }Also tracing back the EXTI_ClearITPendingBit function into the ST lib I see that there is also a clear Flag call that can be madevoid EXTI_ClearFlag(uint32_t EXTI_Line);void EXTI_ClearITPendingBit(uint32_t EXTI_Line);Is clearing the bit the right way to go and when would the ClearFlag be used?? #stm32f4-irq-interrupt
Labels:
- Labels:
-
Interrupt
This discussion is locked. Please start a new topic to ask your question.
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-04-26 3:20 AM
Posted on April 26, 2013 at 12:20
...and I'm assuming SysTick does not need clearing
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-04-26 5:02 AM
Posted on April 26, 2013 at 14:02
Well you definitely want to clear the EXTI interrupt latch, and consider what the source is doing, is it still asserting or temporal.
Situations where you don't need to explicitly clear the interrupt are the USART, where reading/writing the DR is sufficient to clear the driving source. It's the source on the peripheral, not the NVIC, which needs clearing, how that works depends on the peripheral and how it gates/latches it's internal interrupt sources. Correct, SysTick does not need clearing, it's classed as a System Handler Also consider when you clear the interrupt, there is a race condition with the NVIC and tail-chaining due to write buffers, and pipelining. Clear the source early in the service routine, not immediately before you leave.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
