Skip to main content
Visitor II
August 29, 2026
Question

Problem with NUCLEO-H563ZI USB as Host Only(For Reading and Writing pendrive Sector)

  • August 29, 2026
  • 0 replies
  • 8 views

Hello ​@ST Community ​@ST MICROCONTOLLER 

I have purchase NUCELO-H563ZI board.
Purpose: 
I need to read and write pendrive sector using only pure HAL HCD driver (Baremetal Code only) (No FILEX, USBx, ThreadX, FreeRTOS)
Following is my Hardware Connection: I am using external USB Type A Female Breakout board. Not using internal CN13 TypeC USB connector.

PA11 : D-Minus
PA12 : D-PLUS
VCC : 5V
GND : Board Ground

I have attached file which can read and write the sector.

While submitting request for “Get Descriptor” command. Code is stuck during USB_EnumerateMSC » USB_GetDescriptor » “USB_ControlTransfer” » “USB_SubmitTransfer” >> “HAL_HCD_HC_SubmitRequest”  stuck in “USB_WaitForURB>>HAL_HCD_HC_GetURBState” function.

I can observe that while submitting “HAL_HCD_HC_SubmitRequest” request on channel 0 HAL Drive respond on channel 1 instead of channel 0. ch[0].urbState = USB_IDEL while ch[1].urbState = USB_DONE.

Also i have also observe that “HCD_HC_OUT_IRQHandler(hhcd, (uint8_t)i);” API “uint8_t ch_num = HAL_HCD_GetLogical_Channel(hhcd, phy_chnum, 0U);” return with value 1.

Also i have also observe that “HCD_HC_IN_IRQHandler(hhcd, (uint8_t)i);” API “uint8_t ch_num = HAL_HCD_GetLogical_Channel(hhcd, phy_chnum, 1U);” return with value 1.

Please review the Code and suggest the solution.
I have attached the Code.

Thanks in advance.

 

Regards,

Kaushal Patel