cancel
Showing results for 
Search instead for 
Did you mean: 

USB host MSC stm32h563 insertion callback not run

Capocc
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions
T_Hamdi
ST Employee

 

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.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Hamdi Teyeb

View solution in original post

8 REPLIES 8
T_Hamdi
ST Employee

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?

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Hamdi Teyeb

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

 

T_Hamdi
ST Employee

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.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Hamdi Teyeb

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.

T_Hamdi
ST Employee

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

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Hamdi Teyeb

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_Hamdi
ST Employee

 

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.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Hamdi Teyeb
Capocc
Associate II

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.