Skip to content

Commit 3774bb2

Browse files
boards/lckfb-szpi-esp32s3: add UVC camera standalone defconfig
Add UVC configuration for lckfb-szpi-esp32s3 board based on gc0308 camera config, with USB OTG and UVC gadget driver enabled in standalone (non-composite) mode. - defconfig: enable ESP32S3_OTG, USBUVC, UVC example app - board doc: add uvc section with usage and host verification Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
1 parent 3fba730 commit 3774bb2

2 files changed

Lines changed: 113 additions & 0 deletions

File tree

  • Documentation/platforms/xtensa/esp32s3/boards/lckfb-szpi-esp32s3
  • boards/xtensa/esp32s3/lckfb-szpi-esp32s3/configs/uvc

Documentation/platforms/xtensa/esp32s3/boards/lckfb-szpi-esp32s3/index.rst

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,3 +576,50 @@ Then use the camera example to capture a frame::
576576

577577
$ adb -s 1234 shell
578578
nsh> camera
579+
580+
uvc
581+
---
582+
583+
USB Video Class (UVC) webcam configuration. Streams YUYV frames from the
584+
GC0308 DVP camera to a USB host via the UVC gadget driver (Bulk transport).
585+
The application queries the sensor resolution at runtime and configures the
586+
UVC descriptors accordingly. Console is accessible over UART0 (serial).
587+
588+
The UVC driver also supports composite USB device mode
589+
(``CONFIG_USBUVC_COMPOSITE``), allowing it to be combined with other USB
590+
class drivers (e.g., CDC/ACM) in a single composite device.
591+
592+
You can run the configuration and compilation procedure::
593+
594+
$ ./tools/configure.sh lckfb-szpi-esp32s3:uvc
595+
$ make flash -j$(nproc) ESPTOOL_PORT=/dev/ttyUSB0
596+
597+
The application should work as follows:
598+
599+
1. Create ``/dev/video0`` via ``capture_initialize()`` and open it.
600+
2. Query the sensor's native resolution with ``VIDIOC_ENUM_FRAMESIZES``
601+
(pixel format ``V4L2_PIX_FMT_YUYV``), then ``VIDIOC_S_FMT`` to configure.
602+
3. Fill ``struct uvc_params_s`` with the queried width, height and fps,
603+
pass it to ``boardctl(BOARDIOC_USBDEV_CONTROL)`` via ``ctrl.handle``
604+
so the UVC gadget builds USB descriptors matching the actual sensor.
605+
4. Open ``/dev/uvc0``, use ``poll()`` with ``POLLOUT`` to wait for the
606+
USB host to start streaming.
607+
5. Loop: ``VIDIOC_QBUF`` / ``VIDIOC_DQBUF`` to capture a YUYV frame,
608+
then ``write()`` to ``/dev/uvc0``.
609+
610+
On the host side, verify the device is recognized::
611+
612+
$ sudo dmesg
613+
[32982831.662622] usb 1-9.3.3: new full-speed USB device number 72 using xhci_hcd
614+
[32982831.752856] usb 1-9.3.3: New USB device found, idVendor=1d6b, idProduct=0102, bcdDevice= 1.00
615+
[32982831.752860] usb 1-9.3.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
616+
[32982831.752861] usb 1-9.3.3: Product: NuttX UVC Camera
617+
[32982831.752862] usb 1-9.3.3: Manufacturer: NuttX
618+
[32982831.752863] usb 1-9.3.3: SerialNumber: 0001
619+
[32982831.756625] usb 1-9.3.3: Found UVC 1.10 device NuttX UVC Camera (1d6b:0102)
620+
621+
Then open the webcam with any UVC viewer (e.g. ``cheese``, ``guvcview``,
622+
or ``ffplay``)::
623+
624+
$ cheese
625+
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#
2+
# This file is autogenerated: PLEASE DO NOT EDIT IT.
3+
#
4+
# You can use "make menuconfig" to make any modifications to the installed .config file.
5+
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
6+
# modifications.
7+
#
8+
# CONFIG_ARCH_LEDS is not set
9+
# CONFIG_NSH_ARGCAT is not set
10+
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
11+
CONFIG_ARCH="xtensa"
12+
CONFIG_ARCH_BOARD="lckfb-szpi-esp32s3"
13+
CONFIG_ARCH_BOARD_COMMON=y
14+
CONFIG_ARCH_BOARD_ESP32S3_LCKFB_SZPI=y
15+
CONFIG_ARCH_CHIP="esp32s3"
16+
CONFIG_ARCH_CHIP_ESP32S3=y
17+
CONFIG_ARCH_CHIP_ESP32S3WROOM1N16R8=y
18+
CONFIG_ARCH_INTERRUPTSTACK=2048
19+
CONFIG_ARCH_STACKDUMP=y
20+
CONFIG_ARCH_XTENSA=y
21+
CONFIG_BOARDCTL_USBDEVCTRL=y
22+
CONFIG_BOARD_LOOPSPERMSEC=16717
23+
CONFIG_BUILTIN=y
24+
CONFIG_DEBUG_FULLOPT=y
25+
CONFIG_DEBUG_SYMBOLS=y
26+
CONFIG_DEV_GPIO=y
27+
CONFIG_ESP32S3_CAM=y
28+
CONFIG_ESP32S3_GPIO_IRQ=y
29+
CONFIG_ESP32S3_I2C0=y
30+
CONFIG_ESP32S3_OTG=y
31+
CONFIG_ESP32S3_OTG_ENDPOINT_NUM=2
32+
CONFIG_ESP32S3_UART0=y
33+
CONFIG_ESPRESSIF_LEDC=y
34+
CONFIG_ESPRESSIF_LEDC_CHANNEL0_PIN=42
35+
CONFIG_ESPRESSIF_LEDC_TIMER0=y
36+
CONFIG_FS_PROCFS=y
37+
CONFIG_FS_TMPFS=y
38+
CONFIG_GPIO_LOWER_HALF=y
39+
CONFIG_HAVE_CXX=y
40+
CONFIG_HAVE_CXXINITIALIZE=y
41+
CONFIG_IDLETHREAD_STACKSIZE=3072
42+
CONFIG_INIT_ENTRYPOINT="nsh_main"
43+
CONFIG_INIT_STACKSIZE=4096
44+
CONFIG_INTELHEX_BINARY=y
45+
CONFIG_IOEXPANDER=y
46+
CONFIG_IOEXPANDER_PCA9557=y
47+
CONFIG_LINE_MAX=64
48+
CONFIG_NSH_ARCHINIT=y
49+
CONFIG_NSH_BUILTIN_APPS=y
50+
CONFIG_NSH_FILEIOSIZE=512
51+
CONFIG_NSH_READLINE=y
52+
CONFIG_PREALLOC_TIMERS=4
53+
CONFIG_RAM_SIZE=114688
54+
CONFIG_RAM_START=0x20000000
55+
CONFIG_RR_INTERVAL=200
56+
CONFIG_SCHED_WAITPID=y
57+
CONFIG_START_DAY=6
58+
CONFIG_START_MONTH=12
59+
CONFIG_START_YEAR=2011
60+
CONFIG_SYSLOG_BUFFER=y
61+
CONFIG_SYSTEM_NSH=y
62+
CONFIG_UART0_SERIAL_CONSOLE=y
63+
CONFIG_USBUVC=y
64+
CONFIG_VIDEO=y
65+
CONFIG_VIDEO_GC0308=y
66+
CONFIG_VIDEO_STREAM=y

0 commit comments

Comments
 (0)