SWRU580 April 2021 CC2564C , CC2564MODA , CC2564MODN
This section provides a description on how to use the demo application to connect two or more configured boards and communicate over bluetooth (BR/EDR and LE). We will setup one of the boards as a central device over LE and Master over BR/EDR and the other board as a peripheral device over LE and Slave over BR/EDR. We will then initiate the connections from the first device to the other. Once connected, we will show how to use the new features over the connection.
Establish ConnectionPeripheral device initialization and advertising
Figure 13-2 SPPDMMulti Demo Local
BT Address
Figure 13-3 SPPDMMulti Demo
Register SPPDMMultiThe default values are:
0 = Non Discoverable, 1 = Limited Discoverable, 2 = General Discoverable
For this example we will use General Discoverable mode (The same as in the default values).
Figure 13-4 SPPDMMulti Demo Set
Discoverability Mode0 = Non Conectable, 1 = Connectable, 2 = Direct Connectable, 3 = Low Duty Cycle Direct Connectable.
For this example we will use Low Duty Cycle Direct Connectable which is a new feature from specification 4.1.
Figure 13-5 SPPDMMulti Demo Set
Connect Mode
Figure 13-6 SPPDMMulti Demo Set
Advertising Interval0 = Static, 1 = Resolvable, 2 = Non-Resolvable
For this example we will use Static random address type.
Figure 13-7 SPPDMMulti Demo Set
Random AddressThe AdvertiseLE command has multiple options to advertise:
Figure 13-8 SPPDMMulti Demo
AdvertiseLE CommandAdvertiseLE 0
AdvertiseLE 1 or AdvertiseLE 1 0
AdvertiseLE 1 1 [Own Random BD_ADDR]
AdvertiseLE 1 0 0 0 [Peer Public BD_ADDR]
AdvertiseLE 1 1 [Own Random BD_ADDR] 0 [Peer Public BD_ADDR]
AdvertiseLE 1 1 [Own Random BD_ADDR] 1 [Peer Random BD_ADDR]
For this example we will use option 5, The device is on Low Duty Cycle Direct Connectable, Own Address type - Random address and the peer device use Public address.
Figure 13-9 SPPDMMulti Demo Enable BLE
AdvertisingNow the peripheral is advertising and waiting for connection request from the central device.
Central device connection creation and configurationThe Central can initiate the connection request and when the peripheral will advertise the connection will be created.
[Steps 1 and 2 are optional if you already know the Bluetooth address of the device that you want to connect to]
Figure 13-10 SPPDMMulti Demo
Scanning CommandsThe ConnectLE command has multiple options to connect:
Figure 13-11 SPPDMMulti Demo Connect LE
CommandConnectLE [Peer Public BD_ADDR]
ConnectLE [Peer Public BD_ADDR] 0
ConnectLE [Peer Public BD_ADDR] 0 0
ConnectLE [Peer Random BD_ADDR] 1
ConnectLE [Peer Random BD_ADDR] 1
ConnectLE [Peer Random BD_ADDR] 1 1
ConnectLE [Peer Public BD_ADDR] 1 1
For this example we will use option 2, The peripheral using Random address type and the central device using Public address type.
Figure 13-12 SPPDMMulti Demo Connect
Successful
Figure 13-13 SPPDMMulti Demo
Connection and FeaturesNow we have a connection established and both devices are ready to send data to each other. Before the information can be sent we must first discover and configure the service in the Central terminal.
The DiscoverLEServicecommand has multiple options to discover:
Figure 13-14 SPPDMMulti Discover
Services CommandThis option will store the SPPDMMulti handles.
DiscoverLEServicecommand [Peer BD_ADDR] [1]
DiscoverLEServicecommand [Peer BD_ADDR] [1] [0]
DiscoverLEServicecommand [Connection ID] [1] [1]
This option will store the SPPLE handles.
DiscoverLEServicecommand [Peer BD_ADDR] [2]
DiscoverLEServicecommand [Peer BD_ADDR] [2] [0]
DiscoverLEServicecommand [Connection ID] [2] [1]
This option will only print the handles.
DiscoverLEServicecommand [Peer BD_ADDR] [16 or 32 or 128]
DiscoverLEServicecommand [Peer BD_ADDR] [16 or 32 or 128] [0]
DiscoverLEServicecommand [Peer BD_ADDR] [16 or 32 or 128] [1]
For this example we will use option 1, The peripheral is advertising with SPPDMMulti Handles so we need to store them and we will use the Connection ID method.
Figure 13-15 SPPDMMulti Demo
Disocver LE Service Command
Figure 13-16 SPPDMMulti Demo
Configure LE Service
Figure 13-17 SPPDMMulti Demo
Configure LE Results
Figure 13-18 SPPDMMulti Demo
Connected DevicesWe will setup the one of the boards (In our example, the one that we are running as a Peripheral device) as a slave so we need to open a SPP port on this device.
For this example we will use port number 10.
Figure 13-19 SPPDMMulti Demo Open
Server PortNow that the Slave device opened the SPP port, the Master can initiate the connection.
[Step 1 is optional if you already know the Bluetooth address of the device that you want to connect to]
Figure 13-20 SPPDMMulti Demo
Inquiry Results
Figure 13-21 SPPDMMulti
Demo Open Client Command
Figure 13-22 SPPDMMulti
Demo Switching RolesNow we have a connection established and both devices are ready to send data to each other.
Figure 13-23 SPPDMMulti
Demo Connected Devices Command 2
Figure 13-24 SPPDMMulti Demo
Disconnect BLE CommandOption 1, we use the CloseServer command from the slave , type CloseServer [Serial Port ID], if no Serial Port ID will be entered all opened ports will be closed.
Option 2, we use the CloseClient command from the slave , type CloseClient Server [Serial Port ID], if no Serial Port ID will be entered all opened ports will be closed.
For this example we will use option 2.
Figure 13-25 SPPDMMulti Demo Close
Client CommandThe default values are:
Pairability Mode - Pairable
I/O Capability - No Input/Output
Bonding Type - Bonding
MITM Requirement - Yes
SC Enable - Yes
P256 debug - No
0 = Non Pairable, 1 = Pairable
For this example we will use Pairable mode (The same as in the default values).
Figure 13-26 SPPDMMulti Demo Set
Pair ModeI/O Capability (0 = Display Only, 1 = Display Yes/No, 2 = Keyboard Only, 3 = No Input/Output, 4 = Keyboard/Display)
Bonding Type (0 = No Bonding, 1 = Bonding)
MITM Requirement (0 = No, 1 = Yes)
SC Enable (0 = No, 1 = Yes)
P256 debug (0 = No, 1 = Yes)
Figure 13-27 SPPDMMulti Demo Set
Pairing ParamsFor this example we will use the default values.
Figure 13-28 SPPDMMulti Demo Change
Pairing ParamsThe LE Pairing procedure require an active LE connection, so after running the instructions in paragraph 2.1.1 you can start the LE pairing procedure.
Figure 13-29 SPPDMMulti Demo Pair
BLE Command
Figure 13-30 SPPDMMulti Demo Secure
Connection and BondingThe default values are:
Pairability Mode - Pairable
I/O Capability - No Input/Output
MITM Requirement - Yes
0 = Non Pairable, 1 = Pairable, 2 = Pairable (Secure Simple Pairing
For this example we will use Pairable mode (The same as in the default values).
Figure 13-31 SPPDMMulti Demo Set CB
Pair ModeI/O Capability (0 = Display Only, 1 = Display Yes/No, 2 = Keyboard Only, 3 = No Input/Output)
MITM Requirement (0 = No, 1 = Yes)
Figure 13-32 SPPDMMulti Change
Simple Pairing ParamsFor this example we will use the default values.
Figure 13-33 SPPDMMulti Demo Change
Simple Pairing Params Command ResponseThe BR/EDR Pairing procedure require a non-active BR/EDR connection, so after running this instructions, run the instructions in paragraph 2.1.2.
Figure 13-34 SPPDMMulti Demo Pair
CommandFor this example we will use BD_ADDR and General pairing type.
Figure 13-35 SPPDMMulti Demo Pair
Command Response
Figure 13-36 SPPDMMulti Demo
PinCodeResponse
Figure 13-37 SPPDMMulti Demo BLE
Unpair Command
Figure 13-38 SPPDMMulti Demo BT
Unpair
Figure 13-39 SPPDMMulti Demo BLE
Send
Figure 13-40 SPPDMMulti Demo BLE
Send and Receive
Figure 13-41 SPPDMMulti Demo BLE
ReadOption 1: Write command, This command will send only 10 bytes every use. To use this command type, Write [Serial Port ID].
Figure 13-42 SPPDMMulti Demo BT
Write CommandOption 2: CBSend command, This command will send the user input amount of bytes, This function can also disable or enable the sniff mode. To use this command type, CBSend [Number of Bytes to send] [Serial Port ID] [0 - Enable Automatic Sniff (Default) or 1 - Disable Automatic Sniff].
Figure 13-43 SPPDMMulti Demo CBSend
CommandFor this example we will use option 1 and send 10 bytes.
Figure 13-44 SPPDMMulti Demo BT
Send and Receive
Figure 13-45 SPPDMMulti Demo BT
ReadThe default values are:
Connection_Interval_Min - 50ms (Range: 8..4000 in ms)
Connection_Interval_Max - 200ms (Range: 8..4000 in ms)
Minimum_Connection_Length - 0ms (Range: 0..65535 in ms)
Maximum_Connection_Length - 10000ms (Range: 0..65535 in ms)
Slave_Latency - 0ms (Range: 0..500 in ms)
Supervision_Timeout - 20000ms (Range: 100..32000 in ms)
ScanInterval - 100ms (Range: 3..10240 in ms)
ScanWindow - 100ms (Range: 3..10240 in ms)
Figure 13-46 SPPDMMulti Demo Set
Connection ParametersThis command has two options to work.
Option 1: List the contains only connected devices, For this option type ConnectedDevices with or without the parameter 0.
In the Image below you can see that we are connected to three devices: To the first we are connected as a Master in LE (Central) and Slave in BR/EDR (Because of the role switch). To the second we are connected as a Master in LE (Central). To the third we are connected as a Slave in LE (Peripheral).
Figure 13-47 SPPDMMulti Demo
Connected Devices ListOption 2: List of all devices in the list, that means devices that was previously LE paired or opened SPP server ports.
In the Image below you can see the difference between option 1 and option 2. Option 1 shows that we are connected only to one device (Connection ID 2). Option 2 shows the full list. The green color shows devices that are not connected but we are paired with them (LTK is stored). The yellow color shows the device that is connected (Connection ID 2). The light blue color shows the opened SPP Server ports that are waiting to be connected.
Figure 13-48 SPPDMMulti Demo
Connected Devices OptionsThis sample application has Sniff mechanism that is used to free the baseband when BR/EDR connection is being used.
when using our sample and enabling this mode, when reading and writing over BR/EDR the device will exit and enter sniff automatically.
The default values are:
MaxInterval - 600ms
MinInterval - 400ms
Attempts - 4
Timeout - 1
Figure 13-49 SPPDMMulti Demo Set
Sniff Params
Figure 13-50 SPPDMMulti Demo Sniff
Mode Command
Figure 13-51 SPPDMMulti Demo Sniff
Mode Option
Figure 13-52 SPPDMMulti Demo Update
ConnectionBoth following command need the devices to be paired over LE, see paragraph 2.3.1 for instructions.
The value Authenticated Payload Timeout is in ms units.
Figure 13-53 SPPDMMulti Demo Set
Authentication Payload Timeout
Figure 13-54 SPPDMMulti Demo Query
Authencation Payload Timeout