Dear Sirs, I have issue permanently standby stm32wb55 nucleo board when ble beacon and util scheduler run.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-24 05:34 AM
I am using ble advertising example beacon project. I have initiated util scheduler/sequencer. I have registered inside scheduler exti buttom task that is used to standby whole device but it does not stop, device wakup imediately after standby. I am trying to stop all software timers, pause all tasks, deinit rtc wakup counter, deinit gpios, suspend hal systick etc. I have suspecion that scheduler is wakingup device. Is there any clear way do deinit scheduler. I found deinit function of it but it is empty when generating using cubeide 1.7.
- Labels:
-
Power
-
STM32WB series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-01 02:38 AM
I dot think the sequencer is involved in this issue.
There is maybe a flag pending somewhere preventing the device to enter the STANDBY mode.
The device wakes up any time a new RF activity is scheduled. A beacon is meant to advertise quite regularly depending on the advertising interval.
If you want to remove all tasks from the scheduler, you have to call the UTIL_SEQ_PauseTask() function for each task already activated via the UTIL_SEQ_SetTask() function. UTIL_SEQ_PauseTask() prevents the function to be executed in the while loop whatever is the value of the related flag.
Not also that those tasks are running on the M4 core while the RF activity is monitored by the M0+ core.
Once the beacon enters the advertisement phase, the only way to stop it is to call the ACI_GAP_SET_NON_DISCOVERABLE funcion (See AN 5270 for those ACI functions). The call from the M4 core will send a command to the M0+ core, requesting the stop of the advertising phase which prevent the device to enter STANDBY mode.
See AN
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-01 02:39 AM
Please have a look at the attached document explaining how the sequencer is working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-01 03:34 AM
Dear Remi,
Thank You for Your fast answer. What I am exactly doing is following:
//register on/off function to scheduler by pressing push buttom configrued as exti, on/off means standby or shutdown it depends what does it mean for mcu and function HAL_PWREx_EnterSHUTDOWNMode(); tim1 interrupt is used for exti debounce
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
if( (GPIO_Pin == B1_Pin) && (state == true) )
{
HAL_TIM_Base_Start_IT(&htim1);
state = false;
UTIL_SEQ_SetTask(1<<CFG_TASK_ONOFF_BUTTON_PUSHED_ID, CFG_SCH_PRIO_0);
}
else
{
__NOP();
}
return;
}
when set function is called by scheduler I am doing following, stopping my tasks but i think no all of them ie. hci tasks, remove rtc wakup, set wakup pin and its polarity, shutdown cpu2 and shutdown cpu1
static void OnOff_Task( void )
{
UTIL_SEQ_PauseTask(1 << CFG_TASK_HB_REQUEST_ID);
UTIL_SEQ_PauseTask(1 << CFG_TASK_ONOFF_BUTTON_PUSHED_ID);
HW_TS_Stop(HeartBeat_mgr_timer_Id);
HAL_RTCEx_DeactivateWakeUpTimer(&hrtc);
HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN2_HIGH);
LL_C2_PWR_SetPowerMode(LL_PWR_MODE_SHUTDOWN);
HAL_PWREx_EnterSHUTDOWNMode();
}
and it looks like device is standby but after a very short time imediately wakup by some unkown source (could be the RF radio stack) since I am not finishing advertising by my beacon device as You observed. I will try this comment and my example one again with calling ACI_GAP_SET_NON_DISCOVERABLE, since it looks like this is the only source I can imagine right now of waking up my device. I can see for a short time on the current measurement device that current drop below 1mA and then imediatelly jump back to ca. 6mA and device behaves like after software reset procedure.
I also observed that if ble stack is not initialized and i am doing shutdown exacly the same function as above but just before ble stack then it is working fine. The device is not waking up until I will not press wekup pin so it must be someting related to the uknown or pending source like ble radio stack activity. From the begning I thought this function call shutdown cpu2 with radio stack LL_C2_PWR_SetPowerMode(LL_PWR_MODE_SHUTDOWN); just before cpu1 shutdown code but it looks like not...
Should I also pause other tasks like:
UTIL_SEQ_SetTask( 1<<CFG_TASK_SYSTEM_HCI_ASYNCH_EVT_ID, CFG_SCH_PRIO_0);
UTIL_SEQ_SetEvt( 1<< CFG_IDLEEVT_SYSTEM_HCI_CMD_EVT_RSP_ID );
UTIL_SEQ_WaitEvt( 1<< CFG_IDLEEVT_SYSTEM_HCI_CMD_EVT_RSP_ID );
UTIL_SEQ_RegTask( 1<< CFG_TASK_SYSTEM_HCI_ASYNCH_EVT_ID, UTIL_SEQ_RFU, shci_user_evt_proc );
Is there any clear way to pause all tasks (I could not see any point saying this inside power point presentation) or I have to do it by myself finding what I did registered and then pause it?
In the attachment You will fine zip of my project so if you have wb55 somewhere flying around you could reproduce my issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-04 05:32 AM
Dear Remi,
I have my final conclusion. In my case the key things to make both cpus shutdown or standby and do not wakup was as You wrote call ACI_GAP_SET_NON_DISCOVERABLE request but also making LL_PWR_ClearFlag_WU(); LL_C2_PWR_DisableInternWU(); and finally callign shutdown macross such LL_C2_PWR_SetPowerMode(LL_PWR_MODE_STANDBY); HAL_PWREx_EnterSHUTDOWNMode(); Right now device is shutdown and waking for wakeup source in my case pushbottom. Since I have at address 0x08000000-0x08008000 my tiny bootloader it is called just after wakup and then jumping to my beacon api. Right now it is working as I was expecting from the very begining but was lack of experience considering both cpus shutdown and deactivating all wkaup sources for both cpus. Anyway thank You for Your feedback and very good comment that cpu2 and its advertising process can be the issue here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-04 09:08 AM
Using UTIL_SEQ_PauseTask(0xFFFF) should pause all tasks.