0
0
ARM Architectureknowledge~10 mins

Sleep mode (WFI instruction) in ARM Architecture - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to enter sleep mode using the WFI instruction.

ARM Architecture
asm volatile ("[1]" );
Drag options to blanks, or click blank then click option'
AWFI
BWFE
CNOP
DSVC
Attempts:
3 left
💡 Hint
Common Mistakes
Using WFE instead of WFI
Using NOP which does nothing
Using SVC which triggers a supervisor call
2fill in blank
medium

Complete the code to enable sleep mode by setting the SLEEPDEEP bit before WFI.

ARM Architecture
SCB->SCR |= [1];
asm volatile ("WFI");
Drag options to blanks, or click blank then click option'
ASCB_SCR_SLEEPONEXIT_Msk
BSCB_SCR_SEVONPEND_Msk
CSCB_SCR_SLEEPDEEP_Msk
DSCB_SCR_SLEEP_Msk
Attempts:
3 left
💡 Hint
Common Mistakes
Using SLEEPONEXIT instead of SLEEPDEEP
Using SEVONPEND which controls event behavior
Using a non-existent SLEEP mask
3fill in blank
hard

Fix the error in the code to correctly enter sleep mode with WFI.

ARM Architecture
SCB->SCR &= ~[1];
asm volatile ("WFI");
Drag options to blanks, or click blank then click option'
ASCB_SCR_SLEEP_Msk
BSCB_SCR_SLEEPONEXIT_Msk
CSCB_SCR_SEVONPEND_Msk
DSCB_SCR_SLEEPDEEP_Msk
Attempts:
3 left
💡 Hint
Common Mistakes
Using SLEEPONEXIT instead of SLEEPDEEP
Using SEVONPEND which is unrelated
Using a non-existent SLEEP mask
4fill in blank
hard

Fill both blanks to set the processor to deep sleep mode and then enter sleep.

ARM Architecture
SCB->SCR [1]= [2];
asm volatile ("WFI");
Drag options to blanks, or click blank then click option'
A|
B&
CSCB_SCR_SLEEPDEEP_Msk
D~SCB_SCR_SLEEPDEEP_Msk
Attempts:
3 left
💡 Hint
Common Mistakes
Using AND (&) instead of OR (|) to set bits
Using the complement (~) mask incorrectly
Clearing bits instead of setting
5fill in blank
hard

Fill all three blanks to clear the deep sleep bit, set the sleep on exit bit, and then enter sleep mode.

ARM Architecture
SCB->SCR [1]= [2];
SCB->SCR [3]= SCB_SCR_SLEEPONEXIT_Msk;
asm volatile ("WFI");
Drag options to blanks, or click blank then click option'
A&
B~SCB_SCR_SLEEPDEEP_Msk
C|
DSCB_SCR_SLEEPDEEP_Msk
Attempts:
3 left
💡 Hint
Common Mistakes
Using OR to clear bits
Using AND without complement to clear bits
Mixing up bit masks