2025-07-17 6:04 AM - last edited on 2025-07-17 6:35 AM by Andrew Neil
Hello everyone,
I’m working on a BLE project using two STM32WB55 boards.
My goal is to create a connection between them without using the ST BLE Toolbox App.
One board is configured as a Custom Server (Peripheral), and the other as a P2P Client (Central).
I want to ensure that I am properly connected to my server and receiving notifications.
But I am not sure about how using:
Start scanning
Identify the correct server
Connect
Discover services
Enable notifications
Receive data
Please without saying follow the P2p example, because I didn't catch it
Solved! Go to Solution.
2025-07-23 6:32 AM
Hello,
the characteristic property CHAR_PROP_NOTIFY needs to be enabled. Then if you press button 1, it sends the notification to the client via Custom_Switch_c_Send_Notification() function. (BLE_Custom example, custom_app.c)
Best regards,
Filip Kremen
2025-07-17 7:10 AM
Hello,
have you read this Wiki page?
It provides more information regarding P2P application. It's meant for WBA series, however the structure is similar to WB series.
STM32WBA Bluetooth® LE – Peer 2 Peer Applications - stm32mcu
I also recommend reading this document below.
Guidelines for Bluetooth® LE stack programming on STM32WB/STM32WBA MCUs - Programming manual
If you have any other question, please don't hesitate to ask.
Best regards,
Filip Kremen
2025-07-17 7:48 AM
My objective is to send some sensor data from an MCU to other one, so what is the best solution for me, and I didn't catch the BLE_p2pClient example, so if there is any other clear tutorial or reference to follow ? (I reached to send the data to ST Toolbox App)
2025-07-18 1:33 AM
Hello,
I recommend reading a readme file in the BLE_p2pClient example for overview.
Also, if you have a look at p2p_client_app.c file you can find there Button_Trigger_Received() function which writes to a characteristic on server side, and you can toggle LED based on this value. You can also add your own characteristic to the server for your own data.
Section 7 in the document also provides additional information for building BLE application.
How to build wireless applications with STM32WB MCUs - Application note
Best regards,
Filip Kremen
2025-07-21 4:00 AM
After reading the BLE_p2pClient example, how can I modify the example to start the scanning without pressing the button B1? and how this scan is done exactly in software?
2025-07-21 4:16 AM
Hello,
you could for example call UTIL_SEQ_SetTask(1 << CFG_TASK_START_SCAN_ID, CFG_SCH_PRIO_0) function at the end of APP_BLE_Init() or you could use a timerserver that would run the function above after certain interval.
Regarding the scan, the task CFG_TASK_START_SCAN_ID is registered in the sequencer and then it can be run with the function mentioned above. The scan starts with aci_gap_start_general_discovery_proc() command from Scan_request() function. I hope you can understand it better now, please don't hesitate to ask further.
Best regards,
Filip Kremen
2025-07-21 4:35 AM
Great, and how can the scanning detect the right server exactly? with the UUID ?
2025-07-21 7:23 AM
The found devices are returned via HCI_LE_ADVERTISING_REPORT_SUBEVT_CODE in app_ble.c file.
In the switch case (SVCCTL_App_Notification() function) you can see how the server is found according to
AD_TYPE_MANUFACTURER_SPECIFIC_DATA.
Best regards,
Filip Kremen
2025-07-21 7:48 AM
I appreciate really your time, I would a full guideline to receive some data from the server part to the client part, so exactly I need the code from the client part.
The function which I am using in custom_app.c file is myTask(void):
void myTask(void)
{
if( abs(prevCOPx + COPx) >= 5 || abs(prevCOPy + COPy) >= 5 ){
strcpy(NotifyCharData, message);
Custom_Mycharnotify_Send_Notification();
}
prevCOPx = COPx;
prevCOPy = COPy;
UTIL_SEQ_SetTask(1 << CFG_TASK_MY_TASK, CFG_SCH_PRIO_0);
}
I want a way to how receive this notification on my other client MCU, thanks in advance.
2025-07-23 6:32 AM
Hello,
the characteristic property CHAR_PROP_NOTIFY needs to be enabled. Then if you press button 1, it sends the notification to the client via Custom_Switch_c_Send_Notification() function. (BLE_Custom example, custom_app.c)
Best regards,
Filip Kremen