BLE AT Commands#

This section describes the AT commands for Bluetooth Low Energy (BLE) functionality on the SiWx91x device.

Commands#

91x-ble-scan-conf#

Configure BLE scanning parameters for the SiWx91x device.

Command Format#

at+91x-ble-scan-conf=<status>,<scan-type>,<enable-acceptlist>,<own-addr-type>,<scan-interval>,<scan-window>

Related SDK API#

rsi_ble_req_scan_s

Pre-conditions#

net-init

Parameters#

status#

Scanning status. Set to 0 to disable scanning or 1 to enable scanning.

scan-type#

Set to 0 for passive scanning or 1 for active scanning.

enable-acceptlist#

Set to 0 to disable acceptlist filtering of advertising reports (default) or 1 to enable acceptlist filtering.

own-addr-type#

Address type of the local device. Set to 0 for public address, 1 for random address, 2 for resolvable public address, or 3 for resolvable random address.

scan-interval#

Time interval from when the Controller started its last LE scan until it begins the subsequent LE scan. Range: 0x0004 to 0x4000.

scan-window#

Duration of the LE scan. Range: 0x0004 to 0x4000. Should be less than or equal to scan-interval.

Response#

  • OK on success

  • ERROR 1 in case of failure

  • ERROR 21 when parameters are missing or invalid

Notes#

Examples#

at+91x-ble-scan-conf=1,1,0,0,100,50        # Enable active scanning with public address, 100ms interval, 50ms window
OK

91x-ble-scan-conf?#

Query the current BLE scanning configuration parameters.

Command Format#

at+91x-ble-scan-conf?

Related SDK API#

rsi_ble_req_scan_s

Pre-conditions#

91x-ble-scan-conf

Parameters#

None

Response#

  • OK <status> <scan-type> <enable-acceptlist> <own-addr-type> <scan-interval> <scan-window> on success, where:

    • <status> is the current scanning status (0 = disabled, 1 = enabled)

    • <scan-type> is the current scan type (0 = passive, 1 = active)

    • <enable-acceptlist> is the current acceptlist filtering status (0 = disabled, 1 = enabled)

    • <own-addr-type> is the current local address type (0 = public, 1 = random, 2 = resolvable public, 3 = resolvable random)

    • <scan-interval> is the current scan interval value

    • <scan-window> is the current scan window value

  • ERROR 27 when 91x-ble-scan-conf was not previously sent

  • ERROR 1 in case of other failures

Notes#

This command returns the current values of all BLE scanning parameters that were previously configured using the 91x-ble-scan-conf command.

Examples#

at+91x-ble-scan-conf?        # Query current BLE scan configuration
OK 1 1 0 0 100 50

91x-ble-add-acc#

Add a device to the BLE acceptlist of device addresses for filtering advertising reports.

Command Format#

at+91x-ble-add-acc=<dev-addr-type>,<dev-address>

Related SDK API#

rsi_ble_addto_acceptlist

Pre-conditions#

net-init

Parameters#

dev-addr-type#

Address type of the remote device. Set to 0 for public address or 1 for random address.

dev-address#

The device address to be added to the acceptlist, represented as a series of characters from a 6 byte device address string with a colon (:) separating each byte (see example below).

Response#

  • OK on success

  • ERROR <error-code> in case of failure. Possible error codes are the same as those returned by rsi_ble_addto_acceptlist API.

Notes#

  • You can use this command to add multiple acceptlist entries, each for a unique device identified by its address.

  • This command has no impact on the acceptlist filters maintained by the 91x-ble-add-acc-type and 91x-ble-del-acc-type commands.

Examples#

at+91x-ble-add-acc=0,00:11:22:33:44:55        # Add device with public address to acceptlist
OK

91x-ble-del-acc#

Remove a device from the BLE acceptlist of device addresses.

Command Format#

at+91x-ble-del-acc=<dev-addr-type>,<dev-address>

Related SDK API#

rsi_ble_deletefrom_acceptlist

Pre-conditions#

91x-ble-add-acc

Parameters#

dev-addr-type#

Address type of the remote device. Set to 0 for public address or 1 for random address.

dev-address#

The device address to be removed from the acceptlist, represented as a series of characters from a 6 byte device address string with a colon (:) separating each byte (see example below).

Response#

Notes#

Examples#

at+91x-ble-del-acc=0,00:11:22:33:44:55        # Remove device with public address from acceptlist
OK

91x-ble-clear-acc#

Remove all devices from the BLE acceptlist of device addresses.

Command Format#

at+91x-ble-clear-acc

Related SDK API#

rsi_ble_clear_acceptlist

Pre-conditions#

net-init

Parameters#

None

Response#

  • OK on success

  • ERROR <error-code> in case of failure. Possible error codes are the same as those returned by rsi_ble_clear_acceptlist API.

Notes#

Examples#

at+91x-ble-clear-acc        # Clear all devices from acceptlist
OK

91x-ble-add-acc-type#

Enable an acceptlist filter based on advertising data type and value.

Command Format#

at+91x-ble-add-acc-type=<ad-type>,<value-length>

Related SDK API#

rsi_ble_acceptlist_on_type

Pre-conditions#

net-init

Parameters#

ad-type#

Advertising data type to filter. Currently only supports:

  • 8 - Shortened Local Name

  • 9 - Complete Local Name

value-length#

Length of the value to compare in bytes.

Response#

  • ERROR 1 on failing to enter data mode

  • OK on successfully entering data mode

    • On receiving this response, you must transmit value-length number of characters.

    • As soon as the specified number of characters is transmitted, the rsi_ble_acceptlist_on_type API is invoked and one of the following responses is returned:

      • OK on success

      • ERROR <error-code> in case of failure. Possible error codes are the same as those returned by the rsi_ble_acceptlist_on_type API.

Notes#

  • The enable parameter of the rsi_ble_acceptlist_on_type API is set to 1 (enabled).

  • This API currently supports filtering only on the device name advertising data types (8 and 9).

  • This command only allows one acceptlist filter for each ad-type value.

  • This command has no impact on the device address based acceptlist maintained by the 91x-ble-add-acc, 91x-ble-del-acc, and 91x-ble-clear-acc commands.

Examples#

at+91x-ble-add-acc-type=9,10        # Set acceptlist filter for Complete Local Name with 10-byte value
OK
# Transmit 10 characters of value data
OK

91x-ble-del-acc-type#

Disable an acceptlist filter based on advertising data type and value.

Command Format#

at+91x-ble-del-acc-type=<ad-type>

Related SDK API#

rsi_ble_acceptlist_on_type

Pre-conditions#

net-init

Parameters#

ad-type#

Advertising data type to filter. Currently only supports:

  • 8 - Shortened Local Name

  • 9 - Complete Local Name

Response#

  • OK on success

  • ERROR <error-code> in case of failure. Possible error codes are the same as those returned by the rsi_ble_acceptlist_on_type API.

Notes#

Examples#

at+91x-ble-del-acc-type=9        # Disable acceptlist filter for Complete Local Name
OK

91x-ble-scan-start#

Start BLE scanning on the SiWx91x device.

Command Format#

at+91x-ble-scan-start

Related SDK API#

rsi_ble_start_scanning_with_values or rsi_ble_start_scanning

Pre-conditions#

net-init

Parameters#

None

Response#

Notes#

Examples#

at+91x-ble-scan-start        # Start BLE scanning
OK

91x-ble-scan-stop#

Stop BLE scanning on the SiWx91x device.

Command Format#

at+91x-ble-scan-stop

Related SDK API#

rsi_ble_stop_scanning

Pre-conditions#

91x-ble-scan-start

Parameters#

None

Response#

  • OK on success

  • ERROR <error-code> in case of failure. Possible error codes are the same as those returned by the rsi_ble_stop_scanning API.

Examples#

at+91x-ble-scan-stop        # Stop BLE scanning
OK

91x-ble-adv-conf#

Configure BLE advertising parameters for the SiWx91x device.

Command Format#

at+91x-ble-adv-conf=<status>,<adv-type>,<filter-type>,<direct-addr-type>,<direct-addr>,<adv-int-min>,<adv-int-max>,<own-addr-type>,<adv-channel-map>

Related SDK API#

rsi_ble_req_adv_s

Pre-conditions#

net-init

Parameters#

status#

Advertising status. Set to 0 to disable advertising or 1 to enable advertising.

adv-type#

Advertising type used during advertising with the following possible values:

  • 0x80: Undirected connectable advertising

  • 0x81: Directed connectable advertising

  • 0x82: Undirected scannable advertising

  • 0x83: Undirected non-connectable advertising

  • 0x84: Directed connectable advertising with low duty cycle

filter-type#

Advertising filter type with the following possible values:

  • 0: Allow scan requests from any device and connection requests from any device

  • 1: Allow scan requests from acceptlist and connection requests from any device

  • 2: Allow scan requests from any device and connection requests from acceptlist

  • 3: Allow scan requests from acceptlist and connection requests from acceptlist

direct-addr-type#

The address type of the device to which directed advertising is performed. This parameter has the following possible values:

  • 0: Public address

  • 1: Random address

  • 2: Resolvable public address

  • 3: Resolvable random address

direct-addr#

The address type of the device to which directed advertising is performed, represented as a series of characters from a 6 byte device address string with a colon (:) separating each byte.

adv-int-min#

Advertising interval minimum. Range: 0x0020 to 0x4000.

adv-int-max#

Advertising interval maximum. Range: 0x0020 to 0x4000.

own-addr-type#

Address type of the local device. This parameter has the following possible values:

  • 0: Public address

  • 1: Random address

  • 2: Resolvable public address

  • 3: Resolvable random address

adv-channel-map#

Advertising channel map with the following possible values:

  • 1: Channel 37 only

  • 3: Channels 37 and 38

  • 7: All channels (37, 38, and 39)

Response#

  • OK on success

  • ERROR 1 in case of failure

  • ERROR 21 when parameters are missing or invalid

Notes#

Examples#

at+91x-ble-adv-conf=1,0x80,0x00,0,00:00:00:00:00:00,0x0020,0x0020,0,0x07        # Enable undirected connectable advertising with default parameters
OK

91x-ble-adv-conf?#

Query the current BLE advertising configuration parameters.

Command Format#

at+91x-ble-adv-conf?

Related SDK API#

rsi_ble_req_adv_s

Pre-conditions#

91x-ble-adv-conf

Parameters#

None

Response#

  • OK <status> <adv-type> <filter-type> <direct-addr-type> <direct-addr> <adv-int-min> <adv-int-max> <own-addr-type> <adv-channel-map> on success, where:

    • <status> is the current advertising status (0 = disabled, 1 = enabled)

    • <adv-type> is the current advertising type (0x80-0x84)

    • <filter-type> is the current filter type (0-3)

    • <direct-addr-type> is the current direct address type (0-3)

    • <direct-addr> is the current direct address

    • <adv-int-min> is the current minimum advertising interval

    • <adv-int-max> is the current maximum advertising interval

    • <own-addr-type> is the current local address type (0-3)

    • <adv-channel-map> is the current advertising channel map (1, 3, or 7)

  • ERROR 27 when 91x-ble-adv-conf was not previously sent

  • ERROR 1 in case of other failures

Notes#

This command returns the current values of all BLE advertising parameters that were previously configured using the 91x-ble-adv-conf command.

Examples#

at+91x-ble-adv-conf?        # Query current BLE advertising configuration
OK 1 0x80 0 0 00:00:00:00:00:00 0x0020 0x0020 0 7

91x-ble-adv-data#

Set BLE advertising data for the SiWx91x device.

Command Format#

at+91x-ble-adv-data=<data-len>

Related SDK API#

rsi_ble_set_advertise_data

Pre-conditions#

net-init

Parameters#

data-len#

Length of the advertising data in bytes. Range: 0 to 31 bytes.

Response#

  • ERROR 1 on failing to enter data mode

  • OK on successfully entering data mode

    • On receiving this response, you must transmit data-len number of characters

    • As soon as the specified number of characters is transmitted, the rsi_ble_set_advertise_data API is invoked and one of the following responses is returned:

      • OK on success

      • ERROR <error-code> in case of failure. Possible error codes are the same as those returned by the rsi_ble_set_advertise_data API

Examples#

at+91x-ble-adv-data=6        # Set advertising data length to 6 bytes
OK                          # Successfully entered data mode
<transmit 6 characters>     # Transmit exactly 6 characters as the BLE advertising data
OK                          # BLE advertising data successfully updated

91x-ble-adv-data?#

Query the current BLE advertising data.

Command Format#

at+91x-ble-adv-data?

Related SDK API#

rsi_ble_set_advertise_data

Pre-conditions#

91x-ble-adv-data

Parameters#

None

Response#

  • OK <data-len> <data> on success, where:

    • <data-len> is the current advertising data length in bytes

    • <data> is the current advertising data

  • OK 0 when 91x-ble-adv-data was not previously sent

  • ERROR 1 in case of failure

Examples#

at+91x-ble-adv-data?        # Query current BLE advertising data
OK 6 0201061aff4c0002

at+91x-ble-adv-data?        # Query when no advertising data has been set
OK 0

91x-ble-adv-start#

Start BLE advertising on the SiWx91x device.

Command Format#

at+91x-ble-adv-start

Related SDK API#

rsi_ble_start_advertising_with_values or rsi_ble_start_advertising

Pre-conditions#

net-init

Parameters#

None

Response#

Notes#

Examples#

at+91x-ble-adv-start        # Start BLE advertising
OK

91x-ble-adv-stop#

Stop BLE advertising on the SiWx91x device.

Command Format#

at+91x-ble-adv-stop

Related SDK API#

rsi_ble_stop_advertising

Pre-conditions#

91x-ble-adv-start

Parameters#

None

Response#

  • OK on success

  • ERROR <error-code> in case of failure. Possible error codes are the same as those returned by the rsi_ble_stop_advertising API.

Examples#

at+91x-ble-adv-stop        # Stop BLE advertising
OK

Events#

This section describes the event messages sent by the SiWx91x device for BLE operations.

91X_BLE_ADV_REPORT#

Event sent by the SiWx91x device when a BLE advertising report is received during scanning.

Event Message Format#

at+91X_BLE_ADV_REPORT=<dev-addr-type>,<dev-addr>,<rssi>,<report-type>,<adv-data-len>,<adv-data>

Related SDK APIs#

Parameters#

dev-addr-type#

The type of the advertiser's address. Set to 0 for public address, 1 for random address, 2 for resolvable public address, or 3 for resolvable random address.

dev-addr#

The advertiser's address, represented as a series of characters from a 6 byte device address string with a colon (:) separating each byte.

rssi#

The received signal strength indicator (RSSI) value.

report-type#

The type of BLE advertising report. Set to 0 for connectable undirected advertising, 1 for connectable directed advertising, 2 for scannable undirected advertising, 3 for non-connectable undirected advertising, or 4 for scan response.

adv-data-len#

The length in bytes of the advertising data included with this event message.

adv-data#

The advertising data included with this event message. This event message is terminated by exactly adv-data-len characters following the comma after the adv-data-len parameter value.

Examples#

at+91X_BLE_ADV_REPORT=0,00:11:22:33:44:55,-45,0,23,0201061aff4c0002151234567890abcdef1234567890abcdef1234567890abcdef        # BLE advertising report event with public address, RSSI -45 dBm, report type 0, and 23-byte advertising data