cancel
Showing results for 
Search instead for 
Did you mean: 

BLE and USB-CDC with FreeRTOS

ABN
Associate III

I have a project which has the requirement of BLE and USB in CDC mode. The implementation is done with the FreeRTOS. BLE and USB are working independently, but when I integrate both of them in a single project then there are some issues which are being faced mentioned below.

  1. Whenever the controller is programmed, then the USB is enumerating and it is working properly. During this, the BLE is not advertising. When there is a reboot triggered, the USB device is not recognized but the BLE is advertising.
  2. APPE_SysUserEvtRx callback function is not triggered from the shci_init function. The event to trigger this function is not generated.

Microcontroller - STM32WB55VGYX

Using the BLE full stack v1.15 with the FUS v1.2.0

USB is using the PLLSAI1Q clock source with the frequency of 48MHz.

CPU2 is operating with the frequency of 32MHz.

Main core is operating at 64MHz frequency.

1 ACCEPTED SOLUTION

Accepted Solutions
Remy ISSALYS
ST Employee

Hello,

There is an extra dot in linker script (see STM32WB55RGVX_FLASH.ld file

), line 178 :

*(.MB_MEM2);

This line should be replaced by the following line:

*(MB_MEM2);

Due to this extra dot, the buffers that need to be in SRAM2 are not placed there, so your application doesn't work. It will be corrected in the next release.

Best Regards,

Remy

View solution in original post

5 REPLIES 5
Remy ISSALYS
ST Employee

Hello,

You can look STM32WB-BLE-USB-CDC-VCOM example available on STM32-Hotspot GitHub. This example demonstrates how to use the BLE component alongside the USB peripheral for point-to-point communications. In addition, you can look AN5289 which describes the algorithm to use USB on CPU1 (see Figure 9). The USB and RNG IPs share the same source clock. Before switching off the clock, the USB driver must first check whether the CPU2 requires the clock or not.

Best Regards

@Remy ISSALYS​ 

I looked through the example code. But this is not having the FreeRTOS implementation. Whether implementing FreeRTOS cause any issues?

Secondly, semaphore SEM5 was managed in the firmware, but didn't improve the expected behavior. Currently the RNG block is not enabled/activated and I'm presuming that with this configuration the clock sharing is not possible.

Remi QUINTIN
ST Employee

Which IDE are you using? IAR or CubeIDE or else ....?

ABN
Associate III

CubeIDE

Remy ISSALYS
ST Employee

Hello,

There is an extra dot in linker script (see STM32WB55RGVX_FLASH.ld file

), line 178 :

*(.MB_MEM2);

This line should be replaced by the following line:

*(MB_MEM2);

Due to this extra dot, the buffers that need to be in SRAM2 are not placed there, so your application doesn't work. It will be corrected in the next release.

Best Regards,

Remy