2022-03-25 02:22 AM
Hello,
I'm trying to program a STEVAL-IDB011V1 board for a broadcast role with extended advertising and Coded PHY. But something is wrong in my GAP set configuration because when I run my program I got this status from aci_gap_set_advertising_configuration() function:
Error in aci_gap_set_advertising_configuration() 0x82
This status (0x82) mean: Invalid parameters passsed at Host layer.
I don't know what I'm doing wrong. This are my GAP configurations:
// Init GAP:
//////////////////
aci_gap_init(GAP_BROADCASTER_ROLE, 0x00, 0x08, PUBLIC_ADDR, &service_handle, &dev_name_char_handle, &appearance_char_handle);
// Gap adv configuration
///////////////////////////////////////
status = aci_gap_set_advertising_configuration
(
1,
GAP_MODE_BROADCAST,
0,
(333*1000/625),
(333*1000/625),
ADV_CH_ALL,
PUBLIC_ADDR,
NULL,
ADV_NO_WHITE_LIST_USE,
127,
LE_CODED_PHY,
0,
LE_CODED_PHY,
1,
0
);
// Enable adv
/////////////////////
Bluetooth_GapAdv_create (1, BCPC_extendedAdvParams_dynamicMsgs);
aci_gap_set_advertising_data(1, ADV_COMPLETE_DATA, sizeof(extended_advData), extended_advData);
Advertising_Set_Parameters_t Advertising_Set_Parameters[1];
Advertising_Set_Parameters[0].Advertising_Handle = 0;
Advertising_Set_Parameters[0].Duration = 0;
Advertising_Set_Parameters[0].Max_Extended_Advertising_Events = 0;
Advertising_Set_Parameters[1].Advertising_Handle = 1;
Advertising_Set_Parameters[1].Duration = 0;
Advertising_Set_Parameters[1].Max_Extended_Advertising_Events = 0;
aci_gap_set_advertising_enable(ENABLE, 2, Advertising_Set_Parameters);
I'm editing the code example for advertising extension usage in BlueNRG-LP SDK, but the GAP set configurations doesn't have the same configuration I need. I've defined EXT_ADV_PHY, LE_CODED_PHY and BLE_STACK_FULL_CONF for the BLE Stack configuration.
I've been trying for a long time correct this. Someone know what I'm doing wrong?
Thanks,
Daniel
Solved! Go to Solution.
2022-03-29 02:03 AM
It works!
I'm using WiSE Studio instead of IAR, so I had to navegate to project->Properties->C/C++ Build->Settings->Tool Settings->GCC C Compiler/Preprocessor and change in Defined symbols BLE_STACK_BASIC_CONF to BLE_STACK_FULL_CONF like you said, with Release configuration as Active.
Thanks a lot,
Daniel
2022-03-25 03:06 AM
HI @DLoza.2 ,
I tested your parameters using PC GUI (with DTM image flashed on STEVAL-IDB011) and it works OK on my side - aci_gap_set_advertising_configuration is returning OK. So basically, your parameters for advertising configuration are OK.
So really strange... may you attached full .c file (or even better your project for SDK1.1.0) ? just in case....
Regards,
Sebastien.
2022-03-28 07:48 AM
Hi, @Sebastien DENOUAL,
Thanks for your reply. Since my project is complex, I have copied the important parts to a new one, but for some reason, now the status returned by aci_gap_set_advertising_configuration() is different: 0x85. Meaning: The requested operation cannot be performed by the Host in the current status.
I hope you can help me, thanks.
2022-03-29 12:23 AM
Hi @DLoza.2 ,
Looks in your project you are not caling gap_init() and gatt_init() function : it explains error code 0x85 - not allowed.
=> Before callling Bluetooth_enable_Extended_Beacon() function you must call Device_Init();
As a second step, aci_gap_set_advertising_configuration() was then returning 0x82.
I noticed stack config (In IAR project options ) was still BASIC_CONF. I changed to FULL_STACK config and now aci_gap_set_advertising_configuration() is returning OK.
Regards,
Sebastien.
2022-03-29 02:03 AM
It works!
I'm using WiSE Studio instead of IAR, so I had to navegate to project->Properties->C/C++ Build->Settings->Tool Settings->GCC C Compiler/Preprocessor and change in Defined symbols BLE_STACK_BASIC_CONF to BLE_STACK_FULL_CONF like you said, with Release configuration as Active.
Thanks a lot,
Daniel
2022-03-29 02:38 AM
Hi @Sebastien DENOUAL,
However, there is still something wrong. Now when the aci_gap_set_advertising_enable() function is called, I get this other error:
Error in aci_gap_set_advertising_enable() 0xd3
What does it mean: The configuration set by the aci_gap_set_advertising_configuration command is not valid.
Maybe, is there something else missing in the project options?
Regards,
Daniel.
2022-03-29 05:38 AM
Hi @DLoza.2 ,
Lookinking to your code, it seems you are only using one advertising set.
Here below in bold correct parameters :
// Enable advertising
/////////////////////
Advertising_Set_Parameters_t Advertising_Set_Parameters[2];
Advertising_Set_Parameters[0].Advertising_Handle = 1;
Advertising_Set_Parameters[0].Duration = 0;
Advertising_Set_Parameters[0].Max_Extended_Advertising_Events = 0;
//Advertising_Set_Parameters[1].Advertising_Handle = 2;
//Advertising_Set_Parameters[1].Duration = 0;
//Advertising_Set_Parameters[1].Max_Extended_Advertising_Events = 0;
status = aci_gap_set_advertising_enable(ENABLE, 1, Advertising_Set_Parameters);
Advertising should be OK at this stage.
According to the way you are handling project options, you may face memory issue ( beacon example from SDK is optimized in RAM usage) - In case of such issue, increase NUM_LINKS value in beacon_config.h.
Regards,
Sebastien.
2022-03-30 12:41 AM
Thanks! Now advertinsing is working!
With the parameters that you have shown me, the error 0xd3 disappeared. Also, like you said, i had a memory issue, but increasing NUM_LINKS the issue disappeared too. Now I can advertising correctly.
Thanks a lot,
Daniel