cancel
Showing results for 
Search instead for 
Did you mean: 

BLE connection allmems 1 v4.2.0 - Sensortile

DeveloperNextInd
Associate II

Hello, I'm using a STEVAL-STLKT01V1 demo board to perform voice streaming over BLE using allmems 1 v4.2.0 (since versione 4.3.0 dropped support for my demo board). My setup is:

  • Steval demo board with allmems v4.2.0
  • Python script using Bleak library to manage BLE connection

I'm having trouble connecting the board to the script. I've managed to connect the board to my pc using Windows 10 built-in BLE device managemente. I've inserted the default pin and the computer notify me that the device is connected. When I try to connect to the STEVAL board the script hangs on the connect method until it sends a timetout error. I know that the library is working because I've used the same script in the past to connect to other devices.

What am I missing? Is there some configuration to add/to remove?

My goal is to connect the STEVAL board with allmems 1 v4.2.0 to my python script - without any pin - and subscribe to it's characteristic. I'm planning to add some custom characteristic in the future, both in notify/read and write mode.

 

Thanks,

Stefano

2 REPLIES 2
Federica Bossi
ST Employee

Hi @DeveloperNextInd ,

 

Do you have the capability to edit the firmware code and rebuild/flash it (you will need a flasher like STLink V2/3)?

The Windows driver may be not so compatible with unsecure rescan mode which may be enabled by default in the firmware.

You can confirm this by attaching a STLink to the board and look the output of the virtual COM using a program like Termite.

After connecting/requesting GATT services you would see the Rescan loop printed in the console.

In order to mitigate this, you can enable secure mode (will disable rescan) by finding BluetoothInit in BLE_Implementation.c, and set BLE_StackValue.EnableSecureConnection=1;

The you will need to build and flash the new firmware.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hi @Federica Bossi ,

I'm able to compile the firmware.

 

While looking at your suggestion I've found a file, called BLE_Implementation_Template.c which is not included in the default allmems1 v4.2.0 firmware.

Changing the value BLE_StackValue.EnableSecureConnection inside of BLE_Implementation_Template.c does not have any effect. I'm adding the trace log of my application while trying to connect:

 

DEBUG:asyncio:Using proactor: IocpProactor
INFO:__main__:starting scan...
DEBUG:bleak.backends.winrt.scanner:Received E6:00:EC:EA:A8:A1: AM1V420.
DEBUG:bleak.backends.winrt.scanner:1 devices found. Watcher status: <BluetoothLEAdvertisementWatcherStatus.STOPPED: 3>.
INFO:__main__:connecting to device...
DEBUG:bleak.backends.winrt.client:Connecting to BLE device @ E6:00:EC:EA:A8:A1
DEBUG:bleak.backends.winrt.client:getting services (service_cache_mode=None, cache_mode=None)...
DEBUG:bleak.backends.winrt.client:session_status_changed_event_handler: id: BluetoothLE#BluetoothLE0c:96:e6:37:c8:5a-e6:00:ec:ea:a8:a1, error: <BluetoothError.SUCCESS: 0>, status: <GattSessionStatus.ACTIVE: 1>

 

Thanks,

Ciao!