2017-11-14 01:09 PM
Hello.
I'm having some problems with the STOP mode of STM32F030F4P.
After having all my application working with standbye mode awake by the RTC alarm, I checked that my application can not have floating pins.
So I thought, sacrifice some uA in exchange for not having to 'dirty' my PCB and use the STOP mode to keep at least weak pull-up resistor.
The problem is that I can not use the examples because some functions are not declared in the 'stm32f0xx_hal_rtc_ex.h' file, for example: HAL_RTCEx_SetWakeUpTimer_IT.
They are only available for the STM32F030xC version.
But the RTC alarm should be enough to wake up, but the MCU does not enter STOP mode when I call the function 'HAL_PWR_EnterSTOPMode (PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI)'.
At this point my code is very simple, because I have been removing everything so that I can only test if the MCU enters Stop mode or not ...
Physically the LED is on 10s, turns off 100mS and repeats again ...
That is, nothing more happens.
.. PS: RTC and alrm work as expected, because if I put my code to enter STANDBY, the current drops to ~ 5uA as expected (during ~1min, the alarm duration). /* Initialize all configured peripherals */
MX_GPIO_Init();
MX_SPI1_Init();
MX_TIM17_Init();
MX_I2C1_Init();
MX_RTC_Init();
/* USER CODE BEGIN 2 */
__HAL_RCC_PWR_CLK_ENABLE();
//Configura RTC
HAL_RTC_MspInit (&hrtc);
while (1)
{
HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, 1);
HAL_Delay(10000);
HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, 0);
HAL_Delay(100);
HAL_PWR_EnableBkUpAccess();
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
}�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?
void MX_RTC_Init(void)
{
RTC_TimeTypeDef sTime;
RTC_DateTypeDef sDate;
RTC_AlarmTypeDef sAlarm;
/**Initialize RTC Only
*/
hrtc.Instance = RTC;
hrtc.Init.HourFormat = RTC_HOURFORMAT_24;
hrtc.Init.AsynchPrediv = 100;
hrtc.Init.SynchPrediv = 400;
hrtc.Init.OutPut = RTC_OUTPUT_DISABLE;
hrtc.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH;
hrtc.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN;
if (HAL_RTC_Init(&hrtc) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}
/**Initialize RTC and set the Time and Date
*/
sTime.Hours = 0x0;
sTime.Minutes = 0x0;
sTime.Seconds = 0x0;
sTime.DayLightSaving = RTC_DAYLIGHTSAVING_NONE;
sTime.StoreOperation = RTC_STOREOPERATION_RESET;
if (HAL_RTC_SetTime(&hrtc, &sTime, RTC_FORMAT_BCD) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}
sDate.WeekDay = RTC_WEEKDAY_MONDAY;
sDate.Month = RTC_MONTH_JANUARY;
sDate.Date = 0x1;
sDate.Year = 0x17;
if (HAL_RTC_SetDate(&hrtc, &sDate, RTC_FORMAT_BCD) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}
/**Enable the Alarm A
*/
sAlarm.AlarmTime.Hours = 0x0;
sAlarm.AlarmTime.Minutes = 0x1;
sAlarm.AlarmTime.Seconds = 0x0;
sAlarm.AlarmTime.SubSeconds = 0x0;
sAlarm.AlarmTime.DayLightSaving = RTC_DAYLIGHTSAVING_NONE;
sAlarm.AlarmTime.StoreOperation = RTC_STOREOPERATION_RESET;
sAlarm.AlarmMask = RTC_ALARMMASK_DATEWEEKDAY|RTC_ALARMMASK_HOURS
|RTC_ALARMMASK_SECONDS;
sAlarm.AlarmSubSecondMask = RTC_ALARMSUBSECONDMASK_ALL;
sAlarm.AlarmDateWeekDaySel = RTC_ALARMDATEWEEKDAYSEL_WEEKDAY;
sAlarm.AlarmDateWeekDay = RTC_WEEKDAY_MONDAY;
sAlarm.Alarm = RTC_ALARM_A;
if (HAL_RTC_SetAlarm_IT(&hrtc, &sAlarm, RTC_FORMAT_BCD) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}
}
void HAL_RTC_MspInit(RTC_HandleTypeDef* rtcHandle)
{
if(rtcHandle->Instance==RTC)
{
/* USER CODE BEGIN RTC_MspInit 0 */
/* USER CODE END RTC_MspInit 0 */
/* RTC clock enable */
__HAL_RCC_RTC_ENABLE();
/* RTC interrupt Init */
HAL_NVIC_SetPriority(RTC_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(RTC_IRQn);
/* USER CODE BEGIN RTC_MspInit 1 */
/* USER CODE END RTC_MspInit 1 */
}
}�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?
I need help putting the MCU in stop mode.
Thank you.
#stm32f030-stop #low-power-stop-mode #stm32f030 #stop-mode2017-11-15 03:36 AM
Can someone help?
What is missing here in the process?
In fact, in addition to the 'information' that I find in the examples, I can not find documentation explaining the STOP mode.2017-11-15 10:05 AM
I found a very simple example in the folder: Projects\STM32F072RB-Nucleo\Examples_MIX\PWR\PWR_STOP\
It could easily be exported to my case.
The only difference is that EXTI is not triggered by a pin, but by the RTC alarm.What's the big difference? Could it be the MCU?
I am open to any suggestions.
Thank you.2017-11-15 03:30 PM
I'm debugging the code.
Basically the processor passes the STOP mode command without the WFU being SET.
That is, the core does not enter and exits STOP mode ... the core never enters STOP mode.
I have been testing various possibilities, but nothing changes..
The RTC ALARM continues to function well.
After 1min, the alarm occurs and the SET of the WFU bit is done at that time.
2017-11-16 03:28 AM
Can someone help?
Can someone from ST help me with this?
Or because it's an value line MCU does not deserve attention?
It starts to be strange the lack of information / response ...2017-11-16 04:40 AM
Hi
Martins.David
,I recommend you to start from example under the
STM32Cube_FW_F0_V1.9.0\Projects\STM32F030R8-Nucleo\Examples\PWR\PWR_CurrentConsumption:
STM32Cube_FW_F0_V1.9.0\Projects\STM32072B_EVAL\Examples\PWR\PWR_STOP
Also please have a look to these documents it may help you:
-Nesrine-
2017-11-16 04:44 AM
Hi
Martins.David
,if you are designing your own STM32 board , I recommend you also to have a look to theGetting started with
-Nesrine-
2017-11-16 05:50 AM
Hi
,Try to disable the
Systick interrupt
/* Enter Stop Mode */HAL_SuspendTick();HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);HAL_ResumeTick();
-Nesrine-
2017-11-16 06:26 AM
Hello
ELMHIRI.Syrine
.I've done several applications with STM32 (not F0 family, nor low-power applications) and everything went well. I followed all the indications of the application notes.
I also wrote that I reviewed the examples made available and in specific the example of PWR_STOP.
My question is this: What can cause not enter in the STOP mode?
I have already put here an image that shows that the core does not enter in STOP mode and the SET of the WFU flag is not done.The RTC ALARM continues to function well. After 1min, the alarm occurs and the SET of the WFU bit is done at that time.
All obvious flags are reset when I run the HAL_PWR_EnterSTOPMode (PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI).The P.C. goes through the WFI ()and exits immediately ... but it should Wait For Interrupt, but there is no SET of any interrupt flag.
So I think there is something else that can prevent the core from entering STOP mode. That's why I was asking for your help.
2017-11-16 08:26 AM
I think I've tried to do this without positive results, but I will try again.
Anyway I leave here some more pictures.
EXTI and PWR registers before executing STOP mode command.
https://s7.postimg.org/3mugt67mz/st1.jpg
https://s7.postimg.org/tv5lik763/stjpg
EXTI and PWR registers after executing STOP mode command.
https://s7.postimg.org/xrixejkfv/st2.jpg
https://s7.postimg.org/pm0vgebmj/stjpg
It seems to be all fine for the core enter in STOP mode ...
The SET of the LPDS bit is done while executing the function. It's the only difference it seems to have ...There is no change in the EXTI
registers
, so I can only assume that the core does not enter in STOP mode.WFI() does not wait for any interruption ...