Under construction.png Coming soon

1. STM32WB - BLE AT Server Overview

This application note describes the set of AT commands to control the STM32WB Series. AT commands are instructions used to control a modem. AT is the abbreviation of ATtention. For this concept, the Cortex®-M4 application microcontroller contains an AT project able to manage the concepts of GAP, GATT, Security and low-power. This document explains how to interface with the STM32WB Series microcontroller to manage multi BLE apps handling (such as AT P2P server, AT Heart Rate) and GAP/GATT custom applications using AT instructions.

The BLE_AT_Server application is available by downloading STM32CubeWB[1] release

This project implements a set of AT commands used to build GAP/GATT custom server or client, peripheral or central application. It also implements P2P Server or Heart Rate applications that could be directly selected. The objective is to have an intermediate abstraction layer in order to allow a user to develop a basic application with a limited sets of commands to send.

The following sections contain the interface description, the AT commands definition, and the description of some use cases.


1.1. AT commands

The AT instruction set is a standard developed by Hayes to control modems. The command set consists in a series of short text strings for performing operations: • at GAP level such as advertising, discovery, connection, security. • at GATT level such as services and characteristics management and discovery, and operation on characteristics.

The AT instructions are transfered through Cortex®-M4 application microcontroller low-power UART (LPUART) without flow control. The STM32WB Series microcontroller can be controlled either through a terminal emulator such as Tera Term or Termite, or through an embedded microcontroller AT client module.

Setup

The terminal emulator must be configured with the following parameters:

• Baud rate: 9600 
• Data: 8 bits 
• Parity: none 
• Stop: 1 bit 
• Flow control: none
• Each frame is delimited by a \n character
Setup

AT command is composed of SET and QUERY operations. A single operation can be executed at a time.

The format of these operations is defined as follow: • Set operation (a,b input parameters) • AT+CMD=a,b • OK • Query operation (a,b return parameters) • AT+CMD? • +CMD:a,b • OK

An event can be sent asynchronously by the server with following format:

• Events (a,b event parameters) • <EVT=a,b

1.2. General commands

List of commands: initialization commands

Initialization commands

1.3. Initialization - reset - BLE_RST

SET: 1

QUERY: No query for this command, it will return an error.

Example: AT+BLE_RST=1 OK

1.4. Initialization - public address - BLE_PUB_ADDR

SET: <address>

public_addr: • 6 bytes address

QUERY: < public_addr >

Example: AT+BLE_PUB_ADDR=0x112233445566 OK AT+BLE_PUB_ADDR? + BLE_PUB_ADDR: 0x112233445566 OK

1.5. Initialization – use of default random address – BLE_CFG_RAND_ADDR

SET: 1

QUERY: < default_rand_addr >

Example: AT+BLE_CFG_RAND_ADDR=1 OK AT+BLE_RAND_ADDR? +BLE_ RAND_ADDR: 0x000000000000 AT+BLE_INIT=1 AT+BLE_RAND_ADDR? +BLE_RAND_ADDR: 0xC122aabbccdd (if CFG_STATIC_RANDOM_ADDRESS is defined in app_conf.h) OK AT+BLE_INIT? +BLE_INIT:0xC122aabbccdd,AT server,-0.15

1.6. Initialization – random address – BLE_RAND_ADDR

SET: <address>

random_addr: • 6 bytes address

QUERY: < random_addr >

Example: AT+BLE_RAND_ADDR=0xFF11223344CC OK AT+BLE_RAND_ADDR? + BLE_RAND_ADDR: 0xFF11223344CC OK

1.7. Initialization – name – BLE_NAME

SET: <name>

Name: • String of characters (8 characters max)

QUERY: <name> (default name if no new name set)

Example: AT+BLE_NAME=WB_ATCMD OK

1.8. Initialization – Tx power – BLE_RF_POWER

SET: <txpower>

txpower: From -40 dBm to 6 dBm (IC level)



QUERY: <txpower>

Example:

AT+BLE_RF_POWER=1
OK
AT+BLE_RF_POWER?
+ BLE_RF_POWER:1
OK

1.9. Initialization – BLE_INIT

BLE_INIT to be used in case of custom application. If AT+BLE_INIT=1 is the first sent command, initialization of the following parameters is done: Public address, random address, device name, RF Tx power, security parameters. The default values applied in this case are: Public address: based on the company ID, the device ID and the Unique Device Number (UDN)

bit[47:24] : 24bits (OUI) equal to the company ID
bit[23:16] : Device ID.
bit[15:0] : The last 16bits from the UDN

Random address: based on the UDN and a defined value (0x0000ED6E) to fit the requirements of a random address. Device name: AT SERVER RF Tx power: -0.15 dBm IO Capability: IO_CAP_KEYBOARD_DISPLAY (4) Authentication requirements: no bonding mode (0), MITM (1), SC support supported but optional (1), no use of fixed pin (1), fixed pin (111111), public address (0)

If the public address, the random address, the name or the tx output power needs to be changed, send associated AT commands, BLE_PUB_ADDR, BLE_RAND_ADDR, BLE_NAME, BLE_RF_POWER before BLE_INIT.

If IO capability, authentication requirements parameters need to be changed, send BLE_IO_CAPA, BLE_SET_AUTHEN_REQ before or after BLE_INIT out of any link establishment.


SET: 1 Use default BD address, default name, default Tx Power if no new parameter has been defined. Default initialization in case security (pairing) is started after link establishment:

These values could be changed when no link is established with BLE_IO_CAPA and BLE_SET_AUTHEN_REQ (commands described later)

If BLE_PUB_ADDR, BLE_RAND_ADDR, BLE_NAME or BLE_RF_POWER have been sent previously, the new parameters are taken into account.

QUERY: <public_addr>, <random_addr>, <name>, <txpower> public_addr: • Default PUB_BD_addr or new PUB_BD_addr if BLE_PUB_ADDR has been sent random_addr: • Default RAND_BD_addr or new RAND_BD_addr if BLE_RAND_ADDR has been sent

name: • Default name or new name if BLE_NAME has been sent txpower: • Default txpower or new txpower if BLE_RF_POWER has been sent

Example: AT+BLE_PUB_ADDR=0x112233332211 OK AT+BLE_INIT=1 OK AT+BLE_INIT? + BLE_INIT:0x112233332211, default_name, 0 OK

1.10. Initialization – IO capability - BLE_IO_CAPA

SET: <io_capability>

io_capability:
0: IO_CAP_DISPLAY_ONLY
1: IO_CAP_DISPLAY_YES_NO
2: IO_CAP_KEYBOARD_ONLY
3: IO_CAP_NO_INPUT_NO_OUTPUT
4: IO_CAP_KEYBOARD_DISPLAY

QUERY: <io_capability>

Example: AT+BLE_IO_CAPA=1 OK AT+BLE_IO_CAPA? +BLE_IO_CAPA:1 OK

1.11. References