Arm Community
Site
Search
User
Site
Search
User
Groups
Arm Research
DesignStart
Education Hub
Graphics and Gaming
High Performance Computing
Innovation
Multimedia
Open Source Software and Platforms
Physical
Processors
Security
System
Software Tools
TrustZone for Armv8-M
中文社区
Blog
Announcements
Artificial Intelligence
Automotive
Healthcare
HPC
Infrastructure
Innovation
Internet of Things
Machine Learning
Mobile
Smart Homes
Wearables
Forums
All developer forums
IP Product forums
Tool & Software forums
Support
Open a support case
Documentation
Downloads
Training
Arm Approved program
Arm Design Reviews
Community Help
More
Cancel
Developer Community
IP Products
Processors
Jump...
Cancel
Processors
Cortex-M / M-Profile forum
Cortex-M4: guaranteed wakeup from WFI?
Blogs
Forums
Videos & Files
Help
Jump...
Cancel
New
State
Accepted Answer
+1
person also asked this
people also asked this
Replies
9 replies
Subscribers
7 subscribers
Views
10626 views
Users
0 members are here
Cortex-M
Related
Cortex-M4: guaranteed wakeup from WFI?
Offline
Markus Grabner
over 7 years ago
Note: This was originally posted on 8th August 2013 at
http://forums.arm.com
Hi all!
I'm wondering how to ensure that the Cortex-M4 is always woken up on an interrupt from the WFI instruction when executing code like this:
__disable_irq();
// do something ...
__enable_irq();
__WFI();
If an interrupt is triggered between __enable_irq() and __WFI(), the interrupt handler is processed [font="Arial"]immediately and completed before [/font][font="Courier New"]__WFI() is executed, i.e., [/font][font="Arial"][font="Courier New"]__WFI()[/font] will wait for the next interrupt such that the first one is effectively lost. The ATmega* processors have a very simple solution to this problem: enabling interrupts is always delayed by one clock cycle such that the processor can safely enter sleep mode before interrupts can occur and wake up the processor. Thereby it is guaranteed that the processor is always woken up on an interrupt. How is this done on the Cortex-M4? As far as I know, there is no such enable interrupt delay, or is there a totally different mechanism to ensure wakeup on interrupts?
Thanks & kind regards,
Markus
P.S.: A lengthy discussion on a similar topic is
here
, though in German language.
[/font]
Top replies
Offline
Martin Weidmann
over 7 years ago
+1
verified
Note: This was originally posted on 9th August 2013 at http://forums.arm.com I don't tend to use the M class, but... Could you use WFE instead of WFI? WFE (Wake for Event) will cause the processor to...
Parents
+1
Offline
Martin Weidmann
over 7 years ago
Note: This was originally posted on 9th August 2013 at
http://forums.arm.com
I don't tend to use the M class, but...
Could you use WFE instead of WFI? WFE (Wake for Event) will cause the processor to wake on arrival of an interrupt (if they aren't masked) or an Event. Where an Event can be generated by executing SEV.
If you put a SEV instruction into your interrupt handler you'd know that the event register was set, meaning the next WFE instruction would "fail". As long as you have the WFE in a loop (re-checking the sleep condition on waking) this shouldn't be a problem.
Cancel
Up
+1
Down
Reply
Reject answer
Cancel
Reply
+1
Offline
Martin Weidmann
over 7 years ago
Note: This was originally posted on 9th August 2013 at
http://forums.arm.com
I don't tend to use the M class, but...
Could you use WFE instead of WFI? WFE (Wake for Event) will cause the processor to wake on arrival of an interrupt (if they aren't masked) or an Event. Where an Event can be generated by executing SEV.
If you put a SEV instruction into your interrupt handler you'd know that the event register was set, meaning the next WFE instruction would "fail". As long as you have the WFE in a loop (re-checking the sleep condition on waking) this shouldn't be a problem.
Cancel
Up
+1
Down
Reply
Reject answer
Cancel
Children
No data
More questions in this forum
By title
By date
By reply count
By view count
By most asked
By votes
By quality
Descending
Ascending
All recent questions
Unread questions
Questions you've participated in
Questions you've asked
Unanswered questions
Answered questions
Questions with suggested answers
Questions with no replies
Not Answered
Compiling libgcc not optimized
0
32-bit
Armv7-M
Compiling
GCC
Thumb
Cortex-M
Thumb2
Library
Arm Assembly Language (ASM)
C
Cortex-M4
2253
views
11
replies
Latest
3 months ago
by
a.surati
Not Answered
How to specify RAM location ?
0
SRAM
STM32 F1
Arm Assembly Language (ASM)
641
views
1
reply
Latest
3 months ago
by
GuillaumeP
Answered
Is it possible to enable or disable the nested interrupt mechanism on M0 ?
0
672
views
2
replies
Latest
3 months ago
by
Robert McNamara
Answered
How long are the Cortex-M7 pipeline stages?
0
Cortex-M7
Cortex-M
30825
views
18
replies
Latest
3 months ago
by
Pacocha
Not Answered
How to transfer and read weights, biases and activation functions from trained tensorflow model to nucleo-f446re or any microcontroller in keil
0
Embedded
Neural Network
Keil
TensorFlow
CMSIS
399
views
0
replies
Started
3 months ago
by
PrashanthPoobalan
<
>
View all questions in Cortex-M / M-Profile forum