This blog is to introduce the Bluetooth Low Energy with difference codec configuration on Nordic nRF52 SDK. Bluetooth 5.0 had introduced the long range (Codec Phy 125kbps, 500kbps) and high speed 2 Mbps (uncoded PHY).
Here are the topics in this blog:
- Basic introduction on the difference Coded/Uncoded Phy on the Bluetooth 5.0 specification
- How to configure the advertising mode with difference Coded/Uncoded Phy
- How to switch the connection with difference Coded/Uncoded Phy.
Bluetooth Low Energy with difference PHYs and Rates
Here are the different PHYs and rates available in Bluetooth version 5.0 and beyond:
- Original 1M PHY: 1 Megasymbols/second –> where each data bit is represented by 1 symbol –> 1 Mbps
- Coded PHY: 1 Megasymbols/second –> where each data bit is represented by 2 or 8 symbols –> 500 Kbps, or 125 Kbps
- 2M PHY: 2 Megasymbols/second –> where each data bit is represented by 1 symbol –> 2 Mbps
Packet Format for the LE Uncoded PHY
The following packet format is defined for the LE Uncoded PHYs (LE 1M and
LE 2M) and is used for packets on all physical channels.
This packet format is shown in Figure 2.1. Each packet consists of four
mandatory fields and one optional field. The mandatory fields are Preamble,
Access Address, PDU, and CRC. The optional field is Constant Tone
Packet Format for the LE Coded PHY
The following packet format is defined for the LE Coded PHY and is used for
packets on all physical channels. This packet format is shown in Figure 2.3.
The FEC block 2 consists of three fields: PDU, CRC, and TERM2. These shall
use either the S=2 or S=8 coding scheme as defined in Section 3.3, depending
on the value of the CI.
More details can be found at
How to Configure the Advertising Mode with Difference Coded/Uncoded PHY
Basically, you can find difference PHYs on advertising type in the following table 2.3.
By using the 1Mbps or 2Mbps, it needs to use the Primary Advertising mode.
By using the Coded PHY (125kbps), you need to use the secondary mode.
The example code is as below.
How to Switch the Connection with Difference Coded/Uncoded PHY
On the LL Control Layer, it has 3 difference events for the PHY update.
The master or slave of the connection may request a change in the PHY using
a Link Layer control procedure (see Figure 6.28 to Figure 6.36).
The sequence of events shown in figures 6.30 and 6.33 can only happen
before feature exchange and can only happen once per connection, because a
Link Layer must not use a procedure that it knows the peer does not support as
required by [Vol 6] Part B, Section 4.6.
All the code can be found at https://github.com/jimmywong2003/nrf52-ble-phy-coded-update-example.
By pressing button 2, it switches to PHY 2Mbps.