cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L433CC Not wake up from stop when portb is configured all analog, in RTC wakeup

FBald.1
Associate III

If I put port b all in analog the micro not wake up when in RTC wakeup mode (internal wakeup).

Any help?

Thanks in avance

void EnterStopMode(void)

{

 GPIO_InitTypeDef GPIO_InitStruct={0};

 /* Configure all GPIO as analog to reduce current consumption on non used IOs */

 /* Enable GPIOs clock */

 __HAL_RCC_GPIOC_CLK_ENABLE();

 __HAL_RCC_GPIOD_CLK_ENABLE();

 __HAL_RCC_GPIOE_CLK_ENABLE();

 __HAL_RCC_GPIOH_CLK_ENABLE();

 __HAL_RCC_GPIOA_CLK_ENABLE();

 __HAL_RCC_GPIOB_CLK_ENABLE();

 GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;

 // GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;

 GPIO_InitStruct.Pull = GPIO_NOPULL;

 GPIO_InitStruct.Pin = GPIO_PIN_All;

 HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);

 HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);

 HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);

 HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);

 HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

 // HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);   

 __HAL_RCC_GPIOC_CLK_DISABLE();

 __HAL_RCC_GPIOD_CLK_DISABLE();

 __HAL_RCC_GPIOE_CLK_DISABLE();

 __HAL_RCC_GPIOH_CLK_DISABLE();

 __HAL_RCC_GPIOA_CLK_DISABLE();

// __HAL_RCC_GPIOB_CLK_DISABLE();

 /* RTC configuration */

RTCHandle.Instance = RTC;

RTCHandle.Init.HourFormat = RTC_HOURFORMAT_24;

RTCHandle.Init.AsynchPrediv =0x7F; // LSE as RTC clock: RTC_ASYNCH_PREDIV

RTCHandle.Init.SynchPrediv = 0x00FF; // LSE as RTC clock: RTC_SYNCH_PREDIV;

RTCHandle.Init.OutPut = RTC_OUTPUT_DISABLE;

RTCHandle.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH;

RTCHandle.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN;

//__HAL_RCC_PWR_CLK_ENABLE(); // Enable Power Control clock

__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);

HAL_RTCEx_SetWakeUpTimer_IT(&RTCHandle, 5, RTC_WAKEUPCLOCK_CK_SPRE_16BITS);

//__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);

//__HAL_RCC_PWR_CLK_ENABLE(); // Enable Power Control clock

HAL_SuspendTick();

HAL_PWR_DisableSleepOnExit();

/* Enter Stop Mode */

HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);

////////////////

// STOP MODE

////////////////

HAL_ResumeTick();

/* Disable Wakeup Counter */

HAL_RTCEx_DeactivateWakeUpTimer(&RTCHandle);

ReinitializePeripherial();

}

17 REPLIES 17
Hello Mohamed ,
I try the to keep the uart pin state but the micro not wakeup.
My requisite is to go stop for lower 3uA current and wakeup whit full functionality.
Attached the source TestStopMode.ioc e main.c
Thanks a lot for your help.
Fausto
Il 15/09/2020 12:16, ST Community ha scritto:

Hello Fausto,

There is no files attached to this post !!!

Please check !

Thanks and Best Regards,

Mohamed Aymen.

FBald.1
Associate III

Hello Mohamed,

Sorry.

Now attached the file.

Thanks

Fausto

Hello Fausto,

Try the attached main.c

Best Regards,

mohamed Aymen.

FBald.1
Associate III

Hello Mohamed,

Now works,

Can you explain to me where the mistake was. In the final program ADC, SPI and I2C are also used, there is some other setting to do to put the micro to stop with very low current consumption, with other active peripherals.

On Monday I go to the office to measure the current when the micro is in stop mode.

Many thanks for your precious help.

Best regards

Fausto

Mohamed Aymen HZAMI
ST Employee

Hello Fausto,

After waking up from stop mode, we need to reconfigure the clock.

Best Regards,

Mohamed Aymen.

Mohamed Aymen HZAMI
ST Employee

Hello @FBald.1​ ,

Any update !

Best Regards,

Mohamed Aymen.

Hello Mohamed ,
the example work, i have to misure the current.
Best regards
Fausto
Il 22/09/2020 12:14, ST Community ha scritto: