depthai: USB3 Doesn't Work with Raspberry Pi 4
Testing a slew of USB3 cables of various lengths between DepthAI: USB3 [Onboard Camera or FFC Camera] and a Raspberry Pi 4 results in hanging after Successfully initialized XLink!
message.
With USB2 cables, it always works.
There is some code in XLink host-side that tries to match the USB port numbers before and after boot (the idea is to connect multiple devices to a host). This code is flawed for some non-standard connection schemes, like it seems to be on RPi4:
USB2 (boot) address: 1-1.1
USB3 (app) address: 2-1
(that code tries to match 1.1 with 1)
On my laptop the USB addresses look like:
USB2 (boot) address: 1-1
USB3 (app) address: 2-1
So the matching works
The failing code is here: https://github.com/opencv/dldt/blob/2019_R3.1/inference-engine/thirdparty/movidius/XLink/pc/usb_boot.c#L321
We could implement a workaround (better place in XLink itself, but also possible in the host app code) to resolve this. Already tried hardcoding the expected port number, and depthai USB boot works fine
So when referring to the XLink SingleStream example, it looks like new API is used that no longer requires a mapping between USB port addresses (pre and post boot). Using this API in the host app will resolve our issue.
So it seems with this root cause (port-number matching), and the use of the new API (which doesn’t do port-number matching, we should be good to solve this problem.
We will just need to switch to the new API and make sure it doesn’t break anything else.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 28 (17 by maintainers)
Great! Closing this issue, which is specific to USB3 on the RPi4.
Yes on the fix_RPi4_USB3 branch it is working now with USB3!
Oh no worries that was like 10 minutes of Fusion 360. I can publish that fixture once tested, probably useful for others.
Got it. Thanks for confirming here as it had actually gone to SPAM. So just fished it out from there and all looks good to get this shipped out this week. 😃. Hopefully not too much trouble to remake the camera adapter you made for 3 cameras instead of 2.
Thanks Brandon thats a nice offer! I sent you a mail with the details.
Great! Thanks for the detailed info. Thats totally fair and I don’t think that this will pose an issue. If I were to collect that much data I would certainly use a higher-end machine for that. Right now the bug would be mostly a “why isn’t this working” issue, so maybe a small note in the guide or troubleshooting page would be useful.
So it depends on the use-case. Probably 3 categories:
So use-cases 1 and 2 aren’t impacted by USB2/USB3. The ~30MB/s that USB2 is capable of is enough. So the performance is identical (or at least we haven’t been able to measure a difference).
The case where USB 3 could be valuable is if you’re wanting to just record as much data as possible - say for future training. For example, we are using DepthAI in this mode for some internal training work - where we want to record every stream at highest possible resolution and FPS - so as to have this later should it be valuable.
So in this case USB2 just can’t keep up, as all the streams at full FPS sum to well over 30MB/s limit of USB2 - so USB3 is useful there.
That said this is somewhat of a ‘corner-case’ use, as usually you just want meta-data and a stream or two - so that your host isn’t inundated with video data.
And for cases where you want all the streams over USB2, we did just (as of Friday) introduce the capability to specify lower framerate selectively for each stream - to make it all fit over USB2.
Thoughts?
Thanks, Brandon
Ah if its just that. I plugged it into the USB2 ports of the Pi and that works! How much does that impact performance?