2025-02-12 06:58 AM
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
}