Skip to main content
Graduate II
August 15, 2024
Solved

USB_DEVICE code can't work!

  • August 15, 2024
  • 1 reply
  • 886 views

Hi there,

I am using STM32F429BIT6 and want to show the SDcard(connect with MCU by SDIO) as a Udisk on PC.

I can normally read/write the SD card by MCU with FATFS.

But after I added the USB config in CubeMx, the code is something wrong.

My CubeMX config is as follows:

Junde_0-1723691539237.png

Junde_1-1723691568096.pngJunde_2-1723691618953.pngJunde_3-1723691695548.png

Junde_4-1723692170702.png

As we can see, I enabled the USB log, but nothing output.

After debugging, I found the MCU is blocked in the while loop in USBD_GetEpDesc().

I don't know what that means, please help me. Thank you!

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

    Hi @FBL 

    Thanks for your reply.

    Finally I know the reason of mine project.

    I am compiler the project with MDK compiler V6, this is NOT work for USB_DEVICE source code,

    after I change to MDK compiler V5, everything is work well.

     

    1 reply

    Technical Moderator
    August 21, 2024

    Hi @Junde 

    The issue with USBD_GetEpDesc() might be due to incorrect endpoint configuration. Would you share your endpoint descriptor config? Could you share a minimum project to reproduce?  USBD_MAX_STR_DESC_SIZ should be adjusted to accommodate the longest string descriptor you plan to use. A typical value might be 256 bytes to ensure USB stack can handle the string descriptors without buffer overflows. Also, it seems FH_mount(&sDisk[0]) is your custom initialization. 

    JundeAuthorAnswer
    Graduate II
    August 22, 2024

    Hi @FBL 

    Thanks for your reply.

    Finally I know the reason of mine project.

    I am compiler the project with MDK compiler V6, this is NOT work for USB_DEVICE source code,

    after I change to MDK compiler V5, everything is work well.