Skip to main content
Explorer II
December 5, 2025
Solved

USB host MSC stm32h563 insertion callback not run

  • December 5, 2025
  • 5 replies
  • 56 views

Hello,

I'm trying to detect a USB stick insertion event to write a text file in the stick. 
I'm working on a NUCLEO-H563ZI with a jumper connected to JP2 USB USER line and a USB TYPE-C TYPE-A connector attacched in CN13. 

IMG_20251205_151249.jpg

I started the code from an ST Example but without the USB-PD because I need only two lines (USB_FS_P and USB_FS_N).

I saw others example with USB_OTG but my .ioc doesn't have this option. 

The problem is that I can't catch the USB stick insertion event. I put a breakpoint on "_ux_host_class_storage_activate" and on the "ux_host_event_callback" functions but I never reach these points.

Where the event is cathced in the ST functions? What I'm missing / I'm doing wrong?

I have attached the project. 

 Thanks for the support

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

     

    For the Nucleo board in sink mode (power receiving), the jumper JP2 must be set to "USB USER" so that the board can receive 5V power from the USB port. In this mode, the board does not provide power to the USB device.

    If you use the board in Host mode (power supplying), you need to provide external power to the connected device because the board cannot supply power directly through the USB Type-C port.

    5 replies

    ST Employee
    December 9, 2025

    Hello @Capocc ,

    Could you please reattach the project? It seems that the project file is not opening.

    Also, could you provide more details about the example you started with?

    CapoccAuthor
    Explorer II
    December 9, 2025

    Hi @T_Hamdi thank you for the support,

    I reattached the project, I hope this is OK.

    I started taking inspiration from the "Ux_Host_MSC" example project but deleting the USBPD software pack:

    Capocc_0-1765276870189.png

     

    ST Employee
    December 11, 2025

    Hello @Capocc 

    Yes, delete the USBPD software because the nucleo boards have USB Type C Sink only.

    T_Hamdi_1-1765442338591.png

    However, it is necessary to provide external power to the device connected to the board because, in Host mode, the device requires power.

    CapoccAuthor
    Explorer II
    December 11, 2025

    hallo @T_Hamdi ,

    I connected a jumper in JP2 USB_USER, to provide the power to the device. 5V_USB_LED LD7 is also ON.

    ST Employee
    December 11, 2025

    hello @Capocc 

    No in your case, for a USB Host application, the board (HOST) will provide power to the device, when JP2 (USB_USER) is connected. JP2 allows the board to receive power from the host connected via the user USB port.

    T_Hamdi_0-1765450388082.png

     

    CapoccAuthor
    Explorer II
    December 11, 2025

    I thought the power was provided to the usb stick because when I plugged the usb stick, it lights up. I take 5V from STLK (JP2 STLK) and give to the USB from JP2 USB_USER.

    So, how can I setup the HW to be able to develop my host msc applicaton? Is it possbile?

    T_HamdiAnswer
    ST Employee
    December 11, 2025

     

    For the Nucleo board in sink mode (power receiving), the jumper JP2 must be set to "USB USER" so that the board can receive 5V power from the USB port. In this mode, the board does not provide power to the USB device.

    If you use the board in Host mode (power supplying), you need to provide external power to the connected device because the board cannot supply power directly through the USB Type-C port.

    CapoccAuthor
    Explorer II
    December 11, 2025

    Thank you @T_Hamdi

    "the board cannot supply power directly through the USB Type-C port", this is excactly what I was trying to do. I will connect an external board to the CN12 connector using the pins PA11 and PA12 to test my application.