cancel
Showing results for 
Search instead for 
Did you mean: 

How to use USB CDC driver for STM32L053?

JTeun.1
Associate II

I've purchased an STM32L0358-disco board and I'm trying to get USB CDC to work.

Here's the steps I took:

  1. Create a new project for the STM32L0538 mcu in STM32CubeIDE
  2. Enable the USB peripheral
  3. Enable the USB Middleware and set the class to Communication Device Class (VCP)
  4. Using the Clock Configuration tab, set the USB peripheral to use the 48 MHz RC oscillator
  5. Generate code
  6. Run

From what I'm reading online and in the generated code, this should be sufficient to get Windows to recognize the device as a USB CDC device. However, I'm getting the error "USB Device not recognized". Looking in the device manager, Windows reports "Windows has stopped this device because it has reported problems. (Code 43)". As far as I understand it, code 43 means that Windows sees the 1.5k pullup on the D+ line, but the device is not responding.

Am I correct in assuming that running this code, the device should show up as a virtual COM port? If yes, what could be going wrong here?

I'm running Windows 10 20H2 (10.0.19042.928), STM32CubeIDE 1.5.0 and I'm using the latest cube package STM32Cube FW_L0 V1.12.0.

Kind regards,

Jim

1 ACCEPTED SOLUTION

Accepted Solutions
JTeun.1
Associate II

After plugging the device into another PC, it is recognized immediately. So the problems was with my laptop. So to answer my own question; yes, if you enable the VCP middleware in CubeMX, the device will be detected as a virtual COM port without requiring any further modifications to the code.

View solution in original post

5 REPLIES 5

<deleted>

The USB Device not functioning properly typically isn't a driver side issue.

Perhaps look at porting this example to your board

STM32Cube_FW_L0_V1.11.0\Projects\STM32L073Z-EVAL\Applications\USB_Device\CDC_Standalone

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
JTeun.1
Associate II

Thanks for the quick reply! I'm using the STM32L0538-disco board, so the hardware should not be the issue. I'm going to take a look at the example.

JTeun.1
Associate II

I've compared the CDC_standalone example code with the generated code and I cannot spot any difference. Can someone confirm my statement that the device should at least show up as a virtual COM port when adding the CDC middleware, even if my code doesn't do anything with the virtual COM port? (all interrupt handlers seem to be generated correctly and added to the interrupt table)

JTeun.1
Associate II

After plugging the device into another PC, it is recognized immediately. So the problems was with my laptop. So to answer my own question; yes, if you enable the VCP middleware in CubeMX, the device will be detected as a virtual COM port without requiring any further modifications to the code.