2024-03-25 06:45 AM
Hello, I'm STM F/W Beginner .
Recently, I was tasked with a project to implement BLE with the Stm32wb MCU.
As a result of referring to Example such as Heartrates or P2PServer Projects, I could successfully send Data to a mobile phone by Nucleo Board.
However, I still can't receive and handle Data with my board.
Is there any example I can refer to?
Solved! Go to Solution.
2024-03-27 06:03 AM - edited 2024-03-27 06:19 AM
If it is of any help, this example here is a good start for building a custom BLE app.
https://wiki.stmicroelectronics.cn/stm32mcu/wiki/Connectivity:STM32WB_BLE_STM32CubeMX
In there they use notifications, but knowing where the notifications get activated, also shows where you have to put the functions to process the incomming bytes.
As an example with the custom BLE settings of the CubeMX:
You want to have a characteristic where the client sends data to the server and the server does not answer back. Then set the following in the characteristic:
Then in file custom_stm.c look for the if case with your characteristic. In this example CUSTOM_STM_Service_1_Char_1_ACI_GATT_ATTRIBUTE_MODIFIED_VSEVT_CODE.
In between you can either use the switch case of the function Custom_STM_App_Notification() in file custom_app.c or wirte your own. For the sake of this example, link the parameters of interest to the struct variable Notification and pass it to the function.
In the switch of Custom_STM_App_Notification() you can work with the bytes received and give it to a function declared in the main.c file.
That is how I do it when using the Custom Template provided by CubeMX.
Hope this helps a little
2024-03-25 07:01 AM
Hello,
To receive and handle data on your board you'll need to implement the BLE GATT which allows your device to act as a central device that can discover services.
So, you can refer to the STM32CubeWB MCU Package.
2024-03-27 06:03 AM - edited 2024-03-27 06:19 AM
If it is of any help, this example here is a good start for building a custom BLE app.
https://wiki.stmicroelectronics.cn/stm32mcu/wiki/Connectivity:STM32WB_BLE_STM32CubeMX
In there they use notifications, but knowing where the notifications get activated, also shows where you have to put the functions to process the incomming bytes.
As an example with the custom BLE settings of the CubeMX:
You want to have a characteristic where the client sends data to the server and the server does not answer back. Then set the following in the characteristic:
Then in file custom_stm.c look for the if case with your characteristic. In this example CUSTOM_STM_Service_1_Char_1_ACI_GATT_ATTRIBUTE_MODIFIED_VSEVT_CODE.
In between you can either use the switch case of the function Custom_STM_App_Notification() in file custom_app.c or wirte your own. For the sake of this example, link the parameters of interest to the struct variable Notification and pass it to the function.
In the switch of Custom_STM_App_Notification() you can work with the bytes received and give it to a function declared in the main.c file.
That is how I do it when using the Custom Template provided by CubeMX.
Hope this helps a little
2024-03-29 04:17 AM
I'm now answering you because I don't get a reply because of a system error.
Thank you for your kind guidance. I'm working on it one by one.
2024-04-02 05:41 AM
no problem. I hope you manage to make it work.
Cheers