Showing results for 
Search instead for 
Did you mean: 

STEVAL-STWINBX1: BleSensors App = Cannot Connect via BLE

Associate III

I recently received the STEVAL-STWINBX1 and plugged it in out of the box and it worked fine.  There was a firmware update which I did successfully. 

Next, I downloaded FP-SNS-STBOX1 v1.5.0 to test it out.  As per the readme I imported the "STM32CubeFunctionPack_STBOX1_V1.5.0\Projects\\Applications\BLESensors" into STM32CubeIDE and built the application in release mode.  Following UM2965 I programmed the binary via USB DFU mode.  It programs successfully but when I go to use the ST BLE Sensor app on my iPhone it can see the STWinBX device but fails with a "Cannot connect with the device: STWinBX" error message.

In the iPhone ST BLE Sensor application I noticed that it still reports the default firmware on Bank doesn't seem to show the new BLESensors app.  Screenshot and programming log attached for reference.

Any troubleshooting tips?  I didn't change anything in the BLESensors app, just imported, compiled, and programmed.  Don't know what I'm missing but clearly I messed something up.

Thank you very much!

Associate III

Bad to reply to your own question, but I have more information to share.  I added my STLINK debugger and now in the terminal I see the following error message: 

STMicroelectronics BLESensors:
Version 1.5.0 board
(HAL 1.1.0_0)
Compiled Jun 30 2023 06:45:49 (STM32CubeIDE)
Current Bank =1

Initializing Bluetooth

SERVER: BLE Stack Initialized
BoardName= STWinBX
BoardMAC = d7:e8:24:94:25:a1
BlueNRG-2 HW ver1.2
BlueNRG-2 FW ver2.1.f

Console Service added successfully
BLE Environmental features ok
BLE Inertial features ok
BLE Battery features ok
Features Service added successfully (Status= 0x0)
BLE Stack Initialized & Device Configured
aci_blue_initialized_event Reason_Code=1
aci_blue_initialized_event Reason_Code=1
aci_gap_update_adv_data OK
>>>>>>CONNECTED 78:d:8f:9d:b4:cd
aci_gap_pairing_complete_event failed:
status= Encryption failed, LTK missing on local device
reason= NaN
Error: aci_gatt_proc_complete_event Error Code=65
aci_gap_update_adv_data OK


Some more googling says I needed to "forget" the STWINBX device in my iPhone bluetooth settings and magically the error goes away next time I loaded the ST BLE Sensor app.  Thought I'd share as this had me chasing my tail for a while.


Luca Pezzoni
ST Employee

When you use the board the first time, it starts using the fw pre-load from Flash Bank1
when you have done the update the board saves the new fw on Bank2 and then it restarts from Bank2

you could see on the image that you have attached that your iphone is saying that the board is on Bank2
The Bank1 is the flash region between 0x0800 0000 and 0x080F FFFF
The Bank2 is the region between 0x0810 0000 and 0x081F FFFF

with the DFU you have changed the code on Bank1 I think
So you have not changed your actual running fw, but the previous one contained on Bank1

Now, if you want to flash a new fw and use it... you could do 2 things:
1) Change the option bytes for saying to come back to Bank1 (using the STM32CubeProgrammer, or using the ST BLE Sensor application going to Extended Configuration demo page)
then you could flash the fw like you have done
2) flash the new fw on the bank that you are using..
So not starting at 0x0800 0000
but at 0x0810 0000