-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Long boot-up time #302
Comments
Afaik, this is a usb-power-management issue. This explicitly seems to be an lpc55s issue as this does not reproduce for the nRF52 variant for me. |
Swtiching off power management for my usb hub does not fix it for me. Is there perhaps another workaround? |
Could you try to to switch off any usb-related power-saving mechanisms using |
Is there a way I can help with this issue? |
For me it also looks like the
I've no idea (simply not done something like that yet) how to get more information out of the usb-subsystem to debug this, but my guess would be to first have a trace from a host we could compare against. @hw0lff did you try different usb ports (internal usb hubs) and you get the same results? |
I just now noticed I didn't mention that I have a NK-3A not a 3C. I'm sorry I didn't include this info earlier. I mostly have USB A 3.1 Ports and they behave the same: always a 5 second delay I just tested the USB-C Thunderbolt 3 port on my machine with the NK-3A plugged into a USB-A -> USB-C adapter. There it's just a 2-3 second delay until I see output in the kernel log. |
@daringer Just now I looked through sysfs and found this parameter: The default on my machine is 5000 (milliseconds). I don't think changing this manually is a fix, but for me it is a workaround until the underlying problem is properly solved. edit: formatting |
That's no problem, we see this happening on all lpc55s devices (means any NFC device) and we don't observe this on nRF52 based devices i.e., the NK3 Mini.
That's indeed interesting, my value is also 5000 - reducing this (and therefore the read-error) might imply that if Linux is asking more aggressively for the device descriptor it will succeed faster. This could mean that maybe the first sent descriptor is "lost" somehow, maybe even send too fast by the Nitrokey 3. That's for sure something to investigate more closely... |
Or the other way round: We somehow lose the first descriptor request, so we don’t send a response while the kernel is still waiting for it during this timeout. AFAIR when I tried to debug this, the device was idle during the delay so that would make sense. Edit: Nevermind, if it sent out the reply it would also be idle. |
I had another log at the logs from the init process: We actually do not receive the initial GET_DESCRIPTOR request. In fact, we do not receive any data at all until the timeout, i. e. the USB bus never returns Assuming that this is a timing issue, there are two naive interpretations:
|
Nevermind, I moved the USB init after the point where the pending timers were cancelled, so the timer was apparently activated again and spamming these interrupts. With this fixed, moving the USB init to the end actually solves the problem for me. Quick-and-dirty implementation: https://github.com/Nitrokey/nitrokey-3-firmware/tree/usb-init |
I can confirm, for me this also solves the issue on an nk3cn. |
This patch splits the NFC and USB initialization and moves the USB initialization to the end of the initialization process on the lpc55. This makes sure that we can respond to all USB requests as the poll task is started directly after the init process. Previously, we initialized the USB interface at the beginning of the process so that we could not respond to requests until the end of the init process. This could potentially mean that the device would lose the initial GET DESCRIPTOR request sent by the Linux kernel, causing a delay of typically 5 s after connecting the device. Fixes: #302
Nitrokey 3 C NFC v1.5 takes long time to boot up. Example system log:
Here around 6 seconds is taken before detection in port, and enumeration finish.
The text was updated successfully, but these errors were encountered: