This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
I got simpleblePeripheral from SDK 3.20, add PLUS_BROADCASTER define, changed the default adv interval
#define DEFAULT_ADVERTISING_INTERVAL 1600
in init func I add this:
GAP_SetParamValue(TGAP_CONN_ADV_INT_MIN, advInt);
GAP_SetParamValue(TGAP_CONN_ADV_INT_MAX, advInt);
I expect that device will advertise every second in both connected and non connected state. But actually the advertisment interval is 1s while not connected, and 100ms while connected.
How to change the interval for non-connectable advertisements when device is connected?
Hi,
From the file gap.h:
GAP_SetParamValue(TGAP_CONN_ADV_INT_MIN, advInt); GAP_SetParamValue(TGAP_CONN_ADV_INT_MAX, advInt);
Allows you to modify the advertising interval of a connectable advertisement.
But:
GAP_SetParamValue(TGAP_GEN_DISC_ADV_INT_MIN, advInt); GAP_SetParamValue(TGAP_GEN_DISC_ADV_INT_MAX, advInt);
Allows you to modify the advertising interval of a either a scannable undirected advertisement or a non-connectable undirected advertisement.
The advertisement sent in connected-state is a non-connectable undirected advertisement. So the second code snippet should be used.
Can you please try this and let me know if it solves your issue?
Kind regards,
Hi Clement,
Thank you for the answer!
Actually my code already have a setting TGAP_GEN_DISC_ADV_INT_MIN / MAX. It looks like this:
{ // Use the same interval for general and limited advertising. // Note that only general advertising will occur based on the above configuration uint16_t advInt = DEFAULT_ADVERTISING_INTERVAL; GAP_SetParamValue(TGAP_LIM_DISC_ADV_INT_MIN, advInt); GAP_SetParamValue(TGAP_LIM_DISC_ADV_INT_MAX, advInt); GAP_SetParamValue(TGAP_GEN_DISC_ADV_INT_MIN, advInt); GAP_SetParamValue(TGAP_GEN_DISC_ADV_INT_MAX, advInt); GAP_SetParamValue(TGAP_CONN_ADV_INT_MIN, advInt); GAP_SetParamValue(TGAP_CONN_ADV_INT_MAX, advInt); }
So I already testing like you advised, but have the 100ms interval instead of 1000ms. Do you have any other suggestions?
Hi,
You are correct, the code I provided only modify the advertisement interval while not connected.
In order to modify the advertisement interval while connected, please use the following code (if needed, details can still be found in gap.h)
GAP_SetParamValue(TGAP_FAST_INTERVAL_2_INT_MIN, advInt_); GAP_SetParamValue(TGAP_FAST_INTERVAL_2_INT_MAX, advInt_);
The variable advInt_ must be set in 1.25 ms units (in your code, advInt was set in 0.625 ms units).
Kind regards,
Hi Clément,
Thank you! This helps!
But I found that actual units for the TGAP_FAST_INTERVAL_2_INT_MIN/MAX is 0.625 ms, instead of 1.25 ms stated in gap.h.
Hi,
Good to see that your problem is solved and thank you for taking the time to share your observation.
FYI, I have opened an internal ticket to get the documentation changed accordingly to your remark.
Kind regards,