Closed xuzihan351 closed 3 months ago
Hi, please try change interval
in following lines to 8
:
and check if that helps to remove the split count check.
It also result in an exception.
Thanks for the feedback.
I think we may need more time to find out what's the root cause.
In normal case, ux_ehci_ed_microframe_ssplit_count
is increased on endpoint creating and decreased on endpoint destroy.
I tested several mouse and tracked the process of creating interrupt endpoints.
For mouses with interrupt reporting cycles longer than 1 millisecond, ux_ehci_ed_microframe_ssplit_count
will not increase during endpoiint creating. But it will decrease during destory.
https://github.com/azure-rtos/usbx/blob/7c928b43db68b72970b3effd5a2582eb5a6869c7/common/usbx_host_controllers/src/ux_hcd_ehci_interrupt_endpoint_create.c#L243
interval
calculation is not correct, if endpoint interval is larger than 1ms, final checked interval
in code should be 8. Please try following code:
/* Keep interval <= 1ms for micro-frame calculation. */
/* Make it index steps to move. */
if (interval >= 4)
{
interval = 3; /* Uses 3 for 1ms calculation. */
}
else if (interval > 0)
{
interval --;
interval &= 0x3;
}
interval = (1u << interval); /* 1 (1/8ms), 2, 4, 8 (1ms) */
With this change, the previous interval
change in L269 and L296 is not necessary.
It works!
Glad to hear that.
Fix is in latest code. Can close.
I am using USBX host to access the mouse device. I found that some mouse insertion and removal operations caused the program to enter a hard fault. I have found that as long as the device has multiple interrupt endpoints, this situation will occur. So I tracked the correlation function of the interrupt endpoint. I found that in the
ux_hcd_ehci_interrupt_endpoint_destroy
function, the value of this variable changed from 0 to 255. When the device is plugged in again,_ux_host_stack_new_device_create
will returnUX_NO_BANDWIDTH_AVAILABLE
because of theux_ehci_ed_microframe_ssplit_count == 255
. So I add aif ux_ehci_ed_microframe_ssplit_count > 0
before theux_ehci_ed_microframe_ssplit_count--
, the bug has disapperared. Please check this error and let me know the correct repair method.