STM32WB0 Bluetooth® LE – Serial Port Applications

1. Serial Port application

The Serial Port Application is a Generic Attribute Profile (GATT) based low-energy application defined by STMicroelectronics with proprietary UUIDs(128 bits).The Serial Port application can be used to demonstrate Point-to-Point communication using Bluetooth Low Energy GATT component. It is used to exchange data entered on the UART of each board.

The Serial Port Application defines the communication between a GATT-server of a STM32WB0 Serial Port Server device, and a GATT-client Collector device, such as a smartphone or STM32WB0 Serial Port Client device.


Serial Port applications are named BLE_SerialPort_Server and BLE_SerialPort_Client. One board is configured as a GAP central using BLE_SerialPort_Client application. The other board is configured as GAP peripheral using BLE_SerialPort_Server application.

Both applications require to open an HyperTerminal as follow:

  • Open VT100 terminals on client and server sides.
  • Connect to ST-LINK via the COM port @115200 bauds/s, 8 data bits, with no parity and 1 stop bit:
Bluetooth® Serial port configuration
STM32WBA SerialCom Profile


  • Configure the terminal with local echo settings:
Bluetooth® Terminal setup
STM32WBA SerialCom Profile


This wiki page is the description of the SerialPort Server and SerialPort Client projects provided within the STM32CubeWB0 MCU Package[1]

Bluetooth® LE SerialPort Profile & STM32WB0
Connectivity WB0 SerialPort topology.png


1.1. STM32WB0 Serial Port Server application

Serial Port Server exports a Service with the following two characteristics:

  • TX characteristic:
  • RX Characteristic:


The table below describes the structure of Serial Port service:

Bluetooth® LE Serial Port Service specification
Service Characteristic Mode UUID size
Serial Port Service D973F2E0-b19e-11e2-9e96-0800020c9a66
TX Notify D973F2E1-b19e-11e2-9e96-0800020c9a66 20
RX Write without Response D973F2E2-b19e-11e2-9e96-0800020c9a66 20

1.2. Advertising data

At startup, Serial Port Server application starts advertising.
Data advertised are composed as follows:

Serial Port Server Advertising packet
Description Length AD Type Value
Device Name 10 0x09 SPort_XX (XX: last byte of BD address)
Manufacturer Data 15 0xFF See table below
Flags 2 0x01 0x06
(GeneralDiscoverable, BrEdrNotSupported)


Manufacturer data are encoded following STMicroelectronics BlueST SDK v2 as described below:

STMicroelectronics Manufacturer Advertising data
Byte Index 0 1 2-3 4 5 6 7 8 9 10-15
Function Length Manufacturer ID Company BlueST SDK Version Device ID Firmware ID Option 1 Option 2 Option 3 Device Address
Value 0x0F 0xFF 0x0030 STMicro 0x02 0x8D Nucleo-WB0 0x8B- Serial Port Server 0x00 0x00 0x00 0x08E12Axxxx


Info white.png Information
Advertising is stopped after 30s. You can press B1 to restart it.


The Serial Port Server application acts as a Peripheral device with the support of GATT Server Layer.

Once connected with a Serial Port Client application, the Serial Port Server application:

  • Allows to enter data using keyboard when LF or CR is encountered or data buffer is full (20 bytes), and data are sent to the peer client device.

1.3. STM32WB0 Serial Port Client application

It acts as a Central device with the support of GATT Client Layer.
At startup, by pressing the B1 button, Serial Port Client application:

  • Starts scanning to detect Serial Port Server application by filtering the Firmware ID of the STMicroelectronics Manufacturer advertising data
  • Stops Scanning once P2P server detected
  • Connects to the Serial Port Server to establish the connection.
  • Discovers GATT Service & Characteristics of the Serial Port server
  • Enable all GATT server notification characteristics

Once connected, the Serial Port Client application:

  • Allows to enter data using keyboard when LF or CR is encountered or data buffer is full (20 bytes), data are sent to the peer server device.


Example of communication between STM32WB0 Serial Port Server & Serial Port Client
Connectivity WB0 SerialPort Hyperterminal.png

2. Requirements

2.1. Software and Hardware requirements

For software and hardware requirements refer to the STM32WB0 Build BLE Project wiki page.

2.2. Collector applications compatible

The STM32CubeWB0 Serial Port Server project is compatible with the following collector:

3. STM32WB0 Serial Port Server & Serial Port Client examples description

3.1. Project directory

The "BLE_p2pServer" & "BLE_p2pClient"applications are available by downloading STM32CubeWB0 MCU Package[1].

Refer to How to Build a Bluetooth® LE project wiki page for project directory information.

3.2. Project description

3.2.1. Structure

Software project structure with the most important parts:

Serial Port Server / Client project structure
Connectivity WB0 Serial Port server client Architecture.png
Connectivity yellow box.png
Main applicative part files
Connectivity dark blue box.png
Services management
Connectivity green box.png
Bluetooth® Low Energy libraries
Connectivity pink box.png
Bluetooth® Low Energy stack modular configuration options and event dispatcher files

WARNING: Do not modify the files in Middlewares folder

4. Serial Port Server vs smartphone application

4.1. ST BLE ToolBox application

Once the BLE Serial Port Server application is installed on the STM32WB0 platform, launch the ST BLE ToolBox smartphone application. The application starts scanning and allows to see advertisement data or to connect to the device. Once the device is connected user is able to sends message from hyper terminal (TX characteristic notification) and receives messages from the ST Toobox (RX characteristic write without response)

BLE Serial Port Server application vs ST BLE ToolBox
Connectivity STToolbox vs-SerialPort Server.jpg


5. References