Skip to main content
Javier1
Principal
December 17, 2021
Question

USB CDC device not being recognised by windows. (STM32WB5M, Bluetooth low energy)

  • December 17, 2021
  • 8 replies
  • 7368 views

Context:

I have succesfully implemented a CDC device in a stm32f205 board 6 months ago.

Now im trying to implement the exact same thing in my STM32WB5M discovery board.

BLE is already activated and working P2P custom server

  • Using CUBEMX 6.3.0
  • FW package STM32Cube_FW_WB_V1.13.0

0693W00000HozAeQAJ.png 

 ______________________________________________________________________

 Problem:

Windows doesnt recognise the USB device.

0693W00000Hoz9qQAB.png 

________________________________________________________________ 

How did i got here:

I enabled the USB device mode in cubeMX

0693W00000HozCVQAZ.png 

I enabled the middleware

0693W00000HozCkQAJ.png 

I autogenerate the code....

Inside usb_cdc_if.c i add this code

0693W00000HozFFQAZ.png0693W00000HozDxQAJ.png 

everything compiles and runs but windows doesnt recognice the USB device

Find attached my cubeMX file.

The Windows doesnt recognice error appears when the usb is enabled (i dont know if this means anything )0693W00000HozmJQAR.pngThe usb handle struc doesnt show any errors after init

0693W00000HoznHQAR.png

8 replies

Javier1
Javier1Author
Principal
December 17, 2021

maybe i have clock issues?

0693W00000HozBTQAZ.png

hit me up in https://www.linkedin.com/in/javiermuñoz/
Javier1
Javier1Author
Principal
December 17, 2021

setting my clock to HSE+PLL didnt work either

0693W00000HozVTQAZ.png

hit me up in https://www.linkedin.com/in/javiermuñoz/
Javier1
Javier1Author
Principal
December 17, 2021

I increased Minimum Heap size to 0x2000 didnt work either.

As sugested by @Radek RIPA​ https://community.st.com/s/question/0D50X00009XkeGNSAZ/stm32-usb-cdc-device-descriptor-request-failed

hit me up in https://www.linkedin.com/in/javiermuñoz/
Javier1
Javier1Author
Principal
December 17, 2021

I found the issue: incompatiblityin the autogenerated CUBEMX code USB+BLE=no bueno

0693W00000Hp0cAQAR.pngif i comment out MX_APPE_Init() my usb CDC device is regoniced.

It turns out the BLE thing MX_APPE_Process() corrupts the USB CDC device.

If MX_APPE_Process() gets commented out, CDC device works as expected

TODO:

i need to figure out why USB and BLE are not happy working together......and fix it

hit me up in https://www.linkedin.com/in/javiermuñoz/
Javier1
Javier1Author
Principal
December 17, 2021

0693W00000Hp0htQAB.pngMX_APPE_Process() is accessing the "Sequencer" maybe thats the problem

The BLE stacked sequencer cannot work with the USB device?

hit me up in https://www.linkedin.com/in/javiermuñoz/
Amel NASRI
Technical Moderator
December 23, 2021

Hi @Javier Muñoz​ ,

At this level, I suggest to involve our experts for STM32CubeMX @Khouloud OTHMAN​  & STM32WB @Remi QUINTIN​  to help you invistigating the issue.

Don't hesitate to share your findings meanwhile.

Thanks.

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
jsoda.1
Associate III
May 16, 2022

Well, I was finding solution for my USB flash stick project and found this post.... AMAZING!!

Javier1
Javier1Author
Principal
May 16, 2022

0693W00000Nq2avQAB.gif

hit me up in https://www.linkedin.com/in/javiermuñoz/
Adrian Adamson
Senior
December 15, 2022

I'm having the same symptom.

I am using a board where the USB hardware interface works fine when I run other firmware.

I started with the .ioc file from the P2PServer and used CubeMX to generate my own project. With the help of some code from the p2pserver project, the project works fine without USB enabled, and I was able to modify it to enable it to work with FUOTA. I used CubeMX to enable the USB full-speed device, set the heap size to 0x2000, changed the GPIO speed to very fast, changed app_conf.h to the following:

#define CFG_USB_INTERFACE_ENABLE 1

and still I get the same problem where computer I plug the USB into says there's a problem with the device. I have tried disabling low power mode with no success, and I also updated the clock configuration to better match my working USB example:

0693W00000WL8NcQAL.png 

@Khouloud OTHMAN​  @Remi QUINTIN​  Are there any known examples of USB working alongside USB? I just received the first small production run of a new product I'm making where I was counting on using the USB device along with BLE.

Javier1
Javier1Author
Principal
December 16, 2022

As i said 1yr ago:

My design allowed me to replace USB for UART communications.>I dont think im comming back to face this USB+BLE issue anytime soon.

And i very didnt, i still suspect the "Sequencer" used with the BLE API is the reason USB doesnt work.

Maybe they changed something since STM32Cube_FW_WB_V1.13.0 ? maybe not

Good luck @Adrian Adamson​ 

hit me up in https://www.linkedin.com/in/javiermuñoz/
ICMosquera
Associate III
July 18, 2023

Im still waiting for the developers to address this problem. I hope this get fixed soon.

Associate III
November 9, 2023

Hello, I had same problem with STM32WB5M module on our custom project and also gave up on fixing USB sequencer bug, due to limited time resources and just switched to USART1 and added an ftdi serial to usb converter.

Explorer
December 5, 2024

Has anyone found a fix for this issue.  I have a project that requires both USB and BLE to be supported at the same time.  I have noticed the same behavior, once the BLE sequencer is enabled, the USB function dies. 


Adrian Adamson
Senior
February 1, 2025

I put in a support ticket in 2022 when this came up for me, and STM engineers gave me a project framework that worked.   Now I'm starting on a new project from scratch that also uses BLE FUOTA and USB, and I think I'm running into either the same problem or one that's related.   I'm searching for the original support ticket and came here.   So the good news is, it's possible to use the BLE sequencer and USB, but the bad news is that I have forgotten what the fix is.  I may end up starting over starting with cloning my previous project.

Adrian Adamson
Senior
February 1, 2025

I found my support ticket and here's what they said:  

"Thank you for your patience. Please see the attached example code. We were able to determine the root cause of the issue. One of the semaphores of the BLE sequencer (specifically semaphore 5) is causing CPU2 to switch off the USB clock. Semaphore 5 is responsible for controlling the USB CLK48. During CPU2 startup, the CPU2 needs semaphore 5, but it is busy. Thus the HSI48 oscillator is switched off by CPU2 when a wireless stack is started. Therefore, the issue is in how the BLE stack is functioning, but not necessarily a bug. We were able to create a workaround and you can find it in the example code."

 

I think this led to the code that's available here:  https://community.st.com/t5/stm32-mcus-wireless/usb-device-does-not-work-when-starting-ble-stack-on-stm32wb55/td-p/176360