cancel
Showing results for 
Search instead for 
Did you mean: 

Change the BLE advertisment value on stm32wb5mm

Fust3
Associate II
Hello I'm very new in stm32wbX programming  and I've created a ble service with custom advertise data packet 0xff with values 0x60,0x61 in app_ble.c
 
uint8_t a_AdvData[12] =
{
  7, AD_TYPE_COMPLETE_LOCAL_NAME, 'B', 'E', 'A', 'C', 'O', 'N',  /* Complete name */
  3, AD_TYPE_MANUFACTURER_SPECIFIC_DATA,0x60,0x61,
};
 
 
Now what i want it's change the values of data packets, so i've tried to call a function from custom_app.c but seems to crash and i can't see any beacon.
What do you suggest to change the values?
Thanks!
 
void CustomPrint(){
printf("Called\n");
 
tBleStatus status;
uint8_t adv_data[12] =
{
  7, AD_TYPE_COMPLETE_LOCAL_NAME, 'C', 'H', 'A', 'N', 'G', 'E',  /* Complete name */
  3, AD_TYPE_MANUFACTURER_SPECIFIC_DATA,0x70,0x71,
};
status =aci_gap_update_adv_data(adv_data, (uint8_t*) adv_data);
printf("End \n");
}

 

3 REPLIES 3
FilipKremen
ST Employee

Hello,

I'm attaching project where you can change the advertising data by pressing SW1 on Nucleo STM32WB55 board.

I have created a task for sequencer Adv_Update which is called when pressing SW1.

Please let me know if it works on your side, thank you.

 

Best regards,

ST support

Hello, Thank you very much but actually I'm using the stm32wb5mm-dk shuld be work in the same way?

Fust3
Associate II

I've tried to make these changes on my project, but nothing to do 

//////////////////insert this into: app_config.h  
/* USER CODE BEGIN CFG_Task_Id_With_HCI_Cmd_t */
  CFG_TASK_SW1_BUTTON_PUSHED_ID,
  CFG_TASK_SW2_BUTTON_PUSHED_ID,
  CFG_TASK_SW3_BUTTON_PUSHED_ID,
  CFG_TASK_ADV_UPDATE,
  /* USER CODE END CFG_Task_Id_With_HCI_Cmd_t */

//////////////////insert this into: app_ble.c
  /* USER CODE BEGIN APP_BLE_Init_3 */
  UTIL_SEQ_RegTask(1<<CFG_TASK_ADV_UPDATE, UTIL_SEQ_RFU, Adv_Update);
  /* USER CODE END APP_BLE_Init_3 */


//////////////////addedd also in app_ble.c :
/* USER CODE BEGIN PFP */
static void Adv_Update(void);
/* USER CODE END PFP */

/* USER CODE BEGIN FD_WRAP_FUNCTIONS */

static void Adv_Update(void)
{
tBleStatus status;
uint8_t adv_data[12] =
{
  7, AD_TYPE_COMPLETE_LOCAL_NAME, 'C', 'H', 'A', 'N', 'G', 'E',  /* Complete name */
  3, AD_TYPE_MANUFACTURER_SPECIFIC_DATA,0x70,0x71,
};
status = aci_gap_update_adv_data(sizeof(adv_data), (uint8_t*) adv_data);
}
/* USER CODE END FD_WRAP_FUNCTIONS */



//////////////////and this: UTIL_SEQ_SetTask(1 << CFG_TASK_ADV_UPDATE, CFG_SCH_PRIO_0); into main()
 /* USER CODE BEGIN WHILE */
  while (1)
  {
    /* USER CODE END WHILE */
    MX_APPE_Process();
UTIL_SEQ_SetTask(1 << CFG_TASK_ADV_UPDATE, CFG_SCH_PRIO_0);