Skip to main content
Associate
August 29, 2026
Question

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

  • August 29, 2026
  • 3 replies
  • 54 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   

3 replies

ST Technical Moderator
August 31, 2026

Hi ​@Aum0910 

Before proceeding, we need to narrow down the issue and confirm it’s not related to your custom HW implementation. To do so, Start with a known working USB host firmware on your board for the same USB interface you are using in host mode. You can start with this example and modify it accordingly. If it works as expected we can proceed to enumeration only and see your code.

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.Best regards,FBL
Aum0910Author
Associate
September 1, 2026

Hello Team,

I have download the Source from mention link in last comment and i tried to compile it but it fails.

Additionally i have tried to change the MCU as this project is available for STM32H573 Series and mine is STM32H563ZI but not able to change it.  

Can you please guide me for same.
Additional Information about Hardware is I have short SB21 and SB22 for PA11 and PA12 Pin connection for external USB Breakout board.
How to preceed further now?
Is it possible to check my attached source code at your end weather it is correct or not?

Thanks in advance.

regards,

Kaushal Patel

Andrew Neil
Super User
September 1, 2026

I have download the Source from mention link in last comment and i tried to compile it but it fails.

 

Did you follow the download instructions:

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.