Closed acagliano closed 4 months ago
Strange because it only happens on your end. For me it works fine.
One
Strange because it only happens on your end. For me it works fine.
One working device and one failing device is not enough to confirm if it is a bug or isn't, is an adapter quirk, or something else. So far I've gotten the same behavior off two NCM adapters. It's why I'd like to see if we can get others to try to reproduce.
Closing this as not a usbdrvce bug. While not fixed entirely, increasing memory allotment to the stack makes the freeze take longer to occur, leading me to the belief its some sort of memory leak in my code or the pbuf allocator--or that it just needs more memory than it is being allotted.
May not be resolved by NCM fixes, but I'll wait for a fix for #482. I'll work on something like Expanse that is lower latency and see if it still occurs.
Reopening because I've identified at least what is happening but not why. Definitely not a dupe of the other bug. Enclosed a video of the issue. So it appears to occur after a period of a LOT of data hitting the endpoint (in this case the RX endpoint). After a while of this, the RX transfer callback return status is: USB_TRANSFER_CANCELED | USB_TRANSFER_BUS_ERROR. I retry that 3 times before the code assumes a stall and disables the device (to stop the leaking of memory that was previously occuring).
Unsure if this is a me issue or a usbdrvce issue. Can someone take a look please.
https://github.com/CE-Programming/toolchain/assets/6786323/9c7e3b83-1237-480e-9bab-631b2a0e3af8
So the issue is resolved with help from @commandblockguy. NCM requires the usb transfer be at least NTB_MAX bytes, not ETHERNET_MTU.
Issue: While the stack is running and the calculator is processing TX, RX, and Interrupt frames from an NCM device, out of nowhere there is a freeze/stall. It occurs within usb_HandleEvents() after execution of the user-defined callback function on processing event 13 (USB_DEVICE_INTERRUPT) in 100% of my reproduction attempts. Code triggering: https://github.com/cagstech/lwip-ce/blob/master/src/drivers/usb-ethernet.c#L724
Possible dupe of https://github.com/CE-Programming/toolchain/issues/482
My ability to debug/disassemble is limited as I can only test this on hardware and thus cannot use breakpoints, step through a disassembly, etc. I have added some print statements to try to work out where the freeze occurs, which is how I've figured out what I have. Trying to work on some minimum reproducible code but the tricky part with that is I'm not sure how reliant this issue is on the IP stack's timings/throughput to trigger. I may modify usbdrvce directly for some additional debug prints. Any other debugging suggestions welcome.
I'm still treating this as an NCM bug for now and working on resolving it as such, but should a resolution for #482 resolve this as well, great. https://github.com/cagstech/lwip-ce/issues/5