Showing results for 
Search instead for 
Did you mean: 

How to implement a custom BLE profile on STM32WB55 using FreeRTOS?

Associate III

Hi All,

I got stuck trying to implement a custom BLE profile on the STM32WB55 with bare-metal programming. Unfortunately, the available workshop on this topic is completely out-of-date and uses an older firmware package (I am on version 1.11.1 now). I read different user manuals, programming manuals, and application notes from ST, but I have not been still able to launch my project.

I recently read that if a project involves complex networking protocols (it is subjective, but BLE seems to be a complex protocol), it is usually handy to use an OS.

While I am still trying to use the sequencer utility and bare-metal programming with the super loop architecture, I would appreciate it if you could share your opinion and experience on using FreeRTOS for implementing a custom BLE profile on the STM32WB55. If you could share any existing project code, I would really appreciate it.

Thank you

Guillaume K
ST Employee


In STM32WBCube FW package the majority of project examples use the sequencer (no RTOS).

To implement a custom BLE service you could have a look at BLE_Custom example ( STM32Cube_FW_WB_V1.12.0\Projects\P-NUCLEO-WB55.Nucleo\Applications\BLE\BLE_Custom).

It uses the service APIs from STM32_WPAN svc_ctl.c ( middlewares/ST/STM32_WPAN/BLE/svc/Src/svc_ctl.c)

in Projects\P-NUCLEO-WB55.Nucleo\Applications\BLE\BLE_Custom\STM32_WPAN\App\custom_stm.c there is:

- SVCCTL_InitCustomSvc() for initialisation of the service (real implementation of the same weak function in svc_ctl.c)

- Custom_STM_Event_Handler() that handles the characteristics events for the custom service.

Associate III


Thank you for your response. I saw this example.

It was useful for me only in the part related to the custom template's initialization (.ioc file, Middleware/STM32_WPAN).

But, this example does not implement any real behavior, which is stated in the readme file: "All the application behavior must be developed by the user".

The main obstacle for me is exactly in the implementation of the application behavior, like which files I should modify in the hierarchy to make it work.

It would be really useful to have an example that would implement, for instance, the BLE_p2pServer example with a custom template. It would save a lot of time for developers.

I would appreciate it if you could point me out to a complete example using a custom BLE profile. Because, it is a really demanded [1, comments below 2] part of programming with BLE.

Thank you

Dear All,

I found that when stm32wpan is active and free rtos is active then hardware scheduler utility is disabled by cubemx and as a result APPE_init() function call dissappear from main.c. Do You know by chance what is the best place to call APPE_init() when freertos is active? I was trying befor freertos init but getting hardware fault. I was also trying after freertos init and got the same hardware fault. Any help?

Associate III


I had the same issue a while back and found the attached document on an old st-community thread (can't remember which).

I never got around to try it out, but it might be a good starting point?

Though it does seem a bit difficult to maintain a project like this when regenerating code.

I appreciate your message. I will examine the document you attached. Currently, my focus shifted towards the development of a desktop application that would discover and communicate with BLE devices. Later, I will continue working on the STM32WB55 part. I will post my results.

Associate II

Hi, I met the same issue in which the MX_APPE_Init(); and the MX_APPE_Process(); went missing after implementing freeRTOS. Did anyone get the solution regarding this?