Showing results for 
Search instead for 
Did you mean: 

Help with, STM32duinoBLE, and GATT

Associate II

Help, anyone! What am I doing wrong??

Below is the entirety of the skeleton code that I have written to add a GATT service to the basic The issue I have is I only get two generic services:

00001801-0000-1000-8000-00805f9b34fb (Handle: 1): Generic Attribute Profile
00001800-0000-1000-8000-00805f9b34fb (Handle: 5): Generic Access Profile

I'm at a complete loss. I read the note about pushing the DTM_LLOnly.bin firmware to the SPBTLE-1S however when I put any firmware into the SPBTLE-1S module other than what is shipped with it, the BLE.begin() call fails. If I put the default firmware into the SPBTLE-1S module, then BLE gets initialized but the added custom services don't show up on any tools I use to inspect BLE devices (such as ST BLE Toolbox). As I said, I only get the two above generic services and I cannot seem to use either of those with read/write events to transfer data. I am really looking to just push a small string one way or the other between the and a python program on a PC (using bleak). I was able to do this with an nRF device under zephyr, however I can't seem to get the BLE to work on the sensortile box no matter what I do, either in Arduino or in zephyr. It seems like it's locked down, however I know that it can work because the STMcubeIDE has examples where other services are registered (and visible).

This is the skeleton code which compiles but doesn't seem to add any services or respond to write events:

#include <STM32duinoBLE.h>

BLEService customService("0000FF00-0000-1000-8000-00805F9B34FB");  // Custom service UUID
BLECharacteristic customCharacteristic("0000FF01-0000-1000-8000-00805F9B34FB", BLEWrite | BLERead32);  // Custom characteristic UUID

SPIClass SpiHCI(PC3, PD3, PD1);
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_1S, PD0, PD4, PA8, 1000000, SPI_MODE1);

BLELocalDevice BLEObj(&HCISpiTransport);
BLELocalDevice& BLE = BLEObj;

void setup() {

  while (!Serial);

  Serial.print("Starting BLE\n");

  // Initialize BLE
  if (!BLE.begin()) {
    Serial.print("BLE Init failed.\n");

  // Set advertised local name and service UUID

  // Add the characteristic to the service

  // Start advertising

  Serial.print("Exiting Setup()\n");

void loop() {
  // Handle BLE events

  // Check if data has been received
  if (customCharacteristic.written()) {
    Serial.print("Remote received data\n");
Associate II

Resolved here:

The bottom line: The file DTM_LLOnly.bin contained in the fp-ind-predmnt1 archive does not apply to the SPBTLE-1S module mounted on the sensortile box. The above link to the solution references a custom version of DTM_LLOnly.bin built for use with the sensortile box under STM32duinoBLE.

Many thanks to Carlo Parata (ST employee) for clarifying this and helping me out!