2025-12-05 6:26 AM
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.
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
Solved! Go to Solution.
2025-12-11 4:53 AM
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.
2025-12-09 12:04 AM
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?
2025-12-09 2:43 AM - edited 2025-12-09 2:47 AM
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:
2025-12-11 12:42 AM - edited 2025-12-11 12:43 AM
Hello @Capocc
Yes, delete the USBPD software because the nucleo boards have USB Type C Sink only.
However, it is necessary to provide external power to the device connected to the board because, in Host mode, the device requires power.
2025-12-11 12:50 AM
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.
2025-12-11 2:55 AM
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.
2025-12-11 3:24 AM
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?
2025-12-11 4:53 AM
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.
2025-12-11 5:03 AM
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.