cancel
Showing results for 
Search instead for 
Did you mean: 

BlueNRG-2 Windows error getting services and characteristics

George_Kryshco
Associate II

Hello everyone!

I am trying to get all services and characteristics from steval-stwinbx1 board running FP-SNS-Datalog2 function pack. Here's simple program I wrote:

import asyncio
from bleak import BleakClient

MAC_ADDRESS = "DA:3E:83:DD:30:F8"

async def discover_services(mac_addr):
    async with BleakClient(mac_addr) as client:
        for service in client.services:
            print(f"\n[Service] {service.uuid}")
            print(f"Description: {service.description}")
            
            for char in service.characteristics:
                print(f"    |")
                print(f"    +-- [Characteristic] {char.uuid}")
                print(f"        Properties: {', '.join(char.properties)}")

if __name__ == "__main__":
    asyncio.run(discover_services(MAC_ADDRESS))

 I expected to get services listed by nRF Connect app.

photo_1_2026-04-03_17-44-41.jpgphoto_2_2026-04-03_17-44-41.jpgphoto_3_2026-04-03_17-44-41.jpg

But the program output is empty. Why?

 

PS: I have done some research and experiments. I have tried running same script on linux and it ran perfectly (I used 2 machines: same machine (dual boot) and raspberry pi). I have noticed that board crashes if you are trying to pair with it. And does not give you services(does not respond) if you are not pairing, because of MITM_PROTECTION_REQUIRED BlueNRG2 just drops packages and Windows hangs indefinetly. If you pair with the device, Windows Bluetooth stack just bombards mcu with a ton of concurrent requests and board crashes. I think increasing bluetooth task queue might help? Am I doing something wrong?

 

Thank you all in advance!

 

4 REPLIES 4
Imen.D
ST Employee

Hello @George_Kryshco and welcome to the Community

If you're able to correctly connect and interact with the STEVAL-STWINBX1 application offering a specific set of Bluetooth LE services and characteristics by using a Smartphone application, we could assume that the steval-stwinbx1 application is properly working. 

The context of the specific program that you are trying to run is not clear. If possible, add more details:

Is it a Windows program? Are you able to interact with the same program with other BLE devices (assumption is this program should find and connect to the peripheral device and discovery related services and characteristics). 

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

Hello @Imen.D, thank you for your response.

I am currently developing a simple PnPL command sender for the STEVAL-STWINBX1 board. I have already written a script that can retrieve the get_status of each component and start/stop logging. This script works correctly on Linux (tested on a Raspberry Pi).

However, I am experiencing issues when running a similar setup on Windows. Specifically, the board appears to “crash” (or enter an unresponsive state). The green LED stops blinking and may remain either ON or OFF indefinitely. After this happens, the board no longer responds to commands.

I observe the same behavior when sending the wifi_config*connect command (ST BLE Sensor Android app configuring wifi connectivity also did not work). Even when valid wifi_ssid and wifi_password are provided, the board stops blinking its LED, but it never successfully connects to the router.

To verify BLE functionality, I used my smartphone as a bluetooth device, and I was able to retrieve services and characteristics successfully (see attached screenshot).

Based on this, it seems the firmware is running, but the issue may be related to how commands are sent from Windows or how the board handles them.

Could you please advise what might cause this behavior, or what additional debugging steps I should take?

Thank you in advance.
George

Screenshot 2026-04-07 191128.png

Andrew Neil
Super User

@George_Kryshco wrote:

I have tried running same script on linux and it ran perfectly


Which suggests its something specific to Windows - probably not an ST issue.

Have you tried the nRF Connect desktop app on the same Windows device ?

Have you tried debugging your Python code to see what's happening? 

pdb — The Python Debugger

 

I note that the Bleak documentation recommends against initialising with a MAC address.

So maybe try not doing that?

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

Hello @Andrew Neil , thank you for your response.

I followed your suggestions and performed additional testing. Unfortunately, I do not have a Nordic Semiconductor development kit, so the nRF Connect desktop application is not very useful in my case. I also tried using Bluetooth LE Explorer; it attempted to pair with the device, but this ultimately caused the board to become unresponsive.

I debugged my Python code using pdb. The debugger indicates that the connection is successfully established; however, the list of discovered services is empty.

Regarding the MAC address, I do not believe it is the root cause of the issue. Even when the connection is reported as successful, no services are discovered.

At this point, I am unsure what might be causing this behavior, so I am attaching the Bleak log file for further analysis.

Any guidance would be greatly appreciated.

Thank you in advance.

George