cancel
Showing results for 
Search instead for 
Did you mean: 

BLUENRG-LP POWER_SAVE_LEVEL_STOP mode using BLE stack

AndyR1
Senior

Hello st community,

 

I'm trying to use the BlueNRG-355 in deepstop mode without timer, to wake it up with an I/O. I used function from Power Save Modes project from the Navigator

HAL_PWR_MNGR_Request(POWER_SAVE_LEVEL_STOP_NOTIMER...);

It does not enter any sleep mode, in the function, it jumps over this condition :

/* BLE Stack allows to enable the power save */
  if (BLE_STACK_SleepCheck() != POWER_SAVE_LEVEL_RUNNING)

In the reference manual RM0479 5.4.2 :

The conditions to enter the DEEPSTOP mode are:

  1. the radio (MR_BLE) is sleeping,
  2. the CPU is sleeping (WFI with SLEEPDEEP information active),
  3. no unmasked wakeup sources is active (including those from a previous wakeup sequence for which the software did not clear the associated flag after wakeup),
  4. the system is clocked on RC64MPLL (HSI or pll locked mode)
  5. the PWRC_CR1.LPMS bit is equal to 0

Also tried to call

__WFI();
WAKEUP->BLUE_SLEEP_REQUEST_MODE = WAKEUP_BLUE_SLEEP_REQUEST_MODE_FORCE_SLEEPING;
LL_APB2_DisableClock(LL_APB2_PERIPH_MRBLE);
LL_PWR_LowPowerMode(LL_PWR_MODE_DEEPSTOP);

without success.

/****** EDIT ******/

I re-tried to put the BlueNRG in POWER_SAVE_LEVEL_STOP_WITH_TIMER or POWER_SAVE_LEVEL_STOP_NOTIMER.

From what I understood and playing with Micro_PowerManager example project, the HAL_PWR_MNGR_Request function handles the conditions mentionned above.

I added print in this function to know which part prevents from switching to power save mode :

 

 

Enable Power Save Request : STOP_WITH_TIMER (VTIMER)
final_level : 2, app_powerSave_level : 3, level : 2
final_level : 2, vtimer_powerSave_level : 2
final_level : 1, pka_level : 1
Power save level negotiated: CPU_HALT

 

So PKA limits to power save level 1 (CPU_HALT)

From the pka_manager_bluenrg_lp source file :

 

 

uint8_t PKAMGR_PowerSaveLevelCheck(uint8_t x){
  if(PKAMGR_SleepCheck()==PKAMGR_SUCCESS)
  {
    return POWER_SAVE_LEVEL_STOP_NOTIMER;
  }
  else // PKA on going
  {
    return POWER_SAVE_LEVEL_CPU_HALT;
  }
}

 

 

I don't use it but I also tried to init the PKA manager with PKAMGR_Init() and call PKAMGR_Unlock().

So the question is : How to get the PKAMGR_SUCCESS or if i go deeper, how to get the pka internal state to PKAMGR_STATE_IDLE ?

Thanks for any tips,

Andy.

1 ACCEPTED SOLUTION

Accepted Solutions
3 REPLIES 3
ARamí.1
Associate II

I solved this issue initiating BLE_Stack, VTimers, and run HAL_VTIMER_Tick() BLE_STACK_Tick() NVMDB_Tick() in main.

 All of this if you use BLE_Stack library, but if you don’t the problem disappears.

BLE_STACK_SleepCheck() is a WEAK function, and in bluenrg_lp_stack.h there is a function with the same name.

I don’t know what is the exact issue but I solved it this way

AndyR1
Senior

Hello,

post updated

AndyR1
Senior