BLUENRG-LP POWER_SAVE_LEVEL_STOP mode using BLE stack
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:
- the radio (MR_BLE) is sleeping,
- the CPU is sleeping (WFI with SLEEPDEEP information active),
- 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),
- the system is clocked on RC64MPLL (HSI or pll locked mode)
- 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.
