Closed cy-vaira closed 4 years ago
The issue is resolved when the .minInterval & .maxInterval of _advParams are set to non-zero value. This structure is in libraries/c_sdk/standard/ble/src/iot_ble_gap.c file.
static IotBleAdvertisementParams_t _advParams =
{
.includeTxPower = true,
.name = { BTGattAdvNameShort, IOT_BLE_DEVICE_SHORT_LOCAL_NAME_SIZE},
.setScanRsp = false,
.appearance = IOT_BLE_ADVERTISING_APPEARANCE,
.minInterval = IOT_BLE_ADVERTISING_CONN_INTERVAL_MIN,
.maxInterval = IOT_BLE_ADVERTISING_CONN_INTERVAL_MAX,
.serviceDataLen = 0,
.pServiceData = NULL,
.manufacturerLen = 0,
.pManufacturerData = NULL,
.pUUID1 = ( BTUuid_t * ) &_advUUID,
.pUUID2 = NULL
};
Hello @cy-vaira,
I am investigating this issue.
Hi @cy-vaira
The connection intervals (min and max) is set to 0 to use the stack specific default values. Our BLE HAL layer API specification has this mentioned here, though I agree documentation is unclear.
I have added a PR to fix the documentation #1515
So the vendor implementation needs to use stack specific default values if the min and max connection intervals are set to 0.
Does that answer your question ?
Hi @ravibhagavandas,
Thanks for the response. I believe end-users will be often configuring the connection interval parameters. What is the way for an end-user to do that?
@cy-vaira
Thanks for your response.
After checking through the code, I think it should also pass inIOT_BLE_ADVERTISING_CONN_INTERVAL_MIN
an IOT_BLE_ADVERTISING_CONN_INTERVAL_MAX
as you described above (so that end user can configure the connection intervals). We are working on a fix for this.
Hi @cy-vaira
I wanted to let you know that we have to revert back the above change for connection interval parameter in this PR #1545.
Reason being, the allowable size of the advertisement data is 31 bytes. With the existing parameters, advertisement data adds up to 30 bytes as follows
Service UUID 128 bit - 18 bytes (length - 1 byte, type -1 byte, value - 16 bytes)
Short local name - 6 bytes (length - 1 byte, type -1 byte, value - 4 bytes)
TX power - 3 bytes (length - 1 byte, type -1 byte, value - 1 byte)
So we have removed slave connection interval params from advertisement data (by setting the values to 0 in advertisement params) and enabling them in scan response data. The parameter is optional as per bluetooth specification and can be included in either advertisement or scan response data.
PR #1545 also updates the HAL API documentation mentioning the same.
Hi @ravibhagavandas,
We see an issue with your solution. It's not a good idea to define the advertising interval via a macro (IOT_BLE_ADVERTISING_INTERVAL). Advertising interval is something user may want to change during the run time. For example, advertise rapidly for some time and switch to a lower advertising rate if no connection has been made. This is to save power.
Either there should be a GAP API to specify the advertising interval or the IotBleAdvertisementParams_t structure should have a member for specifying it.
@cy-vaira
With the current HAL API, we don't expose this parameter to the user, since advertisement interval is a low level controller parameter and its often better for vendors to configure this with sane values based on power consumption. However the use case of setting advertisement intervals at run-time makes sense. We will look into how to best support this in our HAL layer.
Describe the bug BLE advertisement does not work with the BLE GATT Server demo.
System information
git describe --tags
to find it) 201908.00Expected behavior Device should appear on the list when scanned for BLE devices.
To reproduce Steps to reproduce the behavior: Please replace /cypress/boards/CY8CPROTO_062_4343W with any other board that supports BLE.
Thank you!