AnsweredAssumed Answered

UVC gadget on imx8mevk

Question asked by Han Z on Sep 30, 2019
Latest reply on Oct 11, 2019 by Han Z

Hello community,

 

We're trying to get UVC gadget working on imx8m-evk, without any success.
The system is initialized using "repo init -u https://source.codeaurora.org/external/imx/imx-manifest -b imx-linux-sumo -m imx-4.14.98-2.0.0_ga.xml"
  1. mipi cameras are verified using gstreamer
  2. usb gadget's configured with configfs:  mkdir /sys/kernel/config/usb_gadget/g1
    cd /sys/kernel/config/usb_gadget/g1
    mkdir configs/c.1
    mkdir strings/0x409
    mkdir configs/c.1/strings/0x409
    echo 0x3290 > idProduct
    echo 0x18ec > idVendor
    echo 0x0310 > bcdUSB
    echo serial > strings/0x409/serialnumber
    echo manufacturer > strings/0x409/manufacturer
    echo UVC Gadget > strings/0x409/product
    echo "Conf 1" > configs/c.1/strings/0x409/configuration
    echo 120 > configs/c.1/MaxPower
    mkdir functions/uvc.usb0
    mkdir -p functions/uvc.usb0/streaming/uncompressed/u/480p
    cat <<EOF > functions/uvc.usb0/streaming/uncompressed/u/480p/dwFrameInterval
    333333
    1000000
    5000000
    EOF
    echo 480 > functions/uvc.usb0/streaming/uncompressed/u/480p/wHeight
    echo 333333 > functions/uvc.usb0/streaming/uncompressed/u/480p/dwDefaultFrameInterval
    echo 614400 > functions/uvc.usb0/streaming/uncompressed/u/480p/dwMaxVideoFrameBufferSize
    echo 73728000 > functions/uvc.usb0/streaming/uncompressed/u/480p/dwMaxBitRate
    echo 24576000 > functions/uvc.usb0/streaming/uncompressed/u/480p/dwMinBitRate
    mkdir functions/uvc.usb0/streaming/header/h
    cd functions/uvc.usb0/streaming/header/h
    ln -s ../../uncompressed/u
    cd ../../class/fs
    ln -s ../../header/h
    cd ../../class/hs
    ln -s ../../header/h
    cd ../../class/ss
    ln -s ../../header/h
    cd ../../../control
    mkdir header/h
    ln -s header/h class/fs
    ln -s header/h class/hs
    ln -s header/h class/ss
    cd /sys/kernel/config/usb_gadget/g1
    echo 1024 > functions/uvc.usb0/streaming_maxpacket
    echo 15 > functions/uvc.usb0/streaming_maxburst
    ln -s functions/uvc.usb0 configs/c.1
    echo 38100000.dwc3 > UDC
  3. After running user space testing app(https://github.com/wlhe/uvc-gadget, with changes from 640x360 to 640x480 to match supported formats in ov5640_mipi_v2.c), imx8m-evk can be detected as a uvc device.
However, once I opened the UVC with VLC player, there's no video streaming.
After further investigation, I discovered that UVC video payload packets were not sent out successfully by ISO endpoints, usb_request.complete was never called.
dwc3_send_gadget_ep_cmd(dwc3/gadget.c) returns -EAGAIN, indicating an error status of 'Bus Expiry'. Data flow is: dwc3_endpoint_interrupt() => dwc3_gadget_start_isoc() => __dwc3_gadget_kick_transfer() => dwc3_send_gadget_ep_cmd()
We're running out of lead,
any help or information would be appreciated.

Outcomes