Skip to main content
KPrzy.1
Associate II
September 24, 2021
Question

Dear Sirs, I have issue permanently standby stm32wb55 nucleo board when ble beacon and util scheduler run.

  • September 24, 2021
  • 3 replies
  • 1889 views

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.

This topic has been closed for replies.

3 replies

Remi QUINTIN
Technical Moderator
October 1, 2021

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

KPrzy.1
KPrzy.1Author
Associate II
October 1, 2021

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.

Remi QUINTIN
Technical Moderator
October 1, 2021

Please have a look at the attached document explaining how the sequencer is working.

Remi QUINTIN
Technical Moderator
October 4, 2021

Using UTIL_SEQ_PauseTask(0xFFFF) should pause all tasks.