棋子 · 2020年02月10日

When does a Cortex Mx wake up from "wfi" ? Is it configurable?

Question about the "hint" instruction - WFI.

The armv7m arch manual (i'm using DDI0403_B, latest?) says it will come out of the suspended / low-power state if:

• A reset.
• An asynchronous exception at a priority that, if PRIMASK was
exceptions.
Note
The processor ignores the value of PRIMASK in determining
wakeup event.

• If debug is enabled, a debug event.
• An IMPLEMENTATION DEFINED WFI wakeup event.

and I don't understand all of it.

Point 2 above: Say I start clean from reset with minimal setup, and (pseudo code) in my main is while (true) { _wfi; / do stuf .. / } , and I 've left all priorities as default after reset, non-configured un-altered. Are _any of Cortex non-NMI/non reset exceptions suppose to wake up my main? i.e, SysTick, Svc, PendSv ?
How about external exceptions or interrupts that I've may have enabled through NVIC ?
I'm using a CM4 based chip, and , I may have observed it wrong but it seemed to me that my main does not wake up on a peripheral interrupt, and out of the internal exceptions it wakes up on SysTick and SVC, but not on PendSV (it seems ..)

Can an implementation change which exceptions will wake up the processor which is in sleep by wfi?

The part which says "implementation defined" WFI event: will those usually be expected to be specified by the tech ref manual or datasheet for the chip/ SoC? Because, I'm looking at the manual for this chip and I see no mentioning of the WFI & reference to this Implementation Defined part.

Also, Is it configurable at all, which interrupts / events would cause it to wake up from WFI ...? (I would want to ask about WFE as well, but I rather sort one out first).

Is actually using / relying on wfi any good at all for relying to wake up your main thread to check what just has happened ..

1 个回答 得票排序 · 时间排序
极术小姐姐 · 2020年02月10日

CM4 based chip? Is the information about which chip highly confidential?

Anyway, any interrupt that "reaches" the core wakes it up from WFI. So interrupts must be enabled in NVIC.

你的回答
关注数
1
收藏数
0
浏览数
2214
极术小姐姐
极术微信服务号
关注极术微信号
实时接收点赞提醒和评论通知
安谋科技学堂公众号
关注安谋科技学堂
实时获取安谋科技及 Arm 教学资源
安谋科技招聘公众号
关注安谋科技招聘
实时获取安谋科技中国职位信息