USB Host 配置
ArtInChip 提供了两路 USB Host 端口和一路 USB Device 端口,需要分别进行配置:
-
USB Host Contoller 配置
ArtInChip 在一个 USB Host 端口中提供了下列 Host Contoller,在软件上需要需要分开配置: -
USB Interface 驱动配置
完成 USB Host Contoller 配置后,系统可以正确识别插入 USB 总线的 Device 设备。USB Device 有各种不同类型 ,例如 U 盘、键盘鼠标、无线网卡。在 USB Device 中以 Interface 为单位提供不同类型的功能。如需使用 USB Device 具体功能,需配置不同类型 USB Interface 的驱动。
不同类型 USB Interface 驱动的配置可查看:
配置 EHCI 控制器
针对 USB 2.0 (High Speed) 的 EHCI 控制器,配置流程如下:
-
在 menuconfig 中配置设备。
使能 USB 端口,并且配置当前 USB 端口为 Host 模式:> Board options [*] Using Usb0 Select Usb0 mode (Host) ---> -
在 menuconfig 中配置 CherryUSB 驱动。
使能 CherryUSB 驱动,并且使能 Host 模式:> Local packages options > Third-party packages options [*] CherryUSB: tiny and portable USB host/device stack for embedded system with USB IP ---> [*] Enable usb host mode --->
U 盘配置
-
在 menuconfig 中使能 CherryUSB 中 msc 类型的 Host Class 驱动,并且使能对应实例模板:
> Local packages options > Third-party packages options [*] CherryUSB: tiny and portable USB host/device stack for embedded system with USB IP ---> [*] Enable usb host mode ---> [*] Enable usb msc driver ---> [*] Use msc template -
插入 U 盘,会自动挂载到
/disk目录:[I/USB] New high-speed device on Hub 1, Port 1 connected [I/USB] New device found,idVendor:30de,idProduct:6544,bcdDevice:0100 [I/USB] The device has 1 interfaces [I/USB] Enumeration success, start loading class driver [I/USB] Loading msc class driver [I/USB] Get max LUN:1 [I/USB] Ep=81 Attr=02 Mps=512 Interval=255 Mult=00 [I/USB] Ep=02 Attr=02 Mps=512 Interval=255 Mult=00 [I/USB] Capacity info: [I/USB] Block num:30274560,block size:512 [I/USB] Register MSC Class:/dev/sda found part[0], begin: 32256, size: 14.446GB [I] udisk_init()122 Found partition 0: type = 11, offet=0x3f, size=0x1cdf2a1 01-01 08:00:06 I/NO_TAG: try to mount file system!
HID 设备配置
-
-
在 Menuconfig 中使能 CherryUSB 中 hid 类型的 Host Class 驱动,并且使能对应实例模板:
> Local packages options > Third-party packages options [*] CherryUSB: tiny and portable USB host/device stack for embedded system with USB IP ---> [*] Enable usb host mode ---> [*] Enable usb hid driver ---> [*] Use hid template
-
-
插入鼠标设备,自动创建线程监听鼠标数据:
aic /> [I/USB] Switch port 1 to OHCI [I/usbh_hub] New low-speed device on Bus 0, Hub 1, Port 1 connected [I/usbh_core] New device found,idVendor:413c,idProduct:301a,bcdDevice:0100 [I/usbh_core] The device has 1 bNumConfigurations [I/usbh_core] The device has 1 interfaces [I/usbh_core] Enumeration success, start loading class driver [I/usbh_core] Loading hid class driver (interfaces :0) [I/usbh_hid] Ep=81 Attr=03 Mps=4 Interval=10 Mult=00 [I/usbh_hid] Register HID Class:/dev/input0
UVC 设备配置
-
在 Menuconfig 中使能 CherryUSB 中 uvc 类型的 Host Class 驱动,并且使能对应实例模板:
> Local packages options > Third-party packages options [*] CherryUSB: tiny and portable USB host/device stack for embedded system with USB IP ---> [*] Enable usb host mode ---> [*] Enable usb hid driver ---> [*] Use uvc template [*] Enable third party ---> [*] using chry memory pool [*] using chry ring buffer -
插入 USB 摄像头:
[I/usbh_hub] New high-speed device on Bus 0, Hub 1, Port 1 connected [I/usbh_core] New device found,idVendor:2bdf,idProduct:0289,bcdDevice:3300 [I/usbh_core] The device has 1 bNumConfigurations [I/usbh_core] The device has 7 interfaces [I/usbh_core] Enumeration success, start loading class driver [I/usbh_core] Loading video_ctrl class driver (interfaces :0) [I/usbh_video] Close video device [I/usbh_video] ============= Video device information =================== bcdVDC:0100 Num of altsettings:2 Ingore altsetting 0 Altsetting:1, Ep=88 Attr=05 Mps=1024 Interval=01 Mult=02 bNumFormats:3 FormatIndex:1 FormatType:1 uncompressed YUY2 bNumFrames:5 Resolution: Width: 640, Height: 480 Width: 1920, Height: 1080 Width: 1280, Height: 960 Width: 1280, Height: 720 Width: 640, Height: 360
CDC 设备配置
在 Menuconfig 中使能 CherryUSB 中 CDC 类型的 Host Class
驱动,并且使能对应实例模板:
> Local packages options
> Third-party packages options
[*] CherryUSB: tiny and portable USB host/device stack for embedded system with USB IP --->
[*] Enable usb host mode --->
[*] Enable usb cdc acm driver
[*] Enable usb ncm driver
[*] Enable usb ecm driverVendor 设备配置
在 Menuconfig 中使能 CherryUSB 中 Vendor 类型的 Host Class
驱动,并且使能对应实例模板:
> Local packages options
> Third-party packages options
[*] CherryUSB: tiny and portable USB host/device stack for embedded system with USB IP --->
[*] Enable usb host mode --->
[*] Enable usb vendor driver --->
[*] using ch34x driver
[*] using cp210x driver
[*] using ftdi driver
[*] using pl2303 driverUVC 设备配置
-
在 Menuconfig 中使能 CherryUSB 中 uvc 类型的 Host Class 驱动,并且使能对应实例模板:
> Local packages options > Third-party packages options [*] CherryUSB: tiny and portable USB host/device stack for embedded system with USB IP ---> [*] Enable usb host mode ---> [*] Enable usb hid driver ---> [*] Use uvc template [*] Enable third party ---> [*] using chry memory pool [*] using chry ring buffer -
插入 USB 摄像头:
[I/usbh_hub] New high-speed device on Bus 0, Hub 1, Port 1 connected [I/usbh_core] New device found,idVendor:2bdf,idProduct:0289,bcdDevice:3300 [I/usbh_core] The device has 1 bNumConfigurations [I/usbh_core] The device has 7 interfaces [I/usbh_core] Enumeration success, start loading class driver [I/usbh_core] Loading video_ctrl class driver (interfaces :0) [I/usbh_video] Close video device [I/usbh_video] ============= Video device information =================== bcdVDC:0100 Num of altsettings:2 Ingore altsetting 0 Altsetting:1, Ep=88 Attr=05 Mps=1024 Interval=01 Mult=02 bNumFormats:3 FormatIndex:1 FormatType:1 uncompressed YUY2 bNumFrames:5 Resolution: Width: 640, Height: 480 Width: 1920, Height: 1080 Width: 1280, Height: 960 Width: 1280, Height: 720 Width: 640, Height: 360
CDC 设备配置
在 Menuconfig 中使能 CherryUSB 中 CDC 类型的 Host Class
驱动,并且使能对应实例模板:
> Local packages options
> Third-party packages options
[*] CherryUSB: tiny and portable USB host/device stack for embedded system with USB IP --->
[*] Enable usb host mode --->
[*] Enable usb cdc acm driver
[*] Enable usb ncm driver
[*] Enable usb ecm driverVendor 设备配置
在 Menuconfig 中使能 CherryUSB 中 Vendor 类型的 Host Class
驱动,并且使能对应实例模板:
> Local packages options
> Third-party packages options
[*] CherryUSB: tiny and portable USB host/device stack for embedded system with USB IP --->
[*] Enable usb host mode --->
[*] Enable usb vendor driver --->
[*] using ch34x driver
[*] using cp210x driver
[*] using ftdi driver
[*] using pl2303 driver