Skip to main content
Lucas Oliveira
Associate
May 24, 2017
Question

How to reconfigure STM32L476 after exit standby mode

  • May 24, 2017
  • 2 replies
  • 1680 views
Posted on May 24, 2017 at 15:34

Hi,

We are working with SensorTile (STM32L476). To reduce power consumption, we are using the standby mode with sram2 retention. Our intention is to configure BlueNRG-MS (with advertising enabled), enter standby mode and wait for a user connection through smartphone. The problem is that after wake-up, the SPI/BlueNRG-MS is reconfigured and we can't establish the connection.

We are trying to use this sequence:

- initilize the ble stack/SPI, storing in SRAM2 all the varibles we think that needs retention;

- enter advertising;

- enter standby mode with SRAM2 retendion;

- wait connection event (ble interrupt);

- reconfigure SPI; (for me our problem is here)

- trying to create connection after interrupt;

What is the best way to do this? What do we need to store in SRAM2 before standby? 

What do we

need to

 reconfigure after wake-up?
This topic has been closed for replies.

2 replies

RomainR.
ST Employee
May 24, 2017
Posted on May 24, 2017 at 16:54

Hello Lucas,

Have a look to L476 Ref manual chapter 5.3.9 Standby Mode.

When exit from standby Mode, mcu will perform a reset phase. So, it's normal that your code restart and perform peripheral initialization which you defined.

It's same with Shutdown mode except for SRAM2 where no retention is available.

It's a best practice to check and manage after reset what is the reset source cause (seestm32l4xx_hal_pwr.h)

if(__HAL_PWR_GET_FLAG(PWR_FLAG_SB) ) ...�?

Then clear the corresponding flag with:

__HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB)...�?

And choose what to do after.

- If reset cause is a Cold reset. Then perform peripheral configuration and wait a connection with a smartphone.

- If reset cause is when exit from Standby Mode, Then perform peripheral configuration, reload configuration stored into SRAM2,

and wait a connect

ion with a smartphone.

Regards.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
RomainR.
ST Employee
May 24, 2017
Posted on May 24, 2017 at 17:08

You can use the following example from Cube repository.

C:\Users\Your account\STM32Cube\Repository\STM32Cube_FW_L4_V1.7.0\Projects\STM32L476RG-Nucleo\Examples\PWR\PWR_STANDBY

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Korhonen
Visitor II
February 6, 2019

I'm facing the similar problem... Did you manage to solve this issue?

BlueNRG's IRQ is connected to the STM32L4's wakeup pin. STM32L4 will be shut down to standby while BlueNRG is still up and running. BLE actions will nicely wakeup the STM32L4, but how to reconfigure BlueNRG from the STM32L4 without resetting and reinitialising everything? We don't like to loose existing data on the BLE characteristics or existing BLE connection while waking up the STM32L4 from the standby.