on-internet
← Community

STM32F030 doesn't go to sleep

Stack Overflow ·

I want to enter the sleep mode with WFI on a STM32F030 (Cortex-M0). However, my code doesn't seem to work on the STM32F030, but works on an STM32F103. I think it works, because when trying to flash the F103 again (with the ST-LINK utility or Keil), it doesn't respond, and I have to connect under reset, which tends to indicate that the CPU is sleeping. But I can connect without problem to the F030. Here is my code: int main() { SetupSleep(); __wfi(); while(1){} } Here is the content of my SetupSleep() function: void SetupSleep(void){ SCB->SCR |= (1ul << 1); SCB->SCR &= ~(1ul << 2); } Which, acc

Comments

Sign in or sign up to comment and upvote.

No comments yet.