cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB BLE advertising stops after exiting standby mode.

AbidSulaiman
Associate III

Hello,

I am currently on the (official) example application of BLE_p2pServer from STM32Cube_FW_WB_V1.0.0. I am trying to make it work with standby mode and I disabled the advertising timeout for this particular test.

BLE is still advertising when in standby mode (before waking up). But it stops after waking up.

EDIT: BLE actually stops advertising as soon as it enter standby mode.

if(   (__HAL_PWR_GET_FLAG(PWR_FLAG_SB) != RESET)
      && (__HAL_PWR_GET_FLAG(PWR_FLAG_C2SB) != RESET)
     )
   {
     /* Clear Standby flag */
     __HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);
     __HAL_PWR_CLEAR_FLAG(PWR_FLAG_C2SB);
   }
  else {
    MX_RTC_Init();
    APPE_Init();
  }

From the code, i didnt reinitialize RTC and BLE after exiting standby mode as i thought the microcontroller starts from RESET after exiting standby mode.

The microcontroller will enter standby mode when the SCH_Idle() function is called.

void SCH_Idle( void )
{
#if ( CFG_LPM_SUPPORTED == 1)
    LL_C2_PWR_SetPowerMode(LL_PWR_MODE_STANDBY);
    HAL_PWREx_EnableSRAMRetention();
    HAL_PWR_EnterSTANDBYMode();
    Error_Handler();
#endif
  return;
}

Where do you think I went wrong? Thanks for the reply and help.

P/s: For now, I just use the NRST pin to wake up from standby. It is because when I use the RTC wakeup, I got some weird event where the microcontroller didnt enter standby mode again after exiting standby mode for the first time and went to the while loop in Error_Handler(). I didnt look deeper for this event yet. will post a question when I think I know where the error come from.

13 REPLIES 13

I've fixed the problem by setting the MAC RX OFF before going to Standby. Anyway, thanks again.

Where should I write these lines. Should I write these lines in void UTIL_SEQ_Idle( void ) or somewhere else?

Thanks in advance.

Hello,

There is nothing to add to provided example to enter stop mode and get the best low power consumption. Only some configuration are required to be changes in app_conf.h

Regards.

Hello, @Christophe Arnal​ ,

Thanks for the reply. I used BLE_HeartRate which is on github for stm32wb55. But I am seeing 6 mA current with having your settings as you have suggested. I am measuring the current on ST's Power measurement Board. Please guide me.

Thanks in Advance.