cancel
Showing results for 
Search instead for 
Did you mean: 

BLE disconnect --> HCI_Reset unexpected behaviour

Nikolaj_TL
Associate III

I am working on a low power mode in a freeRTOS ble application. On a user request the device is to go into low power mode Stop2. 

In order to achieve the lowest power consumption ~2µA (stm32wb55) the ble activity has to be deactivated and the cpu1 & cpu2 has to go into lp-mode. 

In order to deactivate the ble antenna hci_reset is used. The low power mode implemented with hci_reset() works when tested on a Nucleo-STM32wb55 board based on the BLE_HeartRateFreeRTOS example. When I set it up on another project the hci_reset deletes all threads and doesn't excecute the the rest of the LP sequence. 

Here is the setup so far:

 

void LowPowerThread(void *argument)
{  
 
  HAL_EnableDBGStopMode();
  
  for (;;) {
  	
  	osDelay(5000);

  	HAL_GPIO_WritePin(GPIOD, GPIO_PIN_12, GPIO_PIN_RESET);  /* Turn off DEBUG LED */
  	hci_reset();	/* resets the Link Layer on an LE Controller (ble_hci_le.h) */
  	LL_C2_PWR_SetPowerMode(LL_PWR_MODE_SHUTDOWN);
  	
  	/* Disable SysTick Interrupt */
  	CLEAR_BIT(SysTick->CTRL, SysTick_CTRL_TICKINT_Msk);
  	HAL_SuspendTick();	/* suppend TIM17 */

  	LL_EXTI_DisableIT_0_31(LL_EXTI_LINE_ALL_0_31 & ~(LL_EXTI_LINE_6)); /* Disable all interrupts except from WakeUp Pin*/
  	LL_EXTI_DisableIT_32_63(LL_EXTI_LINE_ALL_32_63);
  	HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);  
  	
  	/* ... STOP Mode ... */
  	
  	HAL_ResumeTick();
  	SYSCLKConfig_FromSTOP();
  	HAL_GPIO_WritePin(GPIOD, GPIO_PIN_12, GPIO_PIN_SET);  /* Turn on DEBUG LED */
  }
}

 

 
Here is a screenshot before the hci_reset command is called and after.
Before:

Nikolaj_TL_0-1738678741889.png
OBS: here the LowPowerThread is called RelibableJourney
After:

Nikolaj_TL_1-1738678775197.png

Any guidance in understanding how the hci_reset() can delete threads and thereby omit the excecution of code in a thread is greatly appreciated 

 

 

0 REPLIES 0