Silicon Labs RS9116W BLE AT Reference Manual

silabs.com | Building a more connected world. 1 | Page
RS9116W BLE AT Command Programming
Version 2.1
February 10, 2021
RS9116W BLE AT Command Programming Reference Manual
Version 2.1
silabs.com | Building a more connected world. 2 | Page
Table of Contents
1 Architecture ............................................................................................................................................................ 5
2 Bootloader .............................................................................................................................................................. 7
3 Host Interfaces ..................................................................................................................................................... 18
3.1 UART Interface ............................................................................................................................................. 18
4 Command Mode Selection ................................................................................................................................... 20
5 Command Format ................................................................................................................................................. 21
6 BLE Commands .................................................................................................................................................... 29
6.1 Generic Commands ...................................................................................................................................... 29
6.1.1 Set Operating Mode...................................................................................................................................... 29
6.1.2 Query RSSI ................................ ................................................................................................ .................. 35
6.1.3 Query Local BD Address .............................................................................................................................. 35
6.1.4 Query BT Stack Version ............................................................................................................................... 35
6.1.5 BLE PER Transmit ....................................................................................................................................... 36
6.1.6 BLE PER Receive ........................................................................................................................................ 37
6.1.7 PER CW Mode ............................................................................................................................................. 39
6.2 BLE Core Commands ................................................................................................................................... 39
6.2.1 Advertise Local Device ................................................................................................................................. 39
6.2.2 Scan ............................................................................................................................................................. 40
6.2.3 Connect ........................................................................................................................................................ 42
6.2.4 Disconnect ................................................................................................................................................... 43
6.2.5 Query Device State....................................................................................................................................... 43
6.2.6 Start Encryption ............................................................................................................................................ 44
6.2.7 SMP Pair Request ................................ ................................................................................................ ........ 44
6.2.8 SMP Response ............................................................................................................................................ 45
6.2.9 SMP Passkey ............................................................................................................................................... 45
6.2.10 Initialize BLE Module .................................................................................................................................... 45
6.2.11 Deinitialize BLE Module ................................................................................................................................ 46
6.2.12 BT Antenna Select ........................................................................................................................................ 46
6.2.13 BLE Set Advertise Data ................................................................................................................................ 46
6.2.14 BLE Set Scan Response Data ...................................................................................................................... 47
6.2.15 BLE Set LE Ping Timeout ............................................................................................................................. 47
6.2.16 BLE Get LE Ping Timeout ............................................................................................................................. 48
6.2.17 BLE Set Random Device Address ................................................................................................................. 48
6.2.18 BLE Data Encrypt ......................................................................................................................................... 49
6.2.19 BLE Whitelist ................................................................................................................................................ 49
6.2.20 BLE Set MTU Size Command ................................ ....................................................................................... 49
6.2.21 BLE Set Phy Command ................................................................................................................................ 50
6.2.22 BLE Read Phy Command ............................................................................................................................. 50
6.2.23 BLE Set Data Length Command ................................................................................................................... 51
6.2.24 BLE Read Maximum Data Length Command ................................ ................................................................ 51
6.2.25 BLE_Resolvlist ............................................................................................................................................. 52
6.2.26 BLE GetResolvlist Size ................................................................................................................................. 52
6.2.27 BLE SetResolution Enable ................................................................ ............................................................ 52
6.2.28 BLE SetPrivacy Mode ................................................................................................................................... 53
6.2.29 BLE Connection Update Command .............................................................................................................. 53
6.3 BLE GATT Profile Commands ...................................................................................................................... 54
6.3.1 Query Profiles List ........................................................................................................................................ 54
6.3.2 Query Profile ................................................................................................................................................ 54
6.3.3 Query Characteristic Services ................................ ....................................................................................... 55
6.3.4 Query Include Services ................................................................ ................................................................. 55
6.3.5 Read Characteristic Value By UUID .............................................................................................................. 56
6.3.6 Query Attribute ............................................................................................................................................. 56
6.3.7 Query Attribute Value ................................................................................................................................... 57
6.3.8 LE L2CAP Credit Based Flow Control Connection Request ........................................................................... 57
6.3.9 LE L2CAP Credit Based Flow Control Data Transfer ..................................................................................... 57
6.3.10 LE L2CAP Credit Based Flow Control Connection Response ........................................................................ 58
6.3.11 LE L2CAP Credit Based Flow Control Disconnection .................................................................................... 58
6.3.12 LE Enhanced Receiver Test Mode ................................................................................................................ 58
6.3.13 LE Enhanced Transmitter Test Mode ............................................................................................................ 59
6.3.14 LE Enhanced End Test Mode ....................................................................................................................... 59
6.3.15 LE LTK Request Reply ................................................................................................................................. 60
6.3.16 LE Read Multiple .......................................................................................................................................... 60
6.3.17 Query Long Attribute Value ........................................................................................................................... 61
6.3.18 Set Attribute Value ........................................................................................................................................ 61
6.3.19 Set Attribute Value No Ack............................................................................................................................ 61
6.3.20 Set Long Attribute Value ............................................................................................................................... 62
RS9116W BLE AT Command Programming Reference Manual
Version 2.1
silabs.com | Building a more connected world. 3 | Page
6.3.21 Set Prepare Long Attribute Value ................................................................ .................................................. 62
6.3.22 Execute Long Attribute Value ........................................................................................................................ 63
6.4 BLE Create New Service Commands ........................................................................................................... 63
6.4.1 Add GATT Service Record............................................................................................................................ 63
6.4.2 Add Attribute Record .................................................................................................................................... 63
6.4.3 Set Local Attribute Value .............................................................................................................................. 64
6.4.4 Get Local Attribute Value ................................................................ .............................................................. 64
6.4.5 Remove Service ........................................................................................................................................... 65
6.4.6 Remove Attribute .......................................................................................................................................... 65
6.5 BLE Core Events .......................................................................................................................................... 66
6.5.1 Advertise Report Event ................................................................................................................................. 66
6.5.2 LE Connected Event ..................................................................................................................................... 66
6.5.3 Disconnected................................................................................................................................................ 67
6.5.4 SMP Request Event ..................................................................................................................................... 67
6.5.5 SMP Response Event ................................................................................................................................... 67
6.5.6 SMP Passkey Event ..................................................................................................................................... 67
6.5.7 SMP Failed Event ......................................................................................................................................... 68
6.5.8 SMP Encrypt Enabled Event ......................................................................................................................... 68
6.5.9 LE Ping Payload Timeout ............................................................................................................................. 68
6.5.10 LE MTU Size ................................................................................................................................................ 68
6.5.11 SMP Passkey Display Event ......................................................................................................................... 69
6.5.12 Phy Update Event ......................................................................................................................................... 69
6.5.13 BLE Data Length Change Event ................................................................................................................... 70
6.5.14 SMP Secure Connection Passkey Event ....................................................................................................... 70
6.5.15 LE Directed Advertising Report Event ........................................................................................................... 70
6.5.16 Enhanced Connection Complete Event ......................................................................................................... 71
6.5.17 L2cap Credit Based Flow Control Connection Request Event........................................................................ 71
6.5.18 L2cap Credit Based Flow Control Connection Complete Event ...................................................................... 72
6.5.19 L2cap Credit Based Flow Control RX Data Event .......................................................................................... 72
6.5.20 L2cap Credit Based Flow Control Disconnection Event ................................................................................. 72
6.5.21 PSM Conn Failed Event ................................................................................................................................ 72
6.5.22 LE LTK Request Event ................................................................................................................................. 73
6.5.23 LE Security Keys Event ................................................................................................................................ 73
6.5.24 Conn Update Event ...................................................................................................................................... 73
6.6 BLE GATT Events ........................................................................................................................................ 74
6.6.1 GATT Notification ......................................................................................................................................... 74
6.6.2 GATT Indication............................................................................................................................................ 74
6.6.3 GATT Write .................................................................................................................................................. 75
6.6.4 GATT Read ................................ ................................................................................................ .................. 75
7 BLE Error Codes .................................................................................................................................................. 77
7.1 Generic Error Codes ..................................................................................................................................... 77
7.2 Mode Error Codes ........................................................................................................................................ 79
8 BLE Power Save Operation ................................................................................................................................. 81
8.1 Power Save Mode 0 ..................................................................................................................................... 81
8.2 Power Save Mode 2 (GPIO Based Mode) ................................................................ .................................... 81
8.3 Power Save Mode 3 (Message Based Mode)............................................................................................... 82
8.4 Power Save Mode 8 ..................................................................................................................................... 82
8.5 Power Save Mode 9 ..................................................................................................................................... 83
9 BLE AT CMD Configuration Changes/Enhancements ...................................................................................... 84
10 Revision History ................................................................................................................................................... 85
11 Appendix A: Sample Flows ................................................................................................................................. 87
11.1 Sample flow of APIs for BLE ......................................................................................................................... 87
11.2 Sample flow of APIs for WiFi+BT LE Co-ex mode ........................................................................................ 90
RS9116W BLE AT Command Programming Reference Manual
Version 2.1
silabs.com | Building a more connected world. 4 | Page
About this Document
This document describes the Bluetooth Low Energy (BLE) commands, along with the parameters used in commands, valid values for each command, and the expected responses from the modules. This document is also used to write software for Host MCU to control and operate the module.
Note:
This document should be used with WiSeConnect version 2.3.0.
RS9116W BLE AT Command Programming Reference Manual
Version 2.1
silabs.com | Building a more connected world. 5 | Page
1 Architecture
The following figure depicts the overall architecture of the RS9116-WiSeConnect:
Figure 1: Architecture Overview for RS9116W
RS9116W BLE AT Command Programming Reference Manual
Version 2.1
silabs.com | Building a more connected world. 6 | Page
Bluetooth Software Architecture
Figure 2: Bluetooth Software Architecture
Application
Application layer launches Bluetooth stack and uses commands to access various profiles on remote Bluetooth devices over the network.
Profiles There are several Bluetooth profiles defined in the Bluetooth specification. Currently Generic Attribute Profile (GATT)
and Generic Access Profile (GAP) profiles are supported. Framework to develop new profiles is provided and new profiles will be added.
Bluetooth Core The Bluetooth core contains following higher layers of stack.
• SMP
• ATT
• L2CAP
• BLE Controller
• SMP is a security management protocol which provides services like pairing and key distribution.
• ATT (Attribute Protocol) provides a server to expose attribute values.
• L2CAP (Logical Link Control and Adaption Protocol) provides connection-oriented and connection less data
services to upper layer protocols with data packet size upto 64KB in length.
• L2CAP performs the segmentation and reassembling of I/O packets from the baseband Controller.
• BLE Controller which includes link controller layers.
OS Abstraction Layer This layer abstracts RTOS services (semaphores, mutexes and critical sections) that are used by the whole stack and
the applications. The stack, which is designed in an RTOS-independent manner, can be used with any RTOS by porting this layer. It is also possible to use the Bluetooth stack standalone without RTOS.
RS9116W BLE AT Command Programming Reference Manual
Version 2.1
silabs.com | Building a more connected world. 7 | Page
2 Bootloader
This section briefs about features that are supported by the Network and Security Processor (NWP) bootloader. Basic Features
• Load default firmware
• Load selected firmware
• Upgrade firmware from host
• Selecting default images
• Enable / Disable host interaction bypass
• Support for multiple host interfaces (SDIO / SPI / UART / USB / USB-CDC)
• Firmware integrity check
• Upgrading keys
• JTAG selection
The RS9116W supports two Boot loading modes:
1. Host Interaction (Non-bypass) Mode: a. In this mode host interacts with the bootloader and gives boot up options (commands) to configure
different boot up operations.
b. The host tells the module what operations it has to perform based on the selections made by the user.
2. Bypass Mode: a. In this mode boot-loader interactions are completely bypassed and uses the stored boot-up configurations
(which are selected in host interaction mode) & loads default firmware image in the module.
b. This mode is recommended for final production software to minimize the boot up time.
Host Interaction Mode In this mode, host interaction varies based on host interface. Host interactions in SPI / USB and UART / USB-CDC
are different. In UART & USB-CDC boot up options are menu based and in SPI / USB it uses command exchanges. The details are explained in the below section.
Host Interaction Mode in UART / USB-CDC This section explains the host interaction mode in UART / USB CDC mode. Startup Operation After powering up, Host is required to carry out ABRD (Auto Baud Rate Detection) operation and after successful
ABRD, the module displays menu of boot up options to host. Host needs to select the appropriate option.
Note:
On powerup, bootloader checks the integrity of the bootup options. If the integrity fails, it computes the integrity from backup. If integrity passes, it copies the backup to the actual location. If the integrity of the backup options also fails, the bootup options are reset/cleared. In either of the cases, bootloader bypass is disabled, or corresponding error messages are given to host. In case of integrity failure and when the backup integrity check passes, "LAST CONFIGURATION NOT SAVED" message is displayed. When backup integrity also fails, “BOOTUP OPTIONS CHECKSUM FAILED" is displayed before displaying the bootup options.
Hyper Terminal Configuration RS9116W uses the following UART interface configuration for communication: Baud Rate: The following baud rates are supported by the module: 9600 bps, 19200 bps, 38400 bps, 57600 bps,
115200 bps, 230400 bps, 460800 bps, 921600 bps.
Data bits: 8 Parity: None Stop bits: 1 Flow control: None
RS9116W BLE AT Command Programming Reference Manual
Version 2.1
silabs.com | Building a more connected world. 8 | Page
Before the module is powered up, follow sequence of steps as given below:
• Open HyperTerminal and enter any name in the "Name" field. After this, click "OK" button. Here,
"WiSeConnect" is entered as shown below:
Note:
Default baud rate of the module is 115200.
Figure 3: HyperTerminal Name field Configuration
• After clicking "OK", the following dialog box is displayed as shown in the figure below.
Figure 4: HyperTerminal COM Port Field Configuration
In the "Connect using" field, select appropriate com port. In the figure above COM3 is selected. Click "OK" button.
• After clicking "OK" button the following dialog box is displayed as shown in the figure below.
RS9116W BLE AT Command Programming Reference Manual
Version 2.1
silabs.com | Building a more connected world. 9 | Page
Figure 5: HyperTerminal Baud Rate Field Configuration
Set the following values for different fields in figure 2-3 as given below.
• Set baud rate to 115200 in "Bits per second" field.
• Set Data bits to 8 in "Data bits" field.
• Set Parity to none in "Parity" field.
• Set stop bits to 1 in "Stop bits" field.
• Set flow control to none in "Flow control" field.
• Click "OK" button after entering the data in all the fields.
Auto Baud Rate Detection (ABRD) The RS9116 automatically detects the baud rate of the Host's UART interface by exchanging some bytes. The Host
should configure the UART interface for the following parameters for ABRD detection. RS9116 uses the following UART interface configuration for communication:
Baud Rate: The following baud rates are supported: 9600 bps, 19200 bps, 38400 bps, 57600 bps, 115200 bps, 230400 bps, 460800 bps, 921600 bps.
Data bits: 8 Stop bits: 1 Parity: None Flow control: None
To perform ABRD on the RS9116W, the host must follow the procedure outlined below.
1. Configure the UART interface of the Host at the desired baud rate.
2. Power on the board.
3. The Host, after releasing the module from reset, should wait for 20 ms for initial boot-up of the module to complete
and then transmit 0x1C at the baud rate with which its UART interface is configured. After transmitting '0x1C' to the module, the Host should wait for the module to transmit 0x55 at the same baud rate.
4. If the '0x55' response is not received from the module, the host has to re-transmit 0x1C, after a delay of 200ms.
5. After finally receiving '0x55', the host should transmit '0x55' to the module. The module is now configured with the
intended baud rate.
Note: Performing ABRD in host interaction mode is must for USB CDC mode.
RS9116W BLE AT Command Programming Reference Manual
Version 2.1
silabs.com | Building a more connected world. 10 | Page
Figure 6: ABRD Exchange Between Host and Module
Below are the bootup options, firmware upgrade and firmware loading procedures for the product. Start up messages on power-up After powering up the module and performing ABRD you will see a welcome message on host, followed by boot up
options:
Note: Windows HyperTerminal is used to demonstrate boot up / upgrade procedure.
Figure 7: UART / USB-CDC Welcome Message
Loading the default wireless firmware in the module
To load the default firmware flashed onto the module, choose Option 1: "Load Default Wireless Firmware ". Load Default Wireless Firmware
• After welcome message is displayed as shown in the above figure, select option 1 "Load Default Wireless
Firmware " for loading image.
RS9116W BLE AT Command Programming Reference Manual
Version 2.1
silabs.com | Building a more connected world. 11 | Page
Figure 8: UART / USB-CDC Default Firmware Loaded
To load the selected firmware (from flash) onto the module, choose Option A: "Load Wireless Firmware (Image No: 0­f)".
Load Wireless Firmware
• After welcome message is displayed as shown in the above figure, select option A "Load Wireless Firmware
(Image No: 0-f)" for loading Image.
• In response to the option A, Module asks to enter image number.
• Select the image number to be loaded from flash.
• After successfully loading the default firmware, "Loading Done" message is displayed.
• After firmware loading is completed, module is ready to accept commands.
Note:
1. To use host bypass mode user has to select one of the images as default image by selecting options 5 (Select Default Wireless Firmware).
2. In Host interaction mode if there is no option selected after bootup menu for 20 seconds then bootloader will load selected Wireless default image.
3. If valid firmware is not present, then a message prompting "Valid firmware not present" will be displayed.
Firmware Upgradation After powering up the module, a welcome message is displayed.
Upgrade NWP firmware Image
• After the welcome message is displayed, select option B “Burn Wireless Firmware (Image No: 0-f)" to upgrade Wireless Image.
• The message "Enter Wireless Image No (0-f)"
• Then select the Image no to be upgraded.
• The message "Send RSXXXXX.NBZ.WC.GENR.x.x.x.rps" should appear as shown in the figure below.
RS9116W BLE AT Command Programming Reference Manual
Version 2.1
silabs.com | Building a more connected world. 12 | Page
Figure 9: Firmware Upgrade File Prompt Message
• In the "File" menu of HyperTerminal, select the "send file" option. A dialog box will appear as shown in the figure below. Browse to the path where "RS9116.NBZ.WC.GENR.X.X.X.rps" is located and select Kermit as the protocol option. After this, click the "Send" button to transfer the file.
Figure 10: Firmware Upgrade File Selection Message
• The dialog box message is displayed while file transfer is in progress as shown in the figure below:
RS9116W BLE AT Command Programming Reference Manual
Version 2.1
silabs.com | Building a more connected world. 13 | Page
Figure 11: Firmware Upgrade File Transfer Message
• After successfully completing the file transfer, module computes the integrity of the image and displays "Upgradation Failed, re-burn the image" in the case of failure. Module displays "Upgradation Failed and default image invalid, Bypass disabled" in the case of both failure and corruption of the default image.
• In the case of success, module checks if bootloader bypass is enabled and computes the integrity of the default image selected. If the integrity fails, it sends "Upgradation successful, Default image invalid, gpio bypass disabled". If integrity passes or gpio bypass is not enabled, it sends "Upgradation Successful" message on terminal as shown in the figure below.
Figure 12: Firmware Upgrade Completion Message
• At this point, the upgraded firmware image is successfully flashed to the module.
• User can again cross check the integrity of the Image by selecting the Option K " Check Wireless Firmware
Integrity (Image No: 0-f)" for Wireless Image.
• Follow the steps mentioned in the section Loading the Default Wireless Firmware in the Module to load the firmware from flash, select Option 1 from the above shown figure.
RS9116W BLE AT Command Programming Reference Manual
Version 2.1
silabs.com | Building a more connected world. 14 | Page
• The module is ready to accept commands from the Host.
Bypass Mode in UART / USB-CDC Making Default Wireless Firmware Selection
With this option host can select the default firmware image to be loaded. Selecting a valid image as the default image
• After the welcome message is displayed, host can select option 5, “Select Default Wireless Firmware (Image No: 0-f)".
• The message "Enter Wireless Image No (0-f)"
• Then select the image no.
• It is better to check the integrity of image before selecting it as default image.
• When default image is selected, module checks for the validity of the image selected and displays "Configuration
saved".
Figure 13: Making Image no - 0 as Default Image
Enable/Disable GPIO Based Bypass Option
This option is for enabling or disabling the GPIO bootloader bypass mode. Enabling the GPIO Based Bypass Mode
• If you select option 7, GPIO based Bootloader bypass gets enabled.
• When this option is selected, module checks for the validity of the image selected and displays "Configuration
saved" if valid.
• If valid default image is not present, then a message saying "Default image invalid" will be displayed.
• Once enabled, from next bootup, Bootloader will latch the value of LP_WAKEUP. If asserted, it will bypass the
whole boot loading process and will load the default firmware image selected.
• After the welcome message is displayed, select option 5, “Select Default Wireless Firmware (Image No : 0-f)".
• The window will display "Enter Wireless Image No. (0-f)".
• Select the required image no.
• It is better to check the integrity of image before selecting it as default Image.
• When default image is selected, the module checks for the validity of the image selected and displays
"Configuration saved".
RS9116W BLE AT Command Programming Reference Manual
Version 2.1
silabs.com | Building a more connected world. 15 | Page
• After this, select option 7 "Enable GPIO Based Bypass Mode".
• The module responds to select the host interface in Bypass mode ( 0 - UART , 1 - SDIO , 2 - SPI , 4 - USB , 5 -
USB-CDC).
• Select the required interface.
If the default image is valid, then it enables GPIO Bypass mode, otherwise it will not enable the GPIO Bypass mode.
Figure 14: Enabling the GPIO-based Bypass Mode; Valid Default Firmware
RS9116W BLE AT Command Programming Reference Manual
Version 2.1
silabs.com | Building a more connected world. 16 | Page
Figure 15: Enabling the GPIO-based Bypass Mode; Invalid Firmware
Disabling the GPIO Based Bypass Mode
• If host selects option 8, GPIO based bypass gets disabled.
Note: GPIO-15 needs to be de-asserted on power up to move to host interaction mode, to select bootup options like disable Bypass mode or to change default image.
Check Integrity of the Selected Image This option enables user to check whether the given image is valid or not. When this command is given, bootloader
asks for the image for which integrity has to be verified as shown in figure below.
Figure 16: Integrity Check Passed
RS9116W BLE AT Command Programming Reference Manual
Version 2.1
silabs.com | Building a more connected world. 17 | Page
Other Operations This section contains additional, less frequently used bootloader options.
Update KEY
Note:
This feature is not enabled in current release.
JTAG Selection
Note: This feature is not enabled in current release.
RS9116W BLE AT Command Programming Reference Manual
Version 2.1
silabs.com | Building a more connected world. 18 | Page
3 Host Interfaces
RS9116 WiSeConnect Module supports SPI, USB, UART and SDIO for interfacing to host. This section describes UART interface in detail including the supported features, protocols and commands.
Only UART and USB-CDC interfaces are supported in AT mode.
Note: USB and SDIO interfaces are currently not supported.
3.1 UART Interface
This section describes RS9116-WiSeConnect UART interface, including the commands and processes to operate the module via UART.
UART on the RS9116-WiSeConnect is used as a host interface to configure the module to send and receive data. Features
• Supports hardware (RTS/CTS) flow control.
• Supports following list of baud rates,
o 9600 bps o 19200 bps o 38400 bps o 57600 bps o 115200 bps o 230400 bps o 460800 bps o 921600 bps
Note:
For baud rates greater than 115200, it is mandatory to enable UART hardware flow control.
Hardware Interface RS9916W uses TTL serial UART at an operating voltage of 3.3V.
Host UART device must be configured with the following settings:
• Data bits - 8
• Stop bits - 1
• Parity - None
• Flow control - None
Software Protocol AT+ command mode
This section explains the procedure that the host needs to follow in order to send Wi-Fi commands frames to the module and to receive responses from the module in AT+ command mode.
TX Operation The Host uses TX operations:
1. To send management commands to the module from the Host.
RS9116W BLE AT Command Programming Reference Manual
Version 2.1
silabs.com | Building a more connected world. 19 | Page
2. To send actual data to the module which is to be transmitted onto the air.
3. If the host receives error code indicating packet dropped, the host has to wait for a while and send the next command /data.
4. The host should send next data packet only if it receives "OK<number of bytes sent>" response for the previous one.
Rx Operation The RS9116W responds with either an 'OK' or 'ERROR' string, for Management or Data frames along with a result or
error code. The module sends the response/received data to Host in a format as shown below:
Figure 17: RX Frame Format
Note:
If Payload offset is 'x', 'x-4' dummy bytes will be added before Frame Descriptor.
The host should follow the steps below to read the frame from the Module: Read 4 bytes using Frame read.
1. Decode Total payload length and payload offset.
2. Read remaining payload by sending Frame to read with (total payload length – 4 bytes), discard Dummy bytes and then decode Frame descriptor and Frame Body.
RS9116W BLE AT Command Programming Reference Manual
Version 2.1
silabs.com | Building a more connected world. 20 | Page
4 Command Mode Selection
This section describes AT command mode or Binary mode selection in UART and USB-CDC. After bootloader interaction, the module issues "Loading Done" string in ASCII format to host. After receiving "Loading
Done", based on first command received from the host, the module selects command mode. The module reads first 4 bytes, if it matches with "AT+R", it configures AT command mode otherwise Binary mode is
configured. Once mode is configured, it will remain in same mode until next reset or power cycle. There is an option in bootloader to select AT mode or binary mode.
Note: "AT+R" is not case sensitive.
RS9116W BLE AT Command Programming Reference Manual
Version 2.1
silabs.com | Building a more connected world. 21 | Page
5 Command Format
• This section explains the general command format, commands should be sent to the module in the specified format.
• Format is same for both Classic and LE modes.
• Commands are sent to the module and responses are read from the module using frame write/frame read (as
mentioned in the preceding sections), these commands are called as command frames.
• The format of the command frames is divided into two parts:
a. Frame descriptor b. Frame Body (Frame body is often called as Payload)
Frame Descriptor (16 bytes)
Frame Body (multiples of 4 bytes)
Command frame format is shown below. This description is for a Little-Endian System.
Figure 18: Command Frame Format
The following table provides the general description of the frame descriptor.
Table 1: Frame Descriptor
Word
Frame Descriptor
Word0
W0[15:0]
Bits [11:0] – Length of the frame
Bits [15:12] – 2(indicates Bluetooth packet).
Word1
W1[15:0]
Bits [15:0] – Packet type
Word2
W2[15:0]
Reserved
Word3
W3[15:0]
Reserved
Word4
W4[15:0]
Reserved
RS9116W BLE AT Command Programming Reference Manual
Version 2.1
silabs.com | Building a more connected world. 22 | Page
Word
Frame Descriptor
Word5
W5 [15:0]
Reserved
Word6
W6 [15:0]
1. (0x0000) when sent from host to module.
2. When sent from module to host (as response frame), it contains the status.
Word7
W7 [15:0]
Reserved
Three types of frames will get exchanged between the module and the host.
1. Request/Command frames - These are sent from Host to Module. Each Request/ Command has an associated response with it.
2. Response frames – These are sent from Module to Host. These are given in response to the previous Request/Command from the Host. Each command has a single response.
3. Event frames – These are sent from Module to Host. These are given when there are multiple responses for a Request/ Command frame. There is Asynchronous message to be sent to host.
The following are the types of frame requests and responses and the corresponding codes. The commands are different for both Classic and LE modes. The below Table lists the Command, Response and Event frames in LE mode. In both the modes, the corresponding code is to be filled in W1 [15:0] mentioned in the Table above.
Table 2: Types of Frame Requests and Responses and the Corresponding Codes
Command
Command ID
Set Local Name
0x0001
Get Local Name
0x0002
Get RSSI
0x0005
Get Local BD Address
0x0007
Advertise
0x0075
Scan
0x0076
Connect
0x0077
Disconnect
0x0078
Query Device State
0x0079
Connection parameter update
0x007A
Start Encryption
0x007B
SMP Pair Request
0x007C
SMP Response
0x007D
SMP Passkey
0x007E
Query Profiles list
0x007F
Query Profile
0x0080
Query Characteristic Services
0x0081
Query Include Services
0x0082
Read Characteristic Value by UUID
0x0083
RS9116W BLE AT Command Programming Reference Manual
Version 2.1
silabs.com | Building a more connected world. 23 | Page
Command
Command ID
Query Attribute Descriptor
0x0084
Query Attribute Value
0x0085
Query Multiple Attribute Values
0x0086
Query Long Attribute Values
0x0087
Set Attribute Value
0x0088
Set Attribute Value No Ack
0x0089
Set Long Attribute Value
0x008A
Set Prepare Long Attribute Value
0x008B
Execute Long Attribute Value Write
0x008C
Initialize BLE module
0x008D
De-initialize BLE module
0x008E
Antenna Select
0x008F
Add New Service
0x0092
Add New Attribute
0x0093
Set local attribute value
0x0094
Get local attribute value
0x0095
Notify request
0x0096
Set advertise data
0x009C
Get LE ping timeout
0x00A1
Set LE ping timeout
0x00A2
Set Random Address
0x00A3
Data Encrypt
0x00A4
GATT Read
0x00A5
Scan Response
0X00A8
White List
0X00AA
Remove Service
0X00AB
Remove Attribute
0X00AC
Resolvlist
0X00AD
Get Resolvlist Size
0X00AE
Set Resolution Enable
0X00AF
Read Phy
0X00B0
Set Phy
0X00B1
Set Data Length
0x00B2
Read Data Length
0x00B3
Set Privacy Mode
0x00B4
RS9116W BLE AT Command Programming Reference Manual
Version 2.1
silabs.com | Building a more connected world. 24 | Page
Command
Command ID
CBFC Connection Request
0x00B5
CBFC Connection Response
0x00B6
CBFC Tx Data
0x00B7
CBFC Disconnect
0x00B8
LE LTK Request Reply
0x00BA
Rx Test Mode
0x00BB
Tx Test Mode
0x00BC
End Test Mode
0x00BD
Vendor Specific
0x00BE
PER Tx Mode
0x00BF
PER Rx Mode
0x00C0
Profiles Async Request
0x00F2
Profile Async Request
0x00F3
Get char services Async
0x00F4
Get Include services Aync
0x00F5
Read char value by UUID Async
0x00F6
Get attribute Async
0x00F7
Get Descriptor value async
0x00F8
Get multiple values Async
0x00F9
Get Long desc values Async
0x00FA
Set desc value Async
0x00FB
Set prepare write Async
0x00FC
Execute Long desc write Async
0x00FD
Table 3: Response IDs in BLE Mode
Response
Response ID
Card Ready
0x0505
Set Local Name
0x0001
Get Local Name
0x0002
Get RSSI
0x0005
Get Local BD Address
0x0007
Advertise
0x0075
Scan
0x0076
Connect
0x0077
Disconnect
0x0078
RS9116W BLE AT Command Programming Reference Manual
Version 2.1
silabs.com | Building a more connected world. 25 | Page
Response
Response ID
Query Device State
0x0079
Connection parameter update
0x007A
Start Encryption
0x007B
SMP Pair Request
0x007C
SMP Response
0x007D
SMP Passkey
0x007E
Query Profiles list
0x007F
Query Profile
0x0080
Query Characteristic Services
0x0081
Query Include Services
0x0082
Read Characteristic Value by UUID
0x0083
Query Attribute Descriptor
0x0084
Query Attribute Value
0x0085
Query Multiple Attribute Values
0x0086
Query Long Attribute Values
0x0087
Set Attribute Value
0x0088
Set Attribute Value No Ack
0x0089
Set Long Attribute Value
0x008A
Set Prepare Long Attribute Value
0x008B
Execute Long Attribute Value Write
0x008C
Initialize BLE module
0x008D
Deinitialize BLE module
0x008E
Antenna Select
0x008F
Add New Service
0x0092
Add New Attribute
0x0093
Set local attribute value
0x0094
Get local attribute value
0x0095
Notify Response
0x0096
Indicate value
0x0097
Set advertise data
0x009C
Get le ping timeout
0x00A1
Set le ping timeout
0x00A2
Set Random Address
0x00A3
Data Encrypt
0x00A4
GATT Read
0x00A5
RS9116W BLE AT Command Programming Reference Manual
Version 2.1
silabs.com | Building a more connected world. 26 | Page
Response
Response ID
Scan Response
0X00A8
White List
0X00AA
Remove Service
0X00AB
Remove Attribute
0X00AC
Resolvlist
0X00AD
Get Resolvlist Size
0X00AE
Set Resolution Enable
0X00AF
Read Phy
0X00B0
Set Phy
0X00B1
Set Data Length
0x00B2
Read Data Length
0x00B3
Set Privacy Mode
0x00B4
CBFC Connect Request
0x00B5
CBFC Connect Response
0x00B6
CBFC Tx Data
0x00B7
CBFC Disconnect
0x00B8
LE LTK Request Reply
0x00BA
Rx Test Mode
0x00BB
Tx Test Mode
0x00BC
End Test Mode
0x00BD
Vendor Specific
0x00BE
PER Tx Mode
0x00BF
PER Rx Mode
0x00C0
Profiles Async Request
0x00F2
Profile Async Request
0x00F3
Get char services Async
0x00F4
Get Include services Aync
0x00F5
Read char value by UUID Async
0x00F6
Get attribute Async
0x00F7
Get Descriptor value async
0x00F8
Get multiple values Async
0x00F9
Get Long desc values Async
0x00FA
Set desc value Async
0x00FB
Set prepare write Async
0x00FC
Execute Long desc write Async
0x00FD
RS9116W BLE AT Command Programming Reference Manual
Version 2.1
silabs.com | Building a more connected world. 27 | Page
Table 4 Event IDs in BLE mode
Event
Event ID
Disconnected
0x1006
GATT Error Response
0x1500
GATT Desc Val Response
0x1501
GATT Primary Service by UUID
0x1502
GATT Read Char Services
0x1503
GATT Read Include Services
0x1504
GATT Read Val by UUID
0x1505
GATT Read Response
0x1506
GATT Read Blob Response
0x1507
GATT Read Multiple Response
0x1508
GATT Primary Service list
0x1509
GATT Write Response
0x150A
GATT Prepare Write Response
0x150B
GATT Execute Write Response
0x150C
Scan Response
0x150E
Connection Status
0x150F
SMP Request
0x1510
SMP Response
0x1511
SMP Passkey
0x1512
SMP Failed
0x1513
GATT Notification
0x1514
GATT Indication
0x1515
Encrypt Status
0x1516
GATT Write
0x1517
LE ping timeout expired
0x1518
Prepare Write
0x1519
Execute Write
0x151A
GATT Read
0x151B
MTU size
0x151C
SMP passkey display
0x151D
Phy Update Complete
0x151E
Data length change event
0x151F
SMP SC Passkey
0x1520
Enhanced Connection Event
0x1521
RS9116W BLE AT Command Programming Reference Manual
Version 2.1
silabs.com | Building a more connected world. 28 | Page
Event
Event ID
Directed Advertising Report
0x1522
Security Keys
0x1523
PSM Connection Request
0x1524
PSM Connection Complete
0x1525
PSM Rx Data
0x1526
PSM Disconnect
0x1527
LE LTK Request
0x152A
Connection Update Complete
0x152B
Remote Features
0x152C
BLE More Data Request
0x152D
Loading...
+ 64 hidden pages