tegra-xudc endpoint transfer mode

Hi, There

I’m trying to enable uvc gadget device on TX1 with tegra l4t 28.1, kernel 4.4. When the uvc_function_bind try to find a usb endpoint it always fails and it turns out the endpoint created by tegra_xudc are all bulk mode and f_uvc in kernel 4.4 want iso mode ep. Does anybody knows whether I can change ep created by xudc to iso mode?


The transfer modes for non-custom UVC are part of a standard. If your device says it is that class, then that’s what it uses. Otherwise it needs to be another class or a custom driver (if custom then I don’t think gadget will be of any use). Bulk transfer would tend to be part of mass storage or fixed image class, while isochronous would be for realtime video/audio. Think mass storage versus UVC/audio/video realtime. So it seems your gadget was probably set to a class not compatible with the device to be emulated and you need to change the gadget driver to the other class instead of trying to change transfer mode while keeping the same class.

thanks for the quick reply. Yes, uvc class by default only support isoc mode. The issue is on the tegra-xudc side, usb endpoints it creates only marks type bulk and int so uvc gadget bind would fail.
so my question is whether tegra udc can support isoc mode? if not, are there alternatives that I can enable isoc udc support?


The tegra drivers support all modes, but if you are using the gadget interface it is probably bound to the mode of standard class. The thing about cameras is that some can do both still picture and isochronous full motion, and both interfaces might be available on a single USB cable. For gadget framework I don’t know if it is capable of the equivalent of both modes (even in a real camera it doesn’t do both modes simultaneously, but it does offer to switch mode depending on interface used to talk to the camera).

A bit of information would be useful. Are you trying to pass through a real camera? Or make some function on the Jetson appear to be a camera? On another Linux machine what does the device show up as with “lsusb -vvv”? Is there a particular USB camera or device you can also list “lsusb -vvv” for to show what you want it to model?

I’m trying to make tegra l4t appears to be an uvc camera when connec to host machine. If I create mass storage or some other types of gadget using configfs/functionfs, they will show up properly on the host machine using lsusb. For uvc gadget nothing shows and kernel log shows the function_bind failed because the gadget driver cannot find suitable usb endpoints to enable the gadget. I traced into tegra_xudc.c and find all the endpoints it creates are of bulk and interrupt type.
Are there other udc drivers that I can use instead of tegra xudc? in the menuconfig if I don’t choose tegra_xudc then there is no entry under /sys/class/udc.
thanks and really appriciate your reply.

I don’t know enough about it to give you a checklist, but it sure sounds like the UVC customization needed in the gadget framework is insufficient. Since it is just a framework you must implement some of the functionality yourself or it is equivalent to part of the hardware being missing.

I don’t know about other drivers, but since the kernel works with actual UVC cameras I’d think the issue is in configuration which is unrelated to the driver. Without better knowledge of UVC within gadget (and what you must custom build) it may be you need a protocol analyzer to see what is missing. You might try the “usbmon” application, though it might take a steep learning curve. Here is some information which might or might not be of use in your case:

If someone else here has set up the gadget framework for isochronous UVC some sort of check list would be useful.

We haven’t get to the phy layer yet, the gadget driver exit from bind when it cannot find a usb device controller created endpoint that satisfy uvc’s requirement of isoc type usb endpoint.

Hi xiaoyongtijee,
We have confirmed it is not supported. XUDC controller does not support ISOC transfers.

Thanks for confirm Dane. Will it be added later? Without isoc mode we cannot support uvc devices and based on TRM the xudc controller seems is capable of all modes.

It is HW limitations, so cannot be supported. Please share what description in TRM confuses you. We will review/remove ambiguous content.

Here it is, it says the hardware support only 3 isochronous.

22.9.5 Endpoints
The device controller supports up to 32 endpoints (16 IN and 16 OUT). The endpoint 0 will be the control endpoint which effectively reduces the number of non-control endpoints to 15 IN and 15 OUT. However, the hardware will support only 3 isochronous endpoints locally in each direction and served concurrently. It is expected that the number of isochronous endpoints will be not be more than 2 during Tegra X1 frame time.

Hi xiaoyongtijee,
It is reviewed and confirmed to be wrong internally. It is corrected to be
The device controller supports up to 32 endpoints (16 IN and 16 OUT). The endpoint 0 will be the control endpoint which effectively reduces the number of non-control endpoints to 15 IN and 15 OUT.  Each endpoint can be set up as IN and OUT direction and as Control, Bulk, or Interrupt transfer type. Isochronous endpoint is not supported.

Thanks Dane.
Is this a limitation for Tk1 and tx2 as well or their UDC can support all modes?


TX2 does not support isochronous mode.
TK1 supports isochronous mode. Here is a topic https://devtalk.nvidia.com/default/topic/897531/

Hi, Dane

Based on some further investigation I find USB2 should have enough bandwidth for us. I see in TRM that tx1 has two usb 2.0 controllers. The controller#1 is by default for USB_OTG and in the document it says it support all transfer modes. Do you have instructions on how to enable this controller for the default usb2.0 otg port? Right now when I plug/unplug usb-otg the logs shows it is handled by tegra-xudc


The mode switch will differ between whether you have L4T R28.1 or newer, versus something older. Are you using R28.1? If R28.1 see:

I’m using r28.1. Yes, I’ve tried that and it works for otg, however the usb controller it used is still xudc. I’m looking at the dts files and it seems by default udc is disabled and otg goes through xudc. I’m wondering whether there are patch that shows how to config otg using udc. I’ll try to dig into the usb configuration guild as well.

Hi xiaoyongtijee, you may try if it works on r24.2.2

thanks Dane. I’ll try it on r24.2.2 first.
The reason I would like to move to r28.1/kernel 4.4 is it has full configfs and functionfs support for usb gadget and it makes composite usb device support super easy. So it will be great if we can config r28.1 to use usb controller one for otg.


Hi xiaoyongtijee,
If it works on r24.2.2(K3.10), you can try to port it to K4.4.

But it is not formally supported on r28.1. The document is corrected. Please be noted.