USB Memory Resource Exhaustion with Multiple Cameras on Orin

Hello everyone,

I’ve encountered an issue when attempting to open three cameras on an Orin. I want to attach 3 HDMI-USB cards to an Orin and read them simultaneously. The warning I receive indicates that the USB memory resources are exhausted. I work on a “Jetson AGX Orin Developer Kit”.

When I try to stream 3 attached HDMI-USB cards I can only ever get the first two to work. the third one fails with the following errors:

$ GST_DEBUG=3 gst-launch-1.0 v4l2src device=/dev/video${vid_id} ! videoconvert ! videoscale add-borders=true ! x264enc tune=zerolatency bitrate=4000 speed-preset=fast key-int-max=10 ! rtph264pay ! udpsink host=${ip} port=${port}
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Redistribute latency...
0:00:00.055591177 76892 0xaaaad0ab92a0 ERROR         v4l2bufferpool gstv4l2bufferpool.c:678:gst_v4l2_buffer_pool_streamon:<v4l2src0:pool:src> error with STREAMON 28 (No space left on device)
0:00:00.055626473 76892 0xaaaad0ab92a0 ERROR             bufferpool gstbufferpool.c:559:gst_buffer_pool_set_active:<v4l2src0:pool:src> start failed
0:00:00.055687081 76892 0xaaaad0ab92a0 WARN                 v4l2src gstv4l2src.c:660:gst_v4l2src_decide_allocation:<v4l2src0> error: Failed to allocate required memory.
0:00:00.055696137 76892 0xaaaad0ab92a0 WARN                 v4l2src gstv4l2src.c:660:gst_v4l2src_decide_allocation:<v4l2src0> error: Buffer pool activation failed
0:00:00.055748713 76892 0xaaaad0ab92a0 WARN                 basesrc gstbasesrc.c:3292:gst_base_src_prepare_allocation:<v4l2src0> Subclass failed to decide allocation
0:00:00.055771401 76892 0xaaaad0ab92a0 WARN                 basesrc gstbasesrc.c:3072:gst_base_src_loop:<v4l2src0> error: Internal data stream error.
0:00:00.055778985 76892 0xaaaad0ab92a0 WARN                 basesrc gstbasesrc.c:3072:gst_base_src_loop:<v4l2src0> error: streaming stopped, reason not-negotiated (-4)
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed to allocate required memory.
Additional debug info:
gstv4l2src.c(660): gst_v4l2src_decide_allocation (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Buffer pool activation failed
Execution ended after 0:00:00.027432115
Setting pipeline to NULL ...
Freeing pipeline ...

(Reading the 3rd /dev/video* using OpenCV fails quietly.)

The following related warnings appear when checking dmesg:

[14619.557036] usb 1-4.3: Not enough bandwidth for new device state.
[14619.563373] usb 1-4.3: Not enough bandwidth for altsetting 3
[14619.626885] usb 1-4.3: Not enough bandwidth for new device state.
[14619.633186] usb 1-4.3: Not enough bandwidth for altsetting 3

So I assume there is a problem with the reading rate of the USB cards.

Upon inspecting the USBs, I found that all HDMI cards are connected to USB2.0. This is puzzling because the specifications mention that Orin should exclusively have USB3 ports. Here’s the output from lsusb -t:

orin002 $ lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=tegra-xusb/4p, 10000M
    |__ Port 3: Dev 2, If 0, Class=Hub, Driver=hub/4p, 10000M
        |__ Port 1: Dev 3, If 0, Class=Hub, Driver=hub/4p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=tegra-xusb/4p, 480M
    |__ Port 3: Dev 2, If 0, Class=Wireless, Driver=rtk_btusb, 12M
    |__ Port 3: Dev 2, If 1, Class=Wireless, Driver=rtk_btusb, 12M
    |__ Port 4: Dev 3, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 3: Dev 5, If 3, Class=Audio, Driver=snd-usb-audio, 480M
        |__ Port 3: Dev 5, If 1, Class=Video, Driver=uvcvideo, 480M
        |__ Port 3: Dev 5, If 4, Class=Human Interface Device, Driver=usbhid, 480M
        |__ Port 3: Dev 5, If 2, Class=Audio, Driver=snd-usb-audio, 480M
        |__ Port 3: Dev 5, If 0, Class=Video, Driver=uvcvideo, 480M
        |__ Port 1: Dev 4, If 0, Class=Hub, Driver=hub/4p, 480M
            |__ Port 4: Dev 7, If 4, Class=Human Interface Device, Driver=usbhid, 480M
            |__ Port 4: Dev 7, If 2, Class=Audio, Driver=snd-usb-audio, 480M
            |__ Port 4: Dev 7, If 0, Class=Video, Driver=uvcvideo, 480M
            |__ Port 4: Dev 7, If 3, Class=Audio, Driver=snd-usb-audio, 480M
            |__ Port 4: Dev 7, If 1, Class=Video, Driver=uvcvideo, 480M
            |__ Port 2: Dev 6, If 3, Class=Audio, Driver=snd-usb-audio, 480M
            |__ Port 2: Dev 6, If 1, Class=Video, Driver=uvcvideo, 480M
            |__ Port 2: Dev 6, If 4, Class=Human Interface Device, Driver=usbhid, 480M
            |__ Port 2: Dev 6, If 2, Class=Audio, Driver=snd-usb-audio, 480M
            |__ Port 2: Dev 6, If 0, Class=Video, Driver=uvcvideo, 480M

If I understand correctly, the 480M means USB2, right?

According to the above lsusb, there appears to be a USB3 hub on the device, but I’m struggling to determine how to connect anything to it. Currently, the USB-C ports are non-functional for me, and all USB-A connections result in the HDMI cards being listed under Bus01 (USB2)

Lastly, I wanted to check whether the reading-rate of 480M/s is in fact exceeded. confusingly, I found the following output from usbtop:

us ID 0 (Raw USB traffic, all USB buses)       To device       From device                                                                                                                                                           [0/1902]
  Device ID 1 :                 0.00 kb/s       0.00 kb/s
  Device ID 2 :                 0.00 kb/s       0.00 kb/s
  Device ID 3 :                 0.00 kb/s       0.00 kb/s
  Device ID 4 :                 0.00 kb/s       0.00 kb/s
  Device ID 5 :                 141.72 kb/s     18307.54 kb/s
  Device ID 6 :                 141.78 kb/s     18418.94 kb/s
  Device ID 7 :                 0.00 kb/s       0.00 kb/s
Bus ID 1 (Raw USB traffic, bus number 1)        To device       From device
  Device ID 1 :                 0.00 kb/s       0.00 kb/s
  Device ID 2 :                 0.00 kb/s       0.00 kb/s
  Device ID 3 :                 0.00 kb/s       0.00 kb/s
  Device ID 4 :                 0.00 kb/s       0.00 kb/s
  Device ID 5 :                 141.72 kb/s     18307.54 kb/s
  Device ID 6 :                 141.77 kb/s     18418.54 kb/s
  Device ID 7 :                 0.00 kb/s       0.00 kb/s
Bus ID 2 (Raw USB traffic, bus number 2)        To device       From device
  Device ID 1 :                 0.00 kb/s       0.00 kb/s
  Device ID 2 :                 0.00 kb/s       0.00 kb/s
  Device ID 3 :                 0.00 kb/s       0.00 kb/s

which seems to indicate that only 2x18MB/s are actually being read and piped through the USB2

I am grateful for any hints or pointers and am very happy to provide more details.
Thank you for your time and assistance!
Tobi

Your HDMI grabber devices are USB 2 High Speed Devices.

The USB2 D+/D- and the USB3 SSTX and SSRX lines are completely separated from each other. They are run parallel to each other, there are no interconnections between them at all. Even inside an USB3 hub D+/D- and SSTX/SSRX are handled separately. Unlike USB2 there are no transaction translators that translate USB2 traffic into USB3 traffic at all.

Furthermore the lsusb listing shows that all USB ports on the Orin share a single USB2 root hub. This means that all USB2 devices connected are limited to the 480M data rate the USB2 root hub provides. Period. You can’t exceeding this hard hardware limit, and you can’t circumvent this limit with software only.

There are ways around this.

  1. Add additional USB Adapters.
    Use this boards:
    Delock Produkte 62842 Delock Konverter M.2 Key B+M Stecker zu 1 x USB 5 Gbps Pfostenstecker
    You will need a board for each grabber. Each board brings its own root USB2 and USB3 hubs, so each grabber can use the full bandwidth of USB2.

  2. Use USB2->USB3 Transaction Translators.
    VIA Labs, Inc., VLI 威鋒電子股份有限公司
    This chip will translate an USB2 connection into an USB3 connection. You will need a chip for each grabber. By translating into USB3 connections your limit is the 5GBit/s limit of SuperSpeed.

  3. Use different grabbers - either USB3 grabbers, PCIe grabbers, or HDMI-CSI2 converter modules.

HDMI->CSI2:

PCIe:

They also support Jetson boards.

These are your options. You may choose one of them.

fchk

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.