Skip to main content
Visitor II
August 14, 2024
Solved

USB not recognized by PC in FreeRTOS

  • August 14, 2024
  • 2 replies
  • 4539 views

Hi, I want to get log using Type-c, and using freertos to run all the tasks.

setting:

MCU STM32L4A6VG

STM32CubeIDE 1.12.0

STM32CubeMX  6.8.0

tera term 4.106

alyssa_0-1723607387160.pngalyssa_1-1723607401827.pngalyssa_2-1723607423269.png

alyssa_4-1723607858546.png

alyssa_8-1723630965206.png

when i insert Type-c, device manager return the unknown usb.

alyssa_5-1723608106367.pngalyssa_6-1723608116023.png

I try some methods:

1. put MX_USB_DEVICE_Init() before  MX_FREERTOS_Init() -->unknown usb error 43

2. put MX_USB_DEVICE_Init() in task -->unknown usb error 43

3. increase MINIMAL_STACK_SIZE to 1024  -->unknown usb error 43  (ref: https://community.st.com/t5/stm32cubemx-mcus/nucleo-h723zg-usb-cdc-communication-not-working-when-using/m-p/662907 )

4. change clock output  -->unknown usb error 43(ref: https://community.st.com/t5/stm32cubemx-mcus/unknown-usb-device-on-stm32f429zi-device/m-p/75508 )

5. i dont think i need interrupt in usb, but this ref make me confused (ref:https://community.st.com/t5/stm32-mcus-embedded-software/stm32g0b1-usb-device-not-recognized-in-windows-10/m-p/135939  )

It will be very helpful if any one tell me something. Thank you.

    This topic has been closed for replies.
    Best answer by FBL

    Hi @alyssa 

    You  need to ensure that the D+ and D- lines in design are equal in length and respect differential pair routing guidelines as referenced in AN4879 is crucial for maintaining signal integrity and achieving reliable USB communication. In your screenshot 102632 these rules are not respected. D+ and D- lines should be of equal length and consistent spacing.

    2 replies

    Super User
    August 14, 2024

    Can you include your code?

    You definitely need USB interrupts enabled.

    alyssaAuthor
    Visitor II
    August 15, 2024

    Hi, 

    thank you for you reply.

    If you say the interrupt in NVIC settings. I have set it before (sorry make you confused), but still get unknown usb error 43.

    alyssa_0-1723714551967.png

    i attach the main.c below. (for just testing usb, i disable the FreeRTOS)

    but i dont think this is a FW problem.

    because when i  use Full chip erase by STM32CubeProgrammer v2.13.0, the PC still tell me the unknown usb error 43.

    i think without the FW, PC can recognize STM32 BOOTLOADER when insert usb.

     

    Super User
    August 15, 2024

    > i think without the FW, PC can recognize STM32 BOOTLOADER when insert usb.

    This is true. So perhaps there is a hardware error. Can you show your schematic?

    Do you have a Nucleo or other known good ST board you can test this one?

    Technical Moderator
    August 14, 2024

    Hi @alyssa 

     

    Based on these attachments, there might be missing or incorrect device descriptors in your configuration. You need to check them.

    alyssaAuthor
    Visitor II
    August 15, 2024

    Hi,

    i make a only-usb setting. but still get same problem.

    (nothing is changed, all the code is generated by STM32CubeMX  6.8.0.)

    Technical Moderator
    August 16, 2024

    As suggested @TDK , please share your schematics or try to reproduce on reference board so that we might help you investigate further. Try to update all your SW tools.