Closed awatterott closed 6 years ago
Does it fix the issue for you? There's a separate limit on transmission length in sendCtrl(), but probably not related.
The modification fixes the string transmission problem. But there is still another problem, which can be reproduced with the USB Device Tree Viewer.
@mmoskal Could you reproduce the issue? We have made also a CDC+MSC bootloader, which is based directly on ASF and there we have no problems, but it is also much bigger. On our bootloader I have also not seen any limitations with CDC+MSC with or without installed drivers on a Windows OS.
Unfortunately I have no Windows machine to test it on right now...
From: Andreas Watterott notifications@github.com Sent: Monday, December 18, 2017 7:52:20 PM To: Microsoft/uf2-samd21 Cc: Michał Moskal; Mention Subject: Re: [Microsoft/uf2-samd21] USB problems (#30)
@mmoskalhttps://github.com/mmoskal Could you reproduce the issue? We have made also a CDC+MSC bootloaderhttps://github.com/watterott/SAM-BAR, which is based directly on ASF and there we have no problems, but it is also much bigger. On our bootloader I have also not seen any limitations with CDC+MSC with or without installed drivers on a Windows OS.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/Microsoft/uf2-samd21/issues/30#issuecomment-352539224, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AKLfOElK2k4m7ZpyCDW3sLWzExfoVCpIks5tBsJzgaJpZM4RFxoE.
@awatterott it's possible it's related to this:
I just did a fix in Codal. You can try to do something similar in bootloader and see if it works: https://github.com/lancaster-university/codal-samd21/commit/ed3d6de7c8836a4248a610e2ac986d807907746a
I made some progress. It has to do with the descriptor strings. If I remove all strings from the device descriptor then there are no issues.
The issue appears when the host tries to read string descriptors that do not exist. Under Windows for example the string with index 0xEE. Currently the STALL sending seems to make the problems. Here is a workaround, which I have tested on different Windows machines: https://github.com/awatterott/uf2-samd21/commit/96c1455dce83e7c2679dd9cad0a06412450e07ed
I have reviewed the USB issues with a hardware analyzer and the problem is, that a wrong string descriptor is sent after STALL. https://github.com/awatterott/uf2-samd21/commit/279da2a3824d44bf8e4d0f35321cb2b68dad37eb Should I create a PR for this?
@mmoskal Did you have time to look into this? I think it is important to fix the bug, because it will bring the device to freeze/hang.
@awatterott could you prepare a PR?
Sure, it is PR https://github.com/Microsoft/uf2-samd21/pull/33
We are currently testing the bootloader, but had some problems. For example the USB Descriptor Strings are not correct and if we access the USB device under Windows with the USB Device Tree Viewer then the USB mass storage device will not work after the access.
For the string problem, I think it is the transmitted length here: https://github.com/Microsoft/uf2-samd21/blob/master/src/cdc_enumerate.c#L779
sendCtrl(&desc, sizeof(StringDescriptor));
I think it should besendCtrl(&desc, desc.len);