2024-11-06 10:21 AM
Hi all,
I'm trying to enable the host functionalities for USB Port1 for MP135: I imported the Host Library and implemented some functions on usbh_conf.c file. Attached to the DK board I have a optic mouse.
After some basic initialization I'm in the USBH_LL_Start() function and I have the following debug outputs:
Before USBCMD, USB_STS, USBINTR, PORTSC1 set:
USBH_LL_Start usbcmd: 0x00080B00; usbsts: 0x00001000
PORTSC1: x00002000
usbINTR enbl: 0x00000007;
Set the Run/Stop bit and wait for !HC_HALTED:
usbcmd: 0x00080B01; usbsts: 0x00000000
try 0: status 0x00000000
usbcmd: 0x00080B01; usbsts: 0x00000000
PORTSC1: x00002000
Set the PORTPOWER bit for PORTSC1:
PORTSC1: x00003000
Set CONFIGFLAG_FLAG:
usbcmd: 0x00080B01; usbsts: 0x00000004
F PORTSC1: x00001803
usbINTR enbl: 0x00000007;
PORTSC1 set Reset + delay
PORTSC1: x00001101
POSTSC1 reset Reset ..
PORTSC1: x00001101
.. wait ..
PORTSC1: x00001005 --> Port Enabled + Device present !
usbcmd: 0x00080B01; usbsts: 0x00000004 --> Port change Detect
In my undestanding these operations should fire usb interrupt(s) but my irq handler routine is never called:
void USBH_PORT1_IRQHandler(void)
{
HAL_HCD_IRQHandler(&hhcd); //
}
The IRQ is enabled by:
GIC_SetPriority(USBH_PORT1_IRQn, 5);
GIC_EnableIRQ(USBH_PORT1_IRQn);
Is there a reason?
thanks, regards
2024-11-07 02:53 AM
Hi @SteMMo
USB Host is not delivered by ST. Can you clarify what you mean by "I imported the Host Library" ?
Thanks
Olivier
2024-11-07 05:03 AM - edited 2024-11-07 06:24 AM
Hi @Olivier GALLIEN ,
I mean that I extracted the Middlewares\ST\STM32_USB_Host_Library\* files and folders from the STM32CubeMP13 SDK archive and added them to my project.
Thanks,
regards
2024-11-08 06:42 AM - edited 2024-11-08 06:45 AM
quite incredibly these registers have the same value even if the mouse is NOT connected!
So why the Device present bit in PORTSC1 is hi?? Is it the external USB hub?
Anyway the VBUS on the USB socket (then mouse led) is low.
I prayed that the hub were disabled cause the disabled USB port .. but now is enabled ..PORTSC1=0x1005.