EB-SS928 UVC调试

EB-SS928 UVC调试 艾编程的鲁小班 2023-03-11 14:16:08 793

1,查看当前板子硬件图


找到J11对应的原理图

通过硬件手册确定复用关系

查看相关寄存器功能描述


USB3.0-HOST 0x1030_0000
USB3.0-DRD 0x1032_0000
Offset Address: 0xC110
PERI_USB3_GCTL 2'b10 Device

2,确定编译配置文件


以及menuconfig 的UVC配置项是否有开

按<手册UAC开发参考.pdf> <UVC+UAC解决方案应用指导.pdf>配置并编译好系统。

3,修改系统配置文件

vi /etc/profile

export VID="0x1234"
export PID="0x0001"
export MANUFACTURER="Xxxx"
export PRODUCT="Camera"
export SERIALNUMBER="12345678"
export YUV="360p"
export MJPEG="360p 720p 1080p"
export H264="360p 720p 1080p"

4,执行脚本

ConfigUVC.sh

#!/bin/sh

set -ex 
######################################################
# set_resolution()  fill resoluton
# $1 formats
# $2 base_path
# $3 0 or 1: means need fill dwMaxVideoFrameBufferSize
# $4 format name string
#######################################################
function set_resolution()
{
    for i in $1
    do
        echo "$i"
        case $i in
        "360p")
            mkdir $2/360p/
            echo -e "333333" > $2/360p/dwFrameInterval
            echo "333333" > $2/360p/dwDefaultFrameInterval
            echo "29491200" > $2/360p/dwMaxBitRate
            if [ $3 -eq 1 ]; then
                echo "460800" > $2/360p/dwMaxVideoFrameBufferSize
            fi
            echo "29491200" > $2/360p/dwMinBitRate
            echo "360" > $2/360p/wHeight
            echo "640" > $2/360p/wWidth
            ;;
        "720p")
            mkdir $2/720p/
            echo -e "333333" > $2/720p/dwFrameInterval
            echo "333333" > $2/720p/dwDefaultFrameInterval
            echo "29491200" > $2/720p/dwMaxBitRate
            if [ $3 -eq 1 ]; then
                echo "1843200" > $2/720p/dwMaxVideoFrameBufferSize
            fi
            echo "29491200" > $2/720p/dwMinBitRate
            echo "720" > $2/720p/wHeight
            echo "1280" > $2/720p/wWidth
            ;;
        "1080p")
            mkdir $2/1080p/
            echo -e "333333"> $2/1080p/dwFrameInterval
            echo "333333" > $2/1080p/dwDefaultFrameInterval
            echo "29491200" > $2/1080p/dwMaxBitRate
            if [ $3 -eq 1 ]; then
                echo "4147200" > $2/1080p/dwMaxVideoFrameBufferSize
            fi
            echo "29491200" > $2/1080p/dwMinBitRate
            echo "1080" > $2/1080p/wHeight
            echo "1920" > $2/1080p/wWidth
            ;;
        "2160p")
            mkdir $2/2160p/
            echo -e "333333" > $2/2160p/dwFrameInterval
            echo "333333" > $2/2160p/dwDefaultFrameInterval
            echo "29491200" > $2/2160p/dwMaxBitRate
            if [ $3 -eq 1 ]; then
                echo "16588800" > $2/2160p/dwMaxVideoFrameBufferSize
            fi
            echo "29491200" > $2/2160p/dwMinBitRate
            echo "2160" > $2/2160p/wHeight
            echo "3840" > $2/2160p/wWidth
            ;;
        *)
            echo "$4 $i is invalid!"
            ;;
        esac
    done
}

######################################################
# set_format()  fill format
# no argument
#######################################################
function set_format()
{
    #YUV
    if [ -n "$YUYV" ]; then
        echo "Add YUYV..."
        mkdir streaming/uncompressed/yuy2/
        echo -en "\x59\x55\x59\x32\x00\x00\x10\x00\x80\x00\x00\xaa\x00\x38\x9b\x71" > streaming/uncompressed/yuy2/guidFormat
        echo 16 > streaming/uncompressed/yuy2/bBitsPerPixel

        set_resolution "$YUYV" streaming/uncompressed/yuy2/ 1 "YUYV"

        ln -s streaming/uncompressed/yuy2/ streaming/header/h/
        echo -e "Added YUYV\n"
    fi

    #NV21
    if [ -n "$NV21" ]; then
        echo "Add NV21..."
        mkdir streaming/uncompressed/nv21/
        echo -en "\x4E\x56\x32\x31\x00\x00\x10\x00\x80\x00\x00\xaa\x00\x38\x9b\x71" > streaming/uncompressed/nv21/guidFormat
        echo 12 > streaming/uncompressed/nv21/bBitsPerPixel

        set_resolution "$NV21" streaming/uncompressed/nv21/ 1 "NV21"

        ln -s streaming/uncompressed/nv21/ streaming/header/h/
        echo -e "Added NV21\n"
    fi

    #NV12
    if [ -n "$NV12" ]; then
        echo "Add NV12..."
        mkdir streaming/uncompressed/nv12/
        echo -en "\x4E\x56\x31\x32\x00\x00\x10\x00\x80\x00\x00\xaa\x00\x38\x9b\x71" > streaming/uncompressed/nv12/guidFormat
        echo 12 > streaming/uncompressed/nv12/bBitsPerPixel

        set_resolution "$NV12" streaming/uncompressed/nv12/ 1 "NV12"

        ln -s streaming/uncompressed/nv12/ streaming/header/h/
        echo -e "Added NV12\n"
    fi

    #MJPEG
    if [ -n "$MJPEG" ]; then
        echo "Add MJPEG..."
        mkdir streaming/mjpeg/m/

        set_resolution "$MJPEG" streaming/mjpeg/m/ 1 "MJPEG"

        ln -s streaming/mjpeg/m/ streaming/header/h/
        echo -e "Added MJPEG\n"
    fi

    #H264
    if [ -n "$H264" ]; then
        echo "Add H264..."
        mkdir streaming/framebased/h264/
        echo -en "\x48\x32\x36\x34\x00\x00\x10\x00\x80\x00\x00\xaa\x00\x38\x9b\x71" > streaming/framebased/h264/guidFormat

        set_resolution "$H264" streaming/framebased/h264/ 0 "H264"

        ln -s streaming/framebased/h264/ streaming/header/h/
        echo -e "Added H264\n"
    fi

    #HEVC aka H265
    if [ -n "$H265" ]; then
        echo "Add HEVC(H265)..."
        mkdir streaming/framebased/h265/
        echo -en "\x48\x32\x36\x35\x00\x00\x10\x00\x80\x00\x00\xaa\x00\x38\x9b\x71" > streaming/framebased/h265/guidFormat

        set_resolution "$H265" streaming/framebased/h265/ 0 "HEVC(H265)"

        ln -s streaming/framebased/h265/ streaming/header/h/
        echo -e "Added HEVC(H265)\n"
    fi
}

mount -t configfs none /sys/kernel/config/
cd /sys/kernel/config/usb_gadget/
mkdir camera
cd camera

echo "0x01" > bDeviceProtocol
echo "0x02" > bDeviceSubClass
echo "0xEF" > bDeviceClass
echo $VID > idVendor
echo $PID > idProduct
mkdir strings/0x409
echo $MANUFACTURER > strings/0x409/manufacturer
echo $PRODUCT > strings/0x409/product
echo $SERIALNUMBER > strings/0x409/serialnumber

mkdir functions/uvc.usb0
cd functions/uvc.usb0
mkdir control/header/h/
echo "0x0110" > control/header/h/bcdUVC
echo "48000000" > control/header/h/dwClockFrequency
ln -s control/header/h/ control/class/fs/
ln -s control/header/h/ control/class/ss/

cat <<EOF> control/terminal/camera/default/bmControls
$CamControl1
$CamControl2
$CamControl3
EOF

cat <<EOF> control/processing/default/bmControls
$ProcControl1
$ProcControl2
EOF

mkdir streaming/header/h/

set_format

ln -s streaming/header/h/ streaming/class/fs/
ln -s streaming/header/h/ streaming/class/hs/
ln -s streaming/header/h/ streaming/class/ss/

#-Create and setup configuration
cd ../../

mkdir functions/uac1.usb0

mkdir configs/c.1/
echo "0x01" > configs/c.1/MaxPower
echo "0xc0" > configs/c.1/bmAttributes
mkdir configs/c.1/strings/0x409/
echo "Config 1" > configs/c.1/strings/0x409/configuration

ln -s functions/uvc.usb0/ configs/c.1/
ln -s functions/uac1.usb0/ configs/c.1/

echo "$(ls /sys/class/udc)" > UDC

创建/dev/video0文件节点

5,执行sample_uvc

6,使用Win10自带软件或AMCap

相机-点击切换


7,注意:

其它问题看:https://www.ebaina.com/ask/100000050095
EB-SS928,使用3段式耳机,用一般手机通过的四段耳机无法录到声音。

声明:本文内容由易百纳平台入驻作者撰写,文章观点仅代表作者本人,不代表易百纳立场。如有内容侵权或者其他问题,请联系本站进行删除。
红包 2 3 评论 打赏
评论
1个
内容存在敏感词
手气红包
  • 西门大人 2023-06-08 11:38:18
    回复
    楼主,你好,请问这个是usb2.0的uvc device吗?可以支持到usb3.0吗?我当前通过手册,2.0调通了,但3.0通不了。
相关专栏
置顶时间设置
结束时间
删除原因
  • 广告/SPAM
  • 恶意灌水
  • 违规内容
  • 文不对题
  • 重复发帖
打赏作者
易百纳技术社区
艾编程的鲁小班
您的支持将鼓励我继续创作!
打赏金额:
¥1易百纳技术社区
¥5易百纳技术社区
¥10易百纳技术社区
¥50易百纳技术社区
¥100易百纳技术社区
支付方式:
微信支付
支付宝支付
易百纳技术社区微信支付
易百纳技术社区
打赏成功!

感谢您的打赏,如若您也想被打赏,可前往 发表专栏 哦~

举报反馈

举报类型

  • 内容涉黄/赌/毒
  • 内容侵权/抄袭
  • 政治相关
  • 涉嫌广告
  • 侮辱谩骂
  • 其他

详细说明

审核成功

发布时间设置
发布时间:
是否关联周任务-专栏模块

审核失败

失败原因
备注
拼手气红包 红包规则
祝福语
恭喜发财,大吉大利!
红包金额
红包最小金额不能低于5元
红包数量
红包数量范围10~50个
余额支付
当前余额:
可前往问答、专栏板块获取收益 去获取
取 消 确 定

小包子的红包

恭喜发财,大吉大利

已领取20/40,共1.6元 红包规则

    易百纳技术社区