cancel
Showing results for 
Search instead for 
Did you mean: 

Receiving Data from BLE (STM32WB Series BLE Issue)

remoter
Associate III

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?

 
 
 
 
1 ACCEPTED SOLUTION

Accepted Solutions
FDumontKeller
Associate III

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:

FDumontKeller_0-1711544955406.png

FDumontKeller_1-1711544979497.png

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. 

FDumontKeller_2-1711545207116.png

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.

FDumontKeller_3-1711545358961.png

That is how I do it when using the Custom Template provided by CubeMX.

Hope this helps a little

View solution in original post

4 REPLIES 4
ghrairim
ST Employee

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. 

FDumontKeller
Associate III

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:

FDumontKeller_0-1711544955406.png

FDumontKeller_1-1711544979497.png

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. 

FDumontKeller_2-1711545207116.png

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.

FDumontKeller_3-1711545358961.png

That is how I do it when using the Custom Template provided by CubeMX.

Hope this helps a little

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.

no problem. I hope you manage to make it work.
Cheers