One of the new features added in Bluetooth 5 is the LE coded PHY which enables longer range connections. This article describes how advertising on the coded PHY works, as well how to establish a connection using the coded PHY.
Traditional Bluetooth low energy advertisements use channels 37, 38 and 39 only for advertising. The advertisement is identical on each channel and contains the advertiser’s address and advertising data payload. Starting in Bluetooth 5 it is possible to offload the advertising data payload onto one of the data channels. In this new type of advertisement, the same three advertising channels are used but instead of including the data payload, they include a pointer to the data channel and the offset time until the data payload is expected. This type of advertising is known as extended advertising. The following diagram is provided to illustrate
The common extended advertising format looks like this
The ADV mode field is shown below, note that is not permitted to be scannable and connectable at the same time
The extended header is laid out as follows, not all fields will be present in every advertisement
The aux pointer field provides information about the auxiliary advertisement as shown below
The channel index indicates which channel the auxiliary advertisement will come on. The CA field indicates the clock accuracy, the offset units indicate whether the offset (time until the auxiliary advertisement) is in units of 30 us or 300 us, the aux offset indicates the number of offset units until the auxiliary advertisement can be expected and the aux PHY indicates which PHY be used in the auxiliary advertisement.
The sync info field is not presently used. The Tx Power field indicates the transmitted power in dBm.
Another feature of these extended advertisements is that it is possible to specify the PHY used for the primary and secondary advertisements separately. To set the PHY used for advertisments, the following API function can be used
gecko_cmd_le_gap_set_advertise_phy(0, le_gap_phy_coded , le_gap_phy_coded);
The parameters indicate the advertisement set to be used, the PHY for primary advertisements and the PHY used for secondary advertisements
Advertisements on the coded PHY do not support active scanning. This means that is always necessary to use the new connectability mode le_gap_connectable_non_scannable.
To start advertising, the following API function can be used
Remaining advertising parameters can be set as they would with the traditional 1 Mbps PHY.
Please refer here for an article summarizing the changes to the API in version 2.8.
Source code for an example advertiser and observer are attached below. To use this code please do as follows
Thanks, this was helpful. I made an SPP over BLE example with coded phy which works well but I did have some problems with a very slow discover services and enable notifications. It took 9 seconds to finish establishing the link before I could send data.
So, in case it helps others with the same problem:
In the example code in le-connections-client-main.c the connection parameters are set as below:
// this caused very slow negotiation of characteristic notification.
// 700 min interval x 1.25mS = 0.87 Second connection interval x multiple intervals during negotiation!
I reduced the minimum connection interval and now have a fast enough connection.
we're in the process of making all the sample code for these articles more portable. For now you can create an soc-empty project for your module and paste in the le-connections-client-main.c/lcoded-phy-main.c to replace the main.c that comes from the soc-empty sample.
You may also need to comment out some of the printf() statements. I'll post an updated sample here when it's ready.
I will have a try, I guess the simplest way to run this is program one kit as advertiser, as the step above, and program the other kit as NCP and use BG Tool and run with it.
EDIT: Running BG Tools as the client able to scan and read the advertisement from first part, but using the client app.c and app.h, it would just give me:
System Bootble devices in range
le_set_gap_set_discovery_timing returns 0
le_set_gap_set_discovery_type returns 0
le_set_gap_start_discovery returns 0
no connectable devices in range
EDIT2: manage to edit MAC address filter to match mine. Then also removing timers, for my purpose, I only need to plot the RSSI values no need to connect. For connection and throughput test, I would hope someone answering my question on another topic, where the throughput test can be started using Coded PHY as default.
(1) I advice you that, using Chrome or Edge browsers, I do not see any image you posted here.
(2) I'm interested on transmit ADV Payload with Manufacturer Data (like iBeacon for example), can you suggest me the modifications needed in the actual ADVERTISER code to do that. Thanks.
Hi, I have tried looking out for those images on Chrome (Version 70.0.3538.77 - Official Build, 64-bit), Microsoft Edge (Version 42.17134.1.0) and Internet Explorer (Version 11.345.17134.0). Still not visible.
Seems we're having trouble inlining images in knowledgebase articles. I'll attach a pdf version of the article.
I'm interested on transmit ADV Payload with Manufacturer Data (like iBeacon for example), can you suggest me the modifications needed in the actual ADVERTISER code to do that. Thanks.