"Dirty" stop of the RTOS and entering deep sleep mode

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
gicho
Posts: 16
Joined: Sun Aug 24, 2014 8:44 am

"Dirty" stop of the RTOS and entering deep sleep mode

Post by gicho »

In my application I have to stop the microcontroller (STM32F4) in deep sleep mode. Then it will be woken by edge on SYS WKUP pin (this is equivalent to reset - that's why I don't care about "clean" stop of the RTOS - I don't need to "re-start" after sleep).
I have implemented the steps to stop all drivers and threads, then chSysDisable (like in http://www.chibios.org/dokuwiki/doku.php?id=chibios:howtos:stop_os). But still whenever I call __WFI() (or __WFI() ) my code doesn't stop - neither in debug nor in release.
This is the last part of my code:

Code: Select all

  
  PWR->CSR |= PWR_CSR_EWUP;
  /* Clear Wake-up flag */
  PWR->CR |= PWR_CR_CWUF;
  /* Select STANDBY mode */
  PWR->CR |= PWR_CR_PDDS;
  /* Set SLEEPDEEP bit of Cortex System Control Register */
  SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
  __DSB();
  /* Request Wait For Interrupt */
  __WFI();
  __WFE();


But the CPU doesn't stop at the WFI (or WFE) instructions ...

In the context of all this, could somebody recommend how to "stop" the CPU effectively?
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: "Dirty" stop of the RTOS and entering deep sleep mode

Post by Giovanni »

Hi,

Search the forum because somebody already posted a solution, also look at the RTC demos.

Giovanni
gicho
Posts: 16
Joined: Sun Aug 24, 2014 8:44 am

Re: "Dirty" stop of the RTOS and entering deep sleep mode

Post by gicho »

Thank you, I will look for this information.
Post Reply