Slide 1: Everything you need to know about Bluetooth LE advertising
Everything you need to know about Bluetooth LE advertising Nordic Tech Webinar Hung Bui / Senior Application Engineer Håkon Helsing / Senior Application Engineer September 2020
Slide 2: Practicalities
© Nordic Semiconductor Practicalities Duration: 50-60 min Questions are encouraged! Please type questions in the top of the right sidebar All questions are anonymous Try to keep them relevant to the topic I will answer questions towards the end The chat is not anonymous, and should not
Slide 3: Today's hosts
© Nordic Semiconductor Today’s hosts Hung Bui Håkon Helsing Senior Application Senior Application Engineer Engineer
Slide 4: Agenda
© Nordic Semiconductor Agenda Basics Advertising Extensions Advertising types Advertising data format nRF Connect SDK API and example walk through Advertisiment analysis with nRF Sniffer for Bluetooth LE
Slide 5: Basics
Basics
Slide 6: What is advertising?
© Nordic Semiconductor What is advertising? A Broadcaster advertises to broadcast data Data RSSI Direction Finding I/Q data A Peripheral advertises to broadcast data and/or to make itself discoverable for a connection Two types of advertising: Legacy advertising Extended advertising
Slide 7: GAP roles and Link Layer states
© Nordic Semiconductor GAP roles and Link Layer states GAP role Link Layer state Broadcaster Advertising Observer Scanning Peripheral Advertising Connection (Slave) Central Scanning Initiating Connection (Master) All roles can also be in the standby state Bluetooth Core Specification 5.2, Vol 3, Par
Slide 8: Roles (GAP)
© Nordic Semiconductor Roles (GAP) B Broadcaster O Observer O B P Peripheral C Central
Slide 9: Roles (GAP)
© Nordic Semiconductor Roles (GAP) C B Broadcaster O Observer O B P Peripheral C Central
Slide 10: Roles (GAP)
© Nordic Semiconductor Roles (GAP) C B Broadcaster O Observer O P B P Peripheral C Central
Slide 11: Roles (GAP)
© Nordic Semiconductor Roles (GAP) C B Broadcaster O Observer O P B P Peripheral C Central
Slide 12: Roles (GAP)
© Nordic Semiconductor Roles (GAP) C B Broadcaster O Observer O P B P Peripheral C Central
Slide 13: Advertising and scanning
© Nordic Semiconductor Advertising and scanning Advertising interval = 20 ms 0-10 ms random delay 37 38 39 Advertising on channel B 20 ms 25 ms 28 ms 22 ms
Slide 14: Advertising and scanning
© Nordic Semiconductor Advertising and scanning Advertising interval = 20 ms 0-10 ms random delay 37 38 39 Advertising on channel B 20 ms 25 ms 28 ms 22 ms
Slide 15: Advertising and scanning
© Nordic Semiconductor Advertising and scanning Scan interval = 20 ms Scan window = 10 ms O 37 38 39 37 38 B 20 ms 25 ms 28 ms 22 ms
Slide 16: Advertising and scanning
© Nordic Semiconductor Advertising and scanning Scan interval = 20 ms Scan window = 10 ms O 37 38 39 37 38 B 20 ms 25 ms 28 ms 22 ms
Slide 17: Advertising and scanning
© Nordic Semiconductor Advertising and scanning Scan interval = 20 ms Scan window = 10 ms O 37 38 39 37 38 B 20 ms 25 ms 28 ms 22 ms
Slide 18: Advertising and scanning
© Nordic Semiconductor Advertising and scanning Scan interval = 20 ms Scan window = 10 ms O 37 38 39 37 38 B 20 ms 25 ms 28 ms 22 ms
Slide 19: Advertising types
Advertising types
Slide 20: Legacy advertising types
© Nordic Semiconductor Legacy advertising types Type Scannable Connectable ADV_IND Yes Yes ADV_SCAN_IND Yes ADV_NONCONN_IND ADV_DIRECT_IND Yes Bluetooth Core Specification 5.2, Vol 6, Part B, 2.3.1
Slide 21: Legacy advertising types
© Nordic Semiconductor Legacy advertising types Type Scannable Connectable ADV_IND Yes Yes ADV_SCAN_IND Yes ADV_NONCONN_IND ADV_DIRECT_IND Yes Extended advertising types ADV_EXT_IND AUX_ADV_IND AUX_SYNC_IND AUX_CHAIN_IND Bluetooth Core Specification 5.2, Vol 6, Part B, 2.3.1
Slide 22: GAP roles and advertising types
© Nordic Semiconductor GAP roles and advertising types GAP role Advertising types Broadcaster ADV_SCAN_IND ADV_NONCONN_IND Peripheral ADV_IND ADV_SCAN_IND ADV_NONCONN_IND ADV_DIRECT_IND Bluetooth Core Specification 5.2, Vol 3, Part C, 2.2.2
Slide 23: Scan request and scan response
© Nordic Semiconductor Scan request and scan response ADV_SCAN_IND and ADV_IND are scannable O RX B RX RX TX TX
Slide 24: Scan request and scan response
© Nordic Semiconductor Scan request and scan response ADV_SCAN_IND and ADV_IND are scannable O RX B RX RX TX TX TX
Slide 25: Scan request and scan response
© Nordic Semiconductor Scan request and scan response ADV_SCAN_IND and ADV_IND are scannable O RX TX Scan request B RX RX RX TX TX TX
Slide 26: Scan request and scan response
© Nordic Semiconductor Scan request and scan response ADV_SCAN_IND and ADV_IND are scannable RX RX O TX Scan response B RX RX RX TX TX TX TX
Slide 27: Connection request
© Nordic Semiconductor Connection request ADV_IND and ADV_DIRECT_IND are connectable C RX P RX RX TX TX TX
Slide 28: Connection request
© Nordic Semiconductor Connection request ADV_IND and ADV_DIRECT_IND are connectable C RX TX Connection request P RX RX RX TX TX TX
Slide 29: Non-connectable advertising
© Nordic Semiconductor Non-connectable advertising ADV_NONCONN_IND Not connectable or scannable No RX -> Lower power consumption O RX B TX TX TX
Slide 30: Advertising interval
© Nordic Semiconductor Advertising interval ADV_NONCONN_IND, ADV_SCAN_IND, ADV_IND 20 ms to 10.24 seconds, in steps of 0.625 ms 0-10 ms random delay Trade-off between power consumption and device discovery time Scan interval and scan window Leverage scanner if possible Bluetooth Core Spe
Slide 31: Advertising interval - ADV_DIRECT_IND
© Nordic Semiconductor Advertising interval - ADV_DIRECT_IND Directed advertising Used to quickly reconnect to a known Central Two duty cycle options: Low duty cycle The time between two advertisements shall be less or equal to 10 ms High duty cycle The time between two advertisements
Slide 32: White list
© Nordic Semiconductor White list An advertiser can use a white list to filter out unwanted scan requests and/or connection requests The white list contains device addresses and/or Identity Resolving Keys (IRKs) that the advertiser shall accept scan requests and/or connection requests from, filt
Slide 33: Advertising data
Advertising data
Slide 34: Advertising PDU
© Nordic Semiconductor Advertising PDU Advertising PDU: Header Payload 16 bits (1-255 octets) Advertising PDU header: PDU type RFU ChSel TXAdd RXAdd Length 4 bits 1 bit 1 bit 1 bit 1 bit 8 bits
Slide 35: Advertising PDU header
© Nordic Semiconductor Advertising PDU header Advertising PDU Header: PDU type RFU ChSel TXAdd RXAdd Length 4 bits 1 bit 1 bit 1 bit 1 bit 8 bits PDU type PDU name 0b0000 ADV_IND 0b0001 ADV_DIRECT_IND 0b0010 ADV_NONCONN_IND 0b0110 ADV_SCAN_IND
Slide 36: Advertising PDU header
© Nordic Semiconductor Advertising PDU header Advertising PDU header: PDU type RFU ChSel TXAdd RXAdd Length 4 bits 1 bit 1 bit 1 bit 1 bit 8 bits RFU: Reserved for future use ChSel: 1 if LE Channel Selection Algorithm #2 is supported TXAdd: 0 if address is public, 1 if random RXAdd: 0 if t
Slide 37: Advertising PDU payload
© Nordic Semiconductor Advertising PDU payload Advertising PDU: Header Payload 16 bits (1-255 octets) ADV_IND payload ADV_NONCONN_IND payload AdvA AdvData AdvA AdvData (6 octets) (0-31 octets) (6 octets) (0-31 octets) ADV_DIRECT_IND payload ADV_SCAN_IND payload AdvA TargetA AdvA AdvData (6 octets)
Slide 38: AdvA – Advertiser address
© Nordic Semiconductor AdvA – Advertiser address Public (TXAdd = 0) Random (TXAdd = 1) Unique address that can be recognized Static Private Non-resolvable Resolvable
Slide 39: Advertising data format
© Nordic Semiconductor Advertising data format Advertising PDU: Header Payload 16 bits (1-255 octets) ADV_IND payload ADV_NONCONN_IND payload AdvA AdvData AdvA AdvData (6 octets) (0-31 octets) (6 octets) (0-31 octets) ADV_DIRECT_IND payload ADV_SCAN_IND payload AdvA TargetA AdvA AdvData (6 octets)
Slide 40: Advertising data format
© Nordic Semiconductor Advertising data format AD structure 1 AD structure 2 ··· AD structure N Length AD type AD data 1 octet n octets Length – n octets With ADV_IND, ADV_NONCONN_IND and ADV_SCAN_IND the sum of the structures can be maximum 31 bytes, with overhead
Slide 41: Advertising data format – AD type
© Nordic Semiconductor Advertising data format – AD type AD type data format is defined in Part A in Bluetooth Core Specification Supplement (CSS) Most common AD types: Service UUID Local Name Flags Manufacturer Specific Data
Slide 42: Advertising data format – AD type
© Nordic Semiconductor Advertising data format – AD type Service UUID Typically included in connectable advertisements so that Centrals know supported service(s) without connecting. For example should a Heart Rate Sensor include the Heart Rate Service UUID Local Name Typically included in co
Slide 43: Advertising data format – AD type
© Nordic Semiconductor Advertising data format – AD type Flags (0x01) Shall be included when any of the Flag bits are non-zero and the advertising packet is connectable (ADV_IND) 5 bits: Limited Discoverable Mode General Discoverable Mode BR/EDR Not Supported Simultaneous LE and BR/EDR
Slide 44: Advertising data format – AD type
© Nordic Semiconductor Advertising data format – AD type Manufacturer Specific Data (0xFF) Typically used to include custom data The two first octets shall contain a company identifier from the company identifier assigned numbers (free to obtain for Bluetooth SIG members)
Slide 45: Advertising Extensions
Advertising Extensions
Slide 46: Why use Advertising Extensions?
© Nordic Semiconductor Why use Advertising Extensions? Increases advertising data length Allows advertising on data channels Enables long range connection establishment Chaining Periodic advertising
Slide 47: Increases Advertising data length
© Nordic Semiconductor Increases Advertising data length Legacy Advertising 2 bytes header 37 bytes payload 37 31 bytes advertising data Advertising Extensions 2 bytes header 255 bytes payload 254 bytes advertising data 255 0-63 extended header
Slide 48: Advertising on data channels
© Nordic Semiconductor Advertising on data channels Legacy Advertising Complete payload repeated on the advertising channels Advertising extensions Header is repeated on the advertising channels Payload is only transmitted once
Slide 49: Advertising on data channels
© Nordic Semiconductor Advertising on data channels Longer packets and coding Congested advertising channels Reduces contention and duty cycle 16320 symbols
Slide 50: Chaining
© Nordic Semiconductor Chaining Advertisements can be chained together to extend the amount of advertising data 255 255 255
Slide 51: Periodic Advertising
© Nordic Semiconductor Periodic Advertising Enables synchronized broadcasting of advertising data Happens at a deterministic interval allowing true connectionless broadcasting
Slide 52: Periodic Advertising
© Nordic Semiconductor Periodic Advertising Connectionless Direction Finding
Slide 53: nRF Connect SDK
nRF Connect SDK API, example walkthrough and demo
Slide 54: Demo setup
© Nordic Semiconductor Demo setup
Slide 55: nRF Connect SDK
© Nordic Semiconductor nRF Connect SDK
Slide 56: SEGGER Embedded Studio
© Nordic Semiconductor SEGGER Embedded Studio Preparing the network core of nRF5340 nRF 52 series devices may skip this step Prepare nRF5340 PDK with the hci_rpmsg sample Select the Network core as shown Build and run the sample
Slide 57: SEGGER Embedded Studio
© Nordic Semiconductor SEGGER Embedded Studio Project setup Locate the scan_adv sample Select your board directory Select the Application core Click ‘Build and run’ to flash the sample
Slide 58: Demo
© Nordic Semiconductor Demo
Slide 59: nRF Sniffer for Bluetooth LE
© Nordic Semiconductor nRF Sniffer for Bluetooth LE • Find the downloadvand instructions at nordicsemi.com
Slide 60: Demo
© Nordic Semiconductor Demo
Slide 61: Examples
© Nordic Semiconductor Examples Example 1: scan_adv sample, unmodified from Zephyr Project Example 2: Static address, name, Company ID Example 3: Advertising interval, set address Example 4: Scan response, send more data(128-bit UUID)
Slide 62: Example 1: scan_adv
Example 1 scan_adv
Slide 63: Example - scan_adv sample
© Nordic Semiconductor Example 1 - scan_adv sample [nRF Sniffer for Bluetooth LE window]
Slide 64: Example 2: Static address, name, Company ID
Example 2 Static address, name, Company ID
Slide 65: Example
© Nordic Semiconductor Example 2 [SES-window]
Slide 66: Example Filtering
© Nordic Semiconductor Example 2 Filtering [Wireshark window] PACKET LIST Extra packet information PACKET DETAILS BLE packet Packet info as: PACKET BYTES - hexadecimal (left) - ASCII (right) Wireshark filter for connection interval btle.connect.interval
Slide 67: Example 3: Advertising interval and set address
Example 3 Advertising interval and set address
Slide 68: Example
© Nordic Semiconductor Example 3 [SES-window]
Slide 69: Example
© Nordic Semiconductor Example 3 [Wireshark window]
Slide 70: Example 4: Scan response, send more data
Example 4 Scan response, send more data(128-bit UUID)
Slide 71: Example
© Nordic Semiconductor Example 4 [SES-window]
Slide 72: Example
© Nordic Semiconductor Example 4 [Wireshark window]
Slide 73: Q&A
Q&A