This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

A53 core does not enter sleep state with WFE

I am trying to use WFE on Linux user space. I have the following code,

while(1)

{

  if (condition==TRUE)

    break;

    __asm__ __volatile__ ("wfe" : : : "memory");

  ...

}

It seems the core never gets into sleep state after the WFE instruction is executed. If I replace wfe with wfi, the core can enter into sleep state frequently, so the interrupts may not be the sources to wake up WFE. I disabled the timer event stream in the kernel. The only think I am not sure is the event generated by clearing global monitor. I guess it cannot be masked/disabled. Is there anything else need to be taken care so that the core can enter the sleep state?

  • There is an Event register, which gets set if the core receives an Event. When you execute WFE, the core first checks the Event register. If its set, you don't enter standby but keep executing instead (and the Event register gets cleared).

    As you don't know the initial state of the Event register (it's not readable from software) you have to use WFE in a loop in most cases. Checking whether the reason why you went to sleep is still valid on waking.
  • Thanks for the reply. I do call WFE in a while(1) loop, but the core never enters sleep mode. What I need is to find out what keep setting the Event Register so that the core does not enter sleep after WFI instruction is executed. Is it possible that something is not configured correctly so that WFE does not do anything?