This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM572x USB2.0 throughput for USB-UVC

Other Parts Discussed in Thread: AM5728

Posting this on behalf of a customer

We are getting 60 Mbps bandwidth for AM5728 as an USB-UVC device (instead of 150 Mbps) . Please see following observations. Please let us know the USB configuration and solution.

Observations/tests:

1. AM5728 USB 2.0 Device (UVC)

         -- We are getting only 60 Mbps.

         -- We noticed the HW is just doing one transaction of 1 Kbytes  every 125 microsecond. 

             We tried to configure for three transactions and noticed that it is still sending one packet only and drops other two.

We have further following details for the issue of USB 2.0 as a device. 

 

The ep2 is used for video streaming.

       1. FIFO details           

               FIFO Reg value for ep2 is 0x184(by default), it is not changing after gadget driver loaded.       

 

        2. ep2 is using DMA (DMA allocates 512 size buffer)

 

        3.DWC3 Register files  (We need more details of the registers and recommended configuration for the higher bandwidth).

  • Bernd
    Can you please also elaborate further on the test setup and software used for this - is it based on AM572x GPEVM using ProcSDK/Linux? Please confirm.

    Regards
    Mukul
  • Bernd,

    "-- We noticed the HW is just doing one transaction of 1 Kbytes every 125 microsecond. "
    If the customer tests under Linux, this is expected, please note that the current kernel doesn't support high-bandwidth Isoch transfer yet. The community is working on getting the patches merged into next kernel v4.10.

    If you can let me know what kernel version the customer uses, I can try provide those patches for that kernel.

    The following message is confusing. Please ask if the customer changed the kernel specifically for this.
    "2. ep2 is using DMA (DMA allocates 512 size buffer)"
  • Bin,

    let me check and come back.

    Regards, Bernd
  • Bin,

    they are using  4.4.19  same as TI release.

    "2. ep2 is using DMA (DMA allocates 512 size buffer)" 
    ---This is default and we are not able to change it.

    Regards, Bernd

  • Bernd,

    The Linux kernel doesn't support high-bandwidth Isoch transfers in uvc gadget driver (g_webcam) yet, the community is working on it.

    The patches attached below enable high-bandwidth Isoch transfer on AM572x, but it is for evaluation only, since it is work-in-progress. (With these patches on TI 2016.05 I have to reboot the board after streamed the video once.)

    v4.4.y-g-uvc-dwc3.patch.tar.gz

  • Hi Bernd,

    Please find attached steps and logs of UVC gadget failures.

    Steps followed:
    
    1. Extracted the Linux SDK binary.
    Version - ti-processor-sdk-linux-am57xx-evm-03.01.00.06-Linux-x86-Install.bin
    
    2. Applied the given patches in v4.4.y-g-uvc-dwc3.patch.tar.xz (Which were sent
    		recently)
    
    3. Compiled the kernel and copied the modules to SD Card rootfs.
    
    4. Inserted the module g_webcam (packet size = 1024) and when the uvcgagdget 
    application is run kernel panics. Below is the log of kernel panic.
    
    This kernel panic is due to the workaround code of dwc3_gadget_pullup() function
    in gadget.c
    
    Log:
    
    [   27.599117] Modules linked in: g_webcam usb_f_uvc videobuf2_vmalloc libcomposite configfs dwc3 bc_example(O) rpmsg_proto rpmsg_pru rpmsg_rpc xhci_d
    
    [   27.625111]  xfrm4_tunnel ipcomp xfrm_ipcomp esp4 ah4 snd_soc_simple_card af_key xfrm_algo snd_soc_omap_hdmi_audio ecb sha512_generic sha512_arm td
    
    [   27.665716]  pixcir_i2c_ts extcon_palmas extcon mt9t11x rtc_palmas snd_soc_tlv320aic3x rtc_ds1307 omap_des omap_rng rng_core debugss_kmodule(O) om]
    [   27.691691] CPU: 0 PID: 1186 Comm: app Tainted: G           O    4.4.19-gdb0b54cdad #3
    [   27.699639] Hardware name: Generic DRA74X (Flattened Device Tree)
    [   27.705756] Backtrace: 
    [   27.708231] [<c00130e4>] (dump_backtrace) from [<c00132e0>] (show_stack+0x18/0x1c)
    [   27.715828]  r7:c09166d4 r6:200c0013 r5:00000000 r4:c0940d8c
    [   27.721542] [<c00132c8>] (show_stack) from [<c02b37cc>] (dump_stack+0x8c/0xa0)
    [   27.728794] [<c02b3740>] (dump_stack) from [<c0054698>] (__schedule_bug+0x54/0x64)
    [   27.736391]  r7:c09166d4 r6:c0912e00 r5:ec386c00 r4:00000000
    [   27.742097] [<c0054644>] (__schedule_bug) from [<c0663fb0>] (__schedule+0x55c/0x668)
    [   27.749869]  r5:ec386c00 r4:eed32e00
    [   27.753468] [<c0663a54>] (__schedule) from [<c0664110>] (schedule+0x54/0xc4)
    [   27.760542]  r10:ed8b9f5c r9:00000000 r8:ffff95a1 r7:c0916100 r6:ed8b9c6c r5:eed303c0
    [   27.768431]  r4:ed8b8000
    [   27.770979] [<c06640bc>] (schedule) from [<c0666fc4>] (schedule_timeout+0x118/0x1ac)
    [   27.778750]  r5:eed303c0 r4:eed303c0
    [   27.782350] [<c0666eac>] (schedule_timeout) from [<c0664e04>] (wait_for_common+0x90/0x140)
    [   27.790643]  r8:00000002 r7:ed8b8000 r6:ec6b2b44 r5:ec6b2b48 r4:0000000a
    [   27.797401] [<c0664d74>] (wait_for_common) from [<c0664ee4>] (wait_for_completion_timeout+0x14/0x18)
    [   27.806567]  r9:ec6b2b44 r8:55332209 r7:ec6b288c r6:ec6b2810 r5:00000000 r4:ec6b2970
    [   27.814426] [<c0664ed0>] (wait_for_completion_timeout) from [<bf1c3a54>] (dwc3_gadget_pullup+0x100/0x2e8 [dwc3])
    [   27.824672] [<bf1c3954>] (dwc3_gadget_pullup [dwc3]) from [<bf0f10a8>] (usb_function_activate+0xcc/0xe0 [libcomposite])
    [   27.835496]  r10:ed8b9f5c r9:ee426000 r8:d44f49c0 r7:ec6b2970 r6:600c0013 r5:ec20e45c
    [   27.843393]  r4:ec20e400
    [   27.845969] [<bf0f0fdc>] (usb_function_activate [libcomposite]) from [<bf1f40fc>] (uvc_function_connect+0x1c/0x3c [usb_f_uvc])
    [   27.857404]  r7:ed9b26c0 r6:ec6b3000 r5:ec6b3000 r4:ec20e400
    [   27.863131] [<bf1f40e0>] (uvc_function_connect [usb_f_uvc]) from [<bf1f4b40>] (uvc_v4l2_open+0x60/0x70 [usb_f_uvc])
    [   27.873608]  r5:ec6b3000 r4:edb9b780
    [   27.877222] [<bf1f4ae0>] (uvc_v4l2_open [usb_f_uvc]) from [<c048f294>] (v4l2_open+0xa4/0x108)
    [   27.885780]  r7:ed9b26c0 r6:ec6b3050 r5:ed9b26c0 r4:ec6b3000
    [   27.891494] [<c048f1f0>] (v4l2_open) from [<c01236b4>] (chrdev_open+0xac/0x180)
    [   27.898830]  r7:ed9b26c0 r6:ec7d5d40 r5:d44f49c0 r4:c06d1ff8
    [   27.904545] [<c0123608>] (chrdev_open) from [<c011d784>] (do_dentry_open+0x1e0/0x300)
    [   27.912404]  r8:00000000 r7:ec7d5d40 r6:c0123608 r5:ed9b26c8 r4:ed9b26c0
    [   27.919171] [<c011d5a4>] (do_dentry_open) from [<c011e8b0>] (vfs_open+0x60/0x88)
    [   27.926595]  r9:ee426000 r8:00000000 r7:00000000 r6:ed8b9eb0 r5:ed9b26c0 r4:ed8b9eb0
    [   27.934411] [<c011e850>] (vfs_open) from [<c012beb0>] (path_openat+0x17c/0xfb0)
    [   27.941748]  r5:00000000 r4:00000802
    [   27.945353] [<c012bd34>] (path_openat) from [<c012de74>] (do_filp_open+0x6c/0xd0)
    [   27.952863]  r10:00000000 r9:ed8b8000 r8:c000fbc4 r7:00000001 r6:ed8b9f5c r5:ed8b9eb0
    [   27.960757]  r4:00000003
    [   27.963306] [<c012de08>] (do_filp_open) from [<c011ec14>] (do_sys_open+0x118/0x1dc)
    [   27.970990]  r7:fffff000 r6:ec3bf000 r5:ffffff9c r4:00000003
    [   27.976704] [<c011eafc>] (do_sys_open) from [<c011ecf8>] (SyS_open+0x20/0x24)
    [   27.983866]  r9:ed8b8000 r8:c000fbc4 r7:00000005 r6:00000000 r5:00000000 r4:bee07a48
    [   27.991681] [<c011ecd8>] (SyS_open) from [<c000fa20>] (ret_fast_syscall+0x0/0x34)
    [   27.999451] Unable to handle kernel paging request at virtual address b6eb6c7c 
    
    Steps followed:
    
    1. Extracted the Linux SDK binary.
    Version - ti-processor-sdk-linux-am57xx-evm-03.01.00.06-Linux-x86-Install.bin
    
    2. Applied the given patches in v4.4.y-g-uvc-dwc3.patch.tar.xz (Which were sent
    		recently)
    
    3. Compiled the kernel and copied the modules to SD Card rootfs.
    
    4. Inserted the module g_webcam (packet size = 1024) and when the uvcgagdget 
    application. (Removed the workarount code in dwc3_gadget_pullup() function)
    
    Controller becomes unstable and after running it many times we can see the
    output on X86 side.
    
    We get the below error most of the times.
    
    [   88.541830] VS request completed with status -104.
    [   88.546648] VS request completed with status -104.
    [   88.553810] VS request completed with status -104.
    [   88.559410] VS request completed with status -104.
    
    Everytime we get the above error, we've to remove dwc3 module and g_webcam
    module and then start again
    
    We get one more message saying as mentioned below:
    
    [  248.423779] dwc3 488d0000.usb: request ec77b300 was not queued to ep2in
    [  248.430430] g_webcam gadget: uvc_function_set_alt(1, 0)
    [  248.430573] dwc3 488d0000.usb: request ec77bd80 was not queued to ep2in
    [  248.430579] dwc3 488d0000.usb: request ec77be00 was not queued to ep2in
    [  248.430584] dwc3 488d0000.usb: request ec77b400 was not queued to ep2in
    
    After several runs we can see the output and this is same with packet size 1024
    & 3072.
    

  • Chandra,

    Thanks for the report. I will take a look after the New Year. The holiday season starts now in here.

  • Chandra,

    Sorry for the delay. We solved the issue that the video streaming can only run once. It was a bug in the uvc-gadget.c application, not a bug in kernel. Please follow the detail below to evaluate it.

    The patches attached below is for TI 2016.06 kernel (tag ti2016.06 on git.ti.com). The patch 0001 and 0002 are the same as I sent last time. The patch 0003 is to revert a wrong patch from the community, and patch 0004 corrects it. Patch 0005 is a temporary workaround for the bug in dwc3_gadget_pullup().

    ti2016.06-g-uvc-dwc3.patch.tar.gz

    Next please apply the following patch to uvc-gadget.c application to solve the run-only-once issue.

    From 74e03eb4b8659b98ba1f4e11d919bf7e6ae07066 Mon Sep 17 00:00:00 2001
    From: Roger Quadros <rogerq@ti.com>
    Date: Fri, 3 Mar 2017 13:17:15 +0200
    Subject: [PATCH] uvc-gadget: Fix Set Interface (alternate setting) response
     behaviour
    
    On alternate setting change, webcam gadget sends us a UVC_EVENT_STREAMON
    or UVC_EVENT_STREAMOFF event. It expects delayed status response on
    STREAMON event only but doesn't expect us to send that response over USB.
    It sends the delayed response when we issue the VIDIOC_STREAMON ioctl.
    
    So we must not send UVCIOC_SEND_RESPONSE ioctl in these cases that too
    with invalid response length.
    
    Without this, the ISO streaming doesn't work if host application
    (e.g. luvcview) is closed and restarted.
    On dwc3 gadget controller it was resulting in Buffer Expiry error on
    the ISO endpoint.
    
    Signed-off-by: Roger Quadros <rogerq@ti.com>
    ---
     uvc-gadget.c | 4 ++--
     1 file changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/uvc-gadget.c b/uvc-gadget.c
    index f3807980c206..dd2fc06e2377 100644
    --- a/uvc-gadget.c
    +++ b/uvc-gadget.c
    @@ -595,12 +595,12 @@ uvc_events_process(struct uvc_device *dev)
     	case UVC_EVENT_STREAMON:
     		uvc_video_reqbufs(dev, 4);
     		uvc_video_stream(dev, 1);
    -		break;
    +		return;
     
     	case UVC_EVENT_STREAMOFF:
     		uvc_video_stream(dev, 0);
     		uvc_video_reqbufs(dev, 0);
    -		break;
    +		return;
     	}
     
     	ioctl(dev->fd, UVCIOC_SEND_RESPONSE, &resp);
    -- 
    1.9.1
    
    

  • Hi Bin,

    Thanks, 

    Does it take care of  high bandwidth configuration? (three transactions per isoc)

    Best Regards,

    Chandra

     

  • Chandra,

    Yes, it does so with patch 0001 and 0002 already. The update adds the fix to the issue that the test can only run once.

    The high-bandwidth runs fine, I see three transactions per SoF on the USB bus trace. It is just that the host luvcview application doesn't show the video as in the none high-bandwidth case. I guess it is the video format issue in uvc-gadget.c or luvcview. I believe our dev team is looking at it. And I don't think it is an big issue if the problem is in uvc-gadget.c (as long as kernel can transmit 3 transactions per SoF), since it is just an example code, and you would have to develop you own application.
  • We applied the patch and running the gadget application.
    We are getting black screen on luvc and VLC player(PC side).

    Please let us know your test setup.

    Thanks,
    Chandra
  • Just one more information. for above post.

    We see black screen issue once we enable high bandwidth. (three packets per isoch)

  • Chandrashekhar Rao said:
    We applied the patch and running the gadget application.
    We are getting black screen on luvc and VLC player(PC side).

    Please let us know your test setup.

    I guess you set streaming_maxpacket=3072? Please try to set it to 3062 instead.

  • Hi,

    We tried suggestion of set streaming_maxpacket=3062. We see the same problem. 

    root@am57xx-evm:~# modprobe g_webcam streaming_maxpacket=3062
    [ 331.676898] g_webcam gadget: uvc_function_bind
    [ 331.681635] g_webcam gadget: Webcam Video Gadget
    [ 331.686277] g_webcam gadget: g_webcam ready
    root@am57xx-evm:~# uvc-gadget -d /dev/video1 -i 1280x720.jpg
    uvc_open: open succeeded, file descriptor = 3
    uvc_open: device is dwc3-gadget on bus gadget
    [ 338.086771] g_webcam gadget: high-speed config #1: Video
    [ 338.092114] g_webcam gadget: uvc_function_set_alt(0, 0)
    [ 338.097359] g_webcam gadget: reset UVC Control
    [ 338.101828] g_webcam gadget: uvc_function_set_alt(1, 0)
    [ 338.107593] g_webcam gadget: uvc_function_set_alt(1, 0)
    uvc_events_process: UVC_EVENT_SETUP
    UVC_GET_MIN_MAX_DEF
    uvc_events_process: UVC_EVENT_SETUP
    UVC_SET_CUR
    uvc_events_process_data:
    1 0 1 1 2a 2c a 0 0 0 0 0 0 0 0 0 0 0 0 8 7 0 0 2 0 0 0 0 0 0 0 0 0 0 0
    uvc_events_process: UVC_EVENT_SETUP
    UVC_GET_CUR
    uvc_events_process: UVC_EVENT_SETUP
    uvc_events_process: UVC_EVENT_SETUP
    UVC_SET_CUR
    uvc_events_process_data:
    1 0 2 2 40 4b 4c 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    uvc_events_process: UVC_EVENT_SETUP
    UVC_GET_MIN_MAX_DEF
    uvc_events_process: UVC_EVENT_SETUP
    UVC_GET_MIN_MAX_DEF[ 342.588621] g_webcam gadget: uvc_function_set_alt(1, 1)

    uvc_events_process: UVC_EVENT_SETUP
    UVC_SET_CUR
    uvc_events_process_data:
    1 0 2 2 40 4b 4c 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    uvc_events_process: UVC_EVENT_SETUP
    UVC_GET_CUR
    uvc_events_process: UVC_EVENT_SETUP
    UVC_SET_CUR
    uvc_events_process_data:
    1 0 2 2 40 4b 4c 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    uvc_events_process: UVC_EVENT_SETUP
    UVC_GET_MIN_MAX_DEF
    uvc_events_process: UVC_EVENT_SETUP
    UVC_GET_MIN_MAX_DEF
    uvc_events_process: UVC_EVENT_SETUP
    UVC_SET_CUR
    uvc_events_process_data:
    1 0 2 2 40 4b 4c 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    uvc_events_process: UVC_EVENT_SETUP
    UVC_GET_CUR
    uvc_events_process: UVC_EVENT_SETUP
    UVC_SET_CUR
    uvc_events_process_data:
    1 0 2 2 40 4b 4c 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    uvc_events_process: UVC_EVENT_SETUP
    UVC_GET_MIN_MAX_DEF
    uvc_events_process: UVC_EVENT_SETUP
    UVC_GET_MIN_MAX_DEF
    uvc_events_process: UVC_EVENT_SETUP
    UVC_SET_CUR
    uvc_events_process_data:
    1 0 2 2 40 4b 4c 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    uvc_events_process: UVC_EVENT_SETUP
    UVC_GET_CUR
    uvc_events_process: UVC_EVENT_SETUP
    UVC_SET_CUR
    uvc_events_process_data:
    1 0 2 2 40 4b 4c 0 0 0 0 0 0 0 0 0 0 0 c1 dd 1 0 0 2 0 0 0 0 0 0 0 0 0 0 0
    uvc_events_process: UVC_EVENT_SETUP
    UVC_GET_MIN_MAX_DEF
    uvc_events_process: UVC_EVENT_SETUP
    UVC_GET_MIN_MAX_DEF
    uvc_events_process: UVC_EVENT_SETUP
    UVC_SET_CUR
    uvc_events_process_data:
    1 0 2 2 40 4b 4c 0 0 0 0 0 0 0 0 0 0 0 c1 dd 1 0 0 2 0 0 0 0 0 0 0 0 0 0 0
    uvc_events_process: UVC_EVENT_SETUP
    UVC_GET_CUR
    uvc_events_process: UVC_EVENT_SETUP
    UVC_SET_CUR
    uvc_events_process_data:
    1 0 2 2 20 a1 7 0 0 0 0 0 0 0 0 0 0 0 c1 dd 1 0 0 2 0 0 0 0 0 0 0 0 0 0 0
    144] g_webcam gadget: reset UVC
    uvc_events_process: UVC_EVENT_STREAMON---
    uvc_video_stream: Starting video stream.

  • Chandrashekhar Rao said:
    root@am57xx-evm:~# uvc-gadget -d /dev/video1 -i 1280x720.jpg

    Can you please try without '-i 1280x720.ipg'? Then uvc gadget sends a yuv format color bar video stream to the host. That was how I tested the uvc gadget.

  • We are still getting blank screen.  Please share uvcgadget application version tested and complete Linux image will be also helpful for validating

    Please also let us know the plan for official release with test reports.

    1. Commands Used

    root@am57xx-evm:~# ./uvcgadget  -d /dev/video1 -i 1280x720.jpg

    also tried (without i): root@am57xx-evm:~# ./uvcgadget  -d /dev/video1 1280x720.jpg

    2. Linux PC : luvcview player we are used.

    Terminal# luvcview   -d /dev/video0 -f MJPG -s 1280x720

    3. Details TI software we used:

    • Ti-SDK-version: ti-processor-sdk-linux-am57xx-evm-03.02.00.05
    • Linux-Kernel-Version:    linux-4.4.41
    • Patch : TiSitaraUSBPatch_03072017

    4.  Log attached

    root@am57xx-evm:~# ./uvcgadget  -d /dev/video1 1280x720.jpg 
    uvc_open: open succeeded, file descriptor = 3
    uvc_open: device is dwc3-gadget on bus gadget
    Bad address
    [  663.596761] g_webcam gadget: high-speed config #1: Video
    [  663.602108] g_webcam gadget: uvc_function_set_alt(0, 0)
    [  663.607354] g_webcam gadget: reset UVC Control
    [  663.611824] g_webcam gadget: uvc_function_set_alt(1, 0)
    [  663.617459] g_webcam gadget: uvc_function_set_alt(1, 0)
    uvc_events_process: UVC_EVENT_SETUP
    UVC_GET_MIN_MAX_DEF
    uvc_events_process: UVC_EVENT_SETUP
    UVC_SET_CUR
    uvc_events_process_data: 
    1 0 1 1 2a 2c a 0 0 0 0 0 0 0 0 0 0 0 0 8 7 0 0 2 0 0 0 0 0 0 0 0 0 0 0 
    uvc_events_process: UVC_EVENT_SETUP
    UVC_GET_CUR
    uvc_events_process: UVC_EVENT_SETUP
    uvc_events_process: UVC_EVENT_SETUP
    uvc_events_process: UVC_EVENT_SETUP
    uvc_events_process: UVC_EVENT_SETUP
    uvc_events_process: UVC_EVENT_SETUP
    uvc_events_process: UVC_EVENT_SETUP
    UVC_SET_CUR
    uvc_events_process_data: 
    1 0 2 2 40 4b 4c 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
    uvc_events_process_data: WARNING: MJPEG requested and no image loaded.
    uvc_events_process: UVC_EVENT_SETUP
    UVC_GET_MIN_MAX_DEF
    uvc_events_process: UVC_EVENT_SETUP
    UVC_GET_MIN_MAX_DEF
    uvc_events_process: UVC_EVENT_SETUP
    UVC_SET_CUR
    uvc_events_process_data: [  676.640317] g_webcam gadget: uvc_function_set_alt(1, 1)
    [  676.660790] g_webcam gadget: reset UVC
    
    1 0 2 2 40 4b 4c 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0  0 0 0 0 
    uvc_events_process_data: WARNING: MJPEG requested and no image loaded.
    uvc_events_process: UVC_EVENT_SETUP
    UVC_GET_CUR
    uvc_events_process: UVC_EVENT_SETUP
    UVC_SET_CUR
    uvc_events_process_data: 
    1 0 2 2 40 4b 4c 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
    uvc_events_process_data: WARNING: MJPEG requested and no image loaded.
    uvc_events_process: UVC_EVENT_SETUP
    UVC_GET_MIN_MAX_DEF
    uvc_events_process: UVC_EVENT_SETUP
    UVC_GET_MIN_MAX_DEF
    uvc_events_process: UVC_EVENT_SETUP
    UVC_SET_CUR
    uvc_events_process_data: 
    1 0 2 2 40 4b 4c 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
    uvc_events_process_data: WARNING: MJPEG requested and no image loaded.
    uvc_events_process: UVC_EVENT_SETUP
    UVC_GET_CUR
    uvc_events_process: UVC_EVENT_SETUP
    UVC_SET_CUR
    uvc_events_process_data: 
    1 0 2 2 40 4b 4c 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
    uvc_events_process_data: WARNING: MJPEG requested and no image loaded.
    uvc_events_process: UVC_EVENT_SETUP
    UVC_GET_MIN_MAX_DEF
    uvc_events_process: UVC_EVENT_SETUP
    UVC_GET_MIN_MAX_DEF
    uvc_events_process: UVC_EVENT_SETUP
    UVC_SET_CUR
    uvc_events_process_data: 
    1 0 2 2 40 4b 4c 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
    uvc_events_process_data: WARNING: MJPEG requested and no image loaded.
    uvc_events_process: UVC_EVENT_SETUP
    UVC_GET_CUR
    uvc_events_process: UVC_EVENT_SETUP
    UVC_SET_CUR
    uvc_events_process_data: 
    1 0 2 2 40 4b 4c 0 0 0 0 0 0 0 0 0 0 0 0 20 1c 0 0 2 0 0 0 0 0 0 0 0 0 0 0 
    uvc_events_process_data: WARNING: MJPEG requested and no image loaded.
    uvc_events_process: UVC_EVENT_SETUP
    UVC_GET_MIN_MAX_DEF
    uvc_events_process: UVC_EVENT_SETUP
    UVC_GET_MIN_MAX_DEF
    uvc_events_process: UVC_EVENT_SETUP
    UVC_SET_CUR
    uvc_events_process_data: 
    1 0 2 2 40 4b 4c 0 0 0 0 0 0 0 0 0 0 0 0 20 1c 0 0 2 0 0 0 0 0 0 0 0 0 0 0 
    uvc_events_process_data: WARNING: MJPEG requested and no image loaded.
    uvc_events_process: UVC_EVENT_SETUP
    UVC_GET_CUR
    uvc_events_process: UVC_EVENT_SETUP
    UVC_SET_CUR
    uvc_events_process_data: 
    1 0 2 2 20 a1 7 0 0 0 0 0 0 0 0 0 0 0 0 20 1c 0 0 2 0 0 0 0 0 0 0 0 0 0 0 
    uvc_events_process_data: WARNING: MJPEG requested and no image loaded.
    0] ------------[ cut here ]------------
    vuc_events_process: UVC_EVENT_STREAMON---
    uvc_video_stream: Staring video stream.
    uvc_video_stream: Queueing buffer 0.
    [  676.866134] WARNING: CPU: 0 PID: 1170 at drivers/media/v4l2-core/videobuf2-v4l2.c:139 __fill_vb2_buffer+0x444/0x4bc()
    [  676.887436] Modules linked in: g_webcam usb_f_uvc libcomposite configfs videobuf2_vmalloc videobuf_core bluetooth xhci_plat_hcd xhci_hcd usg
    [  676.946079] CPU: 0 PID: 1170 Comm: uvcgadget Not tainted 4.4.41-03567-g7c580a5-dirty #1
    [  676.954112] Hardware name: Generic DRA74X (Flattened Device Tree)
    [  676.960225] Backtrace: 
    [  676.962691] [<c00130f8>] (dump_backtrace) from [<c00132f4>] (show_stack+0x18/0x1c)
    [  676.970288]  r7:c04a11b4 r6:600f0013 r5:00000000 r4:c0940e0c
    [  676.975998] [<c00132dc>] (show_stack) from [<c02b46ac>] (dump_stack+0x8c/0xa0)
    [  676.983252] [<c02b4620>] (dump_stack) from [<c0034a1c>] (warn_slowpath_common+0x88/0xb8)
    [  676.991371]  r7:c04a11b4 r6:0000008b r5:00000009 r4:00000000
    [  676.997080] [<c0034994>] (warn_slowpath_common) from [<c0034af0>] (warn_slowpath_null+0x24/0x2c)
    [  677.005897]  r8:c095b68c r7:bf309978 r6:eea43e30 r5:eca7ea00 r4:eea43e30
    [  677.012659] [<c0034acc>] (warn_slowpath_null) from [<c04a11b4>] (__fill_vb2_buffer+0x444/0x4bc)
    [  677.021393] [<c04a0d70>] (__fill_vb2_buffer) from [<c049e1cc>] (__buf_prepare+0xe4/0x150)
    [  677.029600]  r8:c095b68c r7:bf309978 r6:eea43e30 r5:eca7ea00 r4:c04a0d70
    [  677.036360] [<c049e0e8>] (__buf_prepare) from [<c049e444>] (vb2_core_qbuf+0x130/0x1e0)
    [  677.044305]  r5:eca7ea00 r4:ebed3490
    [  677.047906] [<c049e314>] (vb2_core_qbuf) from [<c04a0208>] (vb2_internal_qbuf+0x38/0x3c)
    [  677.056025]  r7:bf309978 r6:eca14d80 r5:ebed3490 r4:eea43e30
    [  677.061732] [<c04a01d0>] (vb2_internal_qbuf) from [<c04a0824>] (vb2_qbuf+0x38/0x58)
    [  677.069415]  r5:ebed3490 r4:ebed3344
    [  677.073027] [<c04a07ec>] (vb2_qbuf) from [<bf3053b4>] (uvcg_queue_buffer+0x14/0x4c [usb_f_uvc])
    [  677.081775] [<bf3053a0>] (uvcg_queue_buffer [usb_f_uvc]) from [<bf3058b4>] (uvc_v4l2_qbuf+0x28/0x3c [usb_f_uvc])
    [  677.091988]  r5:eea43e30 r4:ebed3344
    [  677.095596] [<bf30588c>] (uvc_v4l2_qbuf [usb_f_uvc]) from [<c048e068>] (v4l_qbuf+0x44/0x48)
    [  677.103976]  r5:eea43e30 r4:edde9000
    [  677.107576] [<c048e024>] (v4l_qbuf) from [<c048d728>] (__video_do_ioctl+0x2c0/0x334)
    [  677.115347]  r7:c048e024 r6:ebed3000 r5:c044560f r4:00000003
    [  677.121053] [<c048d468>] (__video_do_ioctl) from [<c048d15c>] (video_usercopy+0x1d4/0x4c4)
    [  677.129347]  r10:00000003 r9:bea8e874 r8:eea43e30 r7:00000000 r6:00000044 r5:00000044
    [  677.137237]  r4:c044560f
    [  677.139784] [<c048cf88>] (video_usercopy) from [<c048d464>] (video_ioctl2+0x18/0x1c)
    [  677.147554]  r10:00000000 r9:eea42000 r8:ebed335c r7:bea8e874 r6:c044560f r5:edde9000
    [  677.155443]  r4:ebed3000
    [  677.157990] [<c048d44c>] (video_ioctl2) from [<c04883c4>] (v4l2_ioctl+0xa8/0xe0)
    [  677.165417] [<c048831c>] (v4l2_ioctl) from [<c0130b28>] (do_vfs_ioctl+0x3f0/0x614)
    [  677.173013]  r9:eea42000 r8:bea8e874 r7:00000003 r6:edde9000 r5:ebdf7d40 r4:bea8e874
    [  677.180818] [<c0130738>] (do_vfs_ioctl) from [<c0130d88>] (SyS_ioctl+0x3c/0x64)
    [  677.188154]  r10:00000000 r9:eea42000 r8:bea8e874 r7:c044560f r6:edde9000 r5:00000003
    [  677.196043]  r4:edde9001
    [  677.198591] [<c0130d4c>] (SyS_ioctl) from [<c000fa20>] (ret_fast_syscall+0x0/0x34)
    [  677.206186]  r9:eea42000 r8:c000fbc4 r7:00000036 r6:00000000 r5:00000000 r4:bea8eb88
    [  677.215559] ---[ end trace 26f5486ef30383a2 ]---
    [  677.220209] use of bytesused == 0 is deprecated and will be removed in the future,
    [  677.227828] use the actual size instead.
    vuc_video_stream: Queueing buffer 1.
    uvc_video_stream: Queueing bffer 2.
    uvc_video_stream: Queueing buffer 3.
    uvc_video_stream: Streamon success
    

  • The uvcgadget application is downloaded from git://git.ideasonboard.org/uvc-gadget.git, then apply the patch "0001-uvc-gadget-Fix-Set-Interface-alternate-setting-respo.patch.txt" I shared before to solve the  run-only-once issue.

    On the evm, assuming the uvcgadget video node is /dev/video1:

    root@am57xx-evm:~# modprobe g_webcam streaming_maxpacket=3062
    root@am57xx-evm:~# ./uvcgadget  -d /dev/video1

    On host PC:

    $ luvcview -d /dev/video1 -f yuv -s 640x360
  • Hi Bin,

    Could check my earlier request for providing SDCard imaage and complete package and it was also discussed in last meeting?
    However, We have checked your suggestion and could not get any success.

    For new application we are not able to stream at Gadget side itself and getting Error “Unable to dequeue buffer: Invalid argument (22)”



    Board# ./uvcgadget -d /dev/video1 -i 1280x720.jpg
    open succeeded, file descriptor = 3
    device is dwc3-gadget on bus gadget
    Unable to dequeue buffer: Invalid argument (22).

    Board# ./uvcgadget -d /dev/video1
    open succeeded, file descriptor = 3
    device is dwc3-gadget on bus gadget
    Unable to dequeue buffer: Invalid argument (22).
  • Chandra,

    So you only have such problem when using streaming_maxpacket=3062, but streaming works fine when not using high-bandwidth ISO?

    I will prepare a SD card image and share with you. I have to create one as I only use NFS boot in my work.
  • Chandra,

    I have shared you the link for downloading the SD card image. The share expires in 7 days. The image is created from a 16GB SD card. Please unzip it and dd to your SD card.

    I just noticed I also have the following patch for uvc-gadget.c to prevent console message flooding, but I don't think it should have any function change.

    diff --git a/uvc-gadget.c b/uvc-gadget.c
    index cd94164b9df3..f3807980c206 100644
    --- a/uvc-gadget.c
    +++ b/uvc-gadget.c
    @@ -157,8 +157,6 @@ uvc_video_process(struct uvc_device *dev)
            buf.memory = V4L2_MEMORY_MMAP;
     
            if ((ret = ioctl(dev->fd, VIDIOC_DQBUF, &buf)) < 0) {
    -               printf("Unable to dequeue buffer: %s (%d).\n", strerror(errno),
    -                       errno);
                    return ret;
            }
    
    
  • Bin,

    here the feedback:

    We have received the prebuilt SD Card image and could not get bandwidth higher than 61 Mbps. Could you check with app engineer to see problem again? We are quite urgent on USB2.0 issue.

    Can you please check.

    Regards,
    Bernd

     

  • Bernd,

    How the bandwidth is measured? 61Mbps sounds like high-bandwidth not enabled, what is the command line to load g_webcam.ko? Does the customer checked if there are 3 packets per SOF using USB bus analyzer?

    The usb traffic should be 3062 bytes per SOF, so it is about 196Mbps (3062bytes * 8SOF * 1000ms * 8bits).
  • Hi Bin,

    1.      Using default maxpacket size  during modprobe g_webcam (modprobe g_webcam), then we are able to stream for 360p only but not able to stream for 720p.

                       Please find the logs for 720p in attached tar file(“without_maxpkt_g_webcam"). 

    without_maxpkt_g_webcam/
    |-- 720p_gadget_logs.txt
    `-- 720p_PC_logs.txt 

    2.      If we are passing maxpacket parameter during modprobe g_webcam (modprobe g_webcam streaming_maxpacket=3062 and 3072), then we are not able to stream for both 360p and 720p.

                        With 720p  we are getting Aborted(core-dumped) on pc sides. Please find the logs in attached "with_maxpkt_g_webcam" compressed folder.  

    with_maxpkt_g_webcam/
    |-- 360p_maxpkt_describe.txt
    |-- 720p_gadget_logs.txt
    `-- 720p_pc_logs.txt

      3.      For 360p, the throughput is 61 Mbps. It seems that maxpacket command has no impact. Can TI check maxpacket work and validated on the USB bus as well? 

    Please note that earlier patches worked for higher bandwidth but it was never stable and low bandwidth was OK. Please also note that we spend couple of days just  to check and debug  pre-built binary.  It seems that the provided SD card binary does not have setup for higher bandwidth. We would need to test with 1080p MJPEG having bandwidth around 150 Mbps.

    This is the main reason for requesting Complete tested release with your test report, which will help everyone working on the project. 

    I am not able to upload logs on this site. I can send logs to Bin directly.  

  • Hi Chandra,

    I got your logs, but I cannot see much failure from the logs.
    Can you please try not use jpeg format, to at least reproduce what I have?
    I have posted the commands before in this thread for both evm board and host PC.
  • And you don't need 1080p MPJEG to check high bandwidth (and mjpeg format hasn't be validated), streaming_maxpacket=3062 with yuv format will prove it. The binary I sent has all the patches we provided.
  • I agree with you that we do not need 1080p MJPEG to test bandwidth. We have used suggested format and found it chokes at 61 Mbps. Unfortunately, Our requirement is 1080p MJPEG. Can you confirm by checking USB traffic that it is capable of at least 150 Mbps at your end in your test setup?
  • Yes, luvcview reports 53fps when streaming_maxpacket=3062, which is about 195Mbps (53fps*640*360*2*8).

    Following is the screenshot of the USB bus analyzer which also shows the USB bus bandwidth is 197Mbps for a 5-secs capture.

  • Are you using USB 3.0 port?
  • No, usb2.0.

    [2433515.836818] usb 3-3: new high-speed USB device number 7 using xhci_hcd
    [2433515.853603] usb 3-3: New USB device found, idVendor=1d6b, idProduct=0102
    [2433515.853608] usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
    [2433515.853611] usb 3-3: Product: Webcam gadget
    [2433515.853613] usb 3-3: Manufacturer: Linux Foundation
    [2433515.874585] uvcvideo: Found UVC 1.00 device Webcam gadget (1d6b:0102)
    [2433515.882090] input: Webcam gadget as /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3:1.0/input/input23
    [2433515.901276] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: -32 (exp. 2).
    [2433515.901372] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: -32 (exp. 2).
    [2433515.901471] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: -32 (exp. 2).
    [2433515.901573] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: -32 (exp. 2).
    [2433570.974930] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: -32 (exp. 2).
    [2434561.119717] usb 3-3: USB disconnect, device number 7
    
  • To close this thread, the 720P jpeg streaming using Isoch high-bandwidth mode has been validated as following.

    On board:
    # modprobe g_webcam streaming_maxpacket=3062
    # ./uvc-gadget -i pic-720p.jpg

    On Host:
    $ cvlc v4l2:///dev/video1:chroma=mjpg:width=1280:height=720

    luvcview v0.2.6 crashes with error "Floating point exception" when trying to stream this video, so cvlc is used instead.