Skip to main content
Associate III
February 12, 2025
Solved

STM32WPAN stops advertising after registering custom task

  • February 12, 2025
  • 1 reply
  • 420 views

I have a application where stm32wb5mm is acting like a beacon. I got it to advertise configured data, now I am trying to advertise temperature measurement, for this, I need to dynamically update advertising data packages.

 

So my advertising works ok, when it is just the template:

 /* Initialize all configured peripherals */
 MX_RF_Init();
 MX_GPIO_Init();
 MX_RTC_Init();
 MX_I2C3_Init();
 /* USER CODE BEGIN 2 */

 //UTIL_SEQ_RegTask((1 << 0), 0, task2);


 /* USER CODE END 2 */

 /* Init code for STM32_WPAN */
 MX_APPE_Init();

 /* Infinite loop */
 /* USER CODE BEGIN WHILE */

 while (1)
 {
	//UTIL_SEQ_SetTask((1 << 0), 0);
 /* USER CODE END WHILE */
 MX_APPE_Process();

 /* USER CODE BEGIN 3 */

 }
 /* USER CODE END 3 */
}

But as soon as I enable the task that i created, the advertising stops:

 /* Initialize all configured peripherals */
 MX_RF_Init();
 MX_GPIO_Init();
 MX_RTC_Init();
 MX_I2C3_Init();
 /* USER CODE BEGIN 2 */

 UTIL_SEQ_RegTask((1 << 0), 0, task2);


 /* USER CODE END 2 */

 /* Init code for STM32_WPAN */
 MX_APPE_Init();

 /* Infinite loop */
 /* USER CODE BEGIN WHILE */

 while (1)
 {
	UTIL_SEQ_SetTask((1 << 0), 0);
 /* USER CODE END WHILE */
 MX_APPE_Process();

 /* USER CODE BEGIN 3 */

 }
 /* USER CODE END 3 */
}

 

Content of registered task:

{
	a_AdvData[23] = update_data();		//gets temperature data and stores in adv struct
	aci_gap_update_adv_data(sizeof(a_AdvData), (uint8_t*) a_AdvData);	//Update adv data
}
Best answer by KlemenPfce

Found solution, problem was that ID that I used for my custom task registration, was already taken by CubeMX configured firmware. Changed to task ID to "2", now works without a hitch.

1 reply

KlemenPfceAuthorBest answer
Associate III
February 13, 2025

Found solution, problem was that ID that I used for my custom task registration, was already taken by CubeMX configured firmware. Changed to task ID to "2", now works without a hitch.