2014-08-05 02:54 PM
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))
{
}
}
}
2014-08-07 10:13 AM
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?
2014-08-07 12:15 PM
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.
2014-08-07 12:25 PM
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.
2014-08-08 12:50 PM
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?)2014-08-11 09:50 AM
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.