2021-07-12 03:50 AM
I am using STM32G0B1KCT6
Clock Configurations as like that
And pin configurations are like that
I generated code and run to debug. When i connected the MCU to USB port at PC, There is a error message "USB not recognized".
I changed the usb_cdc.c at 516. line as
pdev->pClassData = USBD_malloc(sizeof (USBD_CDC_HandleTypeDef)); memset(pdev->pClassData,0,sizeof(USBD_CDC_HandleTypeDef)); // THIS LINE WAS ADDED
It doesnt work.
Then i tried the example, CDC_Standalone, I saw the COM Port at device manager but i couldn't open the port.
What can i do now?
2021-07-14 08:27 AM
Hello @EKahr.1 and welcome to the Community 🙂
Maybe you should increase the heap size, as recommended in this FAQ: USB device not recognized.
Check also the USB connection and port. So, try to switch USB port, or check with other boards.
When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.
Imen
2021-07-31 02:43 PM
Hi @EKahr.1 ,
Please share your update and let me know if your issue is solved. This will be helpful for the Community =)
If my proposal work, please mark my answer as "Select as Best" button.
Thanks
Imen
2021-08-10 10:12 PM
I have a similar problem with my first board with a STM32G0B1CCUx device. Using STM32CubeMX 6.3.0 and STM32Cube FW_G0 V1.5.0. I create a project and change the following:
- SYS SerialWire
- Connectivity USB_DRD_FS Device_Only
- Middleware USB_DEVICE CommunicationDeviceClass (Virtual Port Com)
- ProjectManager CodeGenerator Makefile
Default the clocks are HSI and HSI48.
Build with gcc 10.2 (GNU Arm Embedded Toolchain 10-2020-q4-major).
After flash and power on, I can see these logs in dmesg (Ubuntu):
[1245259.669981] usb 1-3.2.2: new full-speed USB device number 67 using xhci_hcd
[1245259.774030] usb 1-3.2.2: device descriptor read/64, error -32
[1245259.986029] usb 1-3.2.2: device descriptor read/64, error -32
[1245260.197966] usb 1-3.2.2: new full-speed USB device number 68 using xhci_hcd
[1245260.302019] usb 1-3.2.2: device descriptor read/64, error -32
[1245260.514047] usb 1-3.2.2: device descriptor read/64, error -32
[1245260.622189] usb 1-3.2-port2: attempt power cycle
[1245261.273937] usb 1-3.2.2: new full-speed USB device number 69 using xhci_hcd
[1245261.274107] usb 1-3.2.2: Device not responding to setup address.
[1245261.482073] usb 1-3.2.2: Device not responding to setup address.
[1245261.689927] usb 1-3.2.2: device not accepting address 69, error -71
[1245261.793922] usb 1-3.2.2: new full-speed USB device number 70 using xhci_hcd
[1245261.794069] usb 1-3.2.2: Device not responding to setup address.
Now some interesting fact: The hardware seems to work, because the factory bootloader can run USB in DFU mode. In this configuration the device show up in the PC and I can flash application via DFU. This happen the first time and also I made a special application that jump to the bootloader (instead of call the normal main function). I have access to the device via Serial Wire pins and a ST-LINK. My application using different clock configuration (HSE 24MHz).
SOLUTION: Enable USB interrupt!
In CubeMX at System Core - NVIC: "USB, UCPD1 and UCPD2 global interrupts" = Enabled 0 (i.e. check the box)
This will add USB_UCPD1_2_IRQHandler and add some lines in HAL_PCD_MspInit and HAL_PCD_MspDeInit.
//Michael