使用的是esp32-s2-kaluga-1板子,自己焊接了一个USB口到板上,使用了官方的教程“esp-iot-solu
tionexamplesusbhostusb_camera_lcd_display”,插入USB摄像头的时候,串口提示如下:
[17:49:02.142]收←◆[0;32mI (7451217) UVC_STREAM: line 353 HCD_PORT_EVENT_CONNECTION[0m
[0;32mI (7451217) UVC_STREAM: Resetting Port[0m
[17:49:02.206]收←◆[0;32mI (7451277) UVC_STREAM: Setting Port FIFO[0m
[0;32mI (7451277) UVC_STREAM: Getting Port Speed[0m
[0;32mI (7451277) UVC_STREAM: Port speed = 1[0m
[0;32mI (7451277) UVC_STREAM: USB Speed: full-speed[0m
D (7451277) UVC_STREAM: urb alloced[0m
[0;32mI (7451287) UVC_STREAM: Set Device Addr = 1[0m
D (7451287) UVC_STREAM: Got expected pipe_handle and event[0m
[0;32mI (7451297) UVC_STREAM: Set Device Addr Done[0m
D (7451297) UVC_STREAM: urb free[0m
D (7451307) UVC_STREAM: urb alloced[0m
[0;32mI (7451307) UVC_STREAM: Set Device Configuration = 1[0m
D (7451307) UVC_STREAM: Got expected pipe_handle and event[0m
[0;32mI (7451317) UVC_STREAM: Set Device Configuration Done[0m
D (7451327) UVC_STREAM: urb free[0m
D (7451327) UVC_STREAM: urb alloced[0m
[0;32mI (7451327) UVC_STREAM: SET_CUR Probe[0m
D (7451337) UVC_STREAM: Got expected pipe_handle and event[0m
[0;32mI (7451337) UVC_STREAM: SET_CUR Probe Done[0m
[0;32mI (7451347) UVC_STREAM: GET_CUR Probe[0m
D (7451347) UVC_STREAM: Got expected pipe_handle and event[0m
bmHint: 0201
bFormatIndex: 0
bFrameIndex: 0
dwFrameInterval: 400000
wKeyFrameRate: 3
wPFrameRate: 256
wCompQuality: 3
wCompWindowSize: 50688
wDelay: 0
dwMaxVideoFrameSize: 2047
dwMaxPayloadTransferSize: 1025
dwClockFrequency: 0
bmFramingInfo: 0
bPreferredVersion: 0
bMinVersion: 0
bMaxVersion: 0
bInterfaceNumber: 0
[0;32mI (7451387) UVC_STREAM: GET_CUR Probe Done, actual_num_bytes:64[0m
[0;32mI (7451387) UVC_STREAM: SET_CUR COMMIT[0m
D (7451397) UVC_STREAM: Got expected pipe_handle and event[0m
[0;32mI (7451397) UVC_STREAM: SET_CUR COMMIT Done[0m
D (7451407) UVC_STREAM: urb free[0m
D (7451407) UVC_STREAM: urb alloced[0m
[0;32mI (7451407) UVC_STREAM: Set Device Interface = 1, Alt = 1[0m
D (7451417) UVC_STREAM: Got expected pipe_handle and event[0m
[0;32mI (7451427) UVC_STREAM: Set Device Interface Done[0m
D (7451427) UVC_STREAM: urb free[0m
[0;32mI (7451427) UVC_STREAM: Sample processing task started[0m
[17:49:02.413]收←◆[0;32mI (7451487) UVC_STREAM: Camera Start Streaming[0m
D (7451487) UVC_STREAM: urb context update[0m
D (7451487) UVC_STREAM: urb context update[0m
D (7451487) UVC_STREAM: urb context update[0m
D (7451487) UVC_STREAM: urb context update[0m
[0;33mW (7451507) UVC_STREAM: line 657 Pipe: iso HCD_PIPE_EVENT_ERROR_OVERFLOW[0m
代码里设置的参数是320*240,对应的index为4,摄像头在linux下使用`lsusb -v`查看参数如下:
VideoStreaming Interface Descriptor:
bLength 30
bDescriptorType 36
bDescriptorSubtype 5 (FRAME_UNCOMPRESSED)
bFrameIndex 4
bmCapabilities 0x00
Still image unsupported
wWidth 320
wHeight 240
dwMinBitRate 3840000
dwMaxBitRate 3840000
dwMaxVideoFrameBufferSize 153600
dwDefaultFrameInterval 400000
bFrameIntervalType 1
dwFrameInterval( 0) 400000
代码里使用的参数如下图: