cancel
Showing results for 
Search instead for 
Did you mean: 

Low Power Modes on stm32f0discovery board not functioning.

andrew2
Associate II
Posted on August 05, 2014 at 23:54

I am trying to use the standby mode on my discovery board in conjunction with digital IO as well as a UART line. I try to send data over the UART then go into standby mode and then wake up to just put out the same data over UART. It sends the correct data over the UART line but after that it just spits out the character ''à'' (the same number of character that I had tried to send out). I believe the it is not making it completely into standby mode because when I rerun my initialization code just after sending it into standby mode, it will at least send the correct characters, but that is not really solving my problem. I have set up the code using the cube software. Here is the my main loop.

-----------------------------------------------------------------------------------------------------------

Edit: I Found the ''Format Code Block'' button!!!


while
(1)

{

if
(HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_1))

{

HAL_UART_Transmit(&huart1,sendData,sendSize,sendTimeout);

while
(HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_1))

{

}

HAL_PWR_EnterSTANDBYMode();

//MX_USART1_UART_Init();

}

else

{

HAL_GPIO_TogglePin(GPIOC,GPIO_PIN_9);

while
(!HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_1))

{

}

}


}

5 REPLIES 5
andrew2
Associate II
Posted on August 07, 2014 at 19:13

My problem seems to have shifted direction toward low power modes specifically.  Is it correct that calling the ''HAL_PWR_EnterSTANDBYMode();'' function will send the mcu into standby mode and that when the mcu wakes up the mcu will go through a reset, rather than picking up from where it left off?

Posted on August 07, 2014 at 21:15

STOP generally means it carries on from where it left off, but you might have to reconfigure/reenable things, STANDBY normally exits as a reset and you have to start everything from scratch.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
andrew2
Associate II
Posted on August 07, 2014 at 21:25

OK, so I am at least approaching this correctly.  The mcu doesn't appear to be resetting, it looks like it just continues with a reduced current draw and a slower clock.  It seems to ignore the WFI instruction.

andrew2
Associate II
Posted on August 08, 2014 at 21:50

So I ported my code over to an F4 (Nucleo-F401RE) and the Standby mode started functioning (mostly).  So I feel that there is an error in the compilation of the HAL libraries for the F0.

The board will now go into Standby mode and it will exit, but it acts like the System Wake up Flag never gets cleared.  Does anyone know the proper way to go about clearing the related flag?  (Or at least the appropriate place in the documentation?)

andrew2
Associate II
Posted on August 11, 2014 at 18:50

I found the ''PWR_CR_CWUF'' bit which I clear by writing a 1 to it just before going into my main loop.

PWR->CR |= (uint32_t)PWR_CR_CWUF;

This seems to do the trick, for at least the F4, but I still don't know what is going wrong on the F0.