# K230 UVC Device Guide

## UVC Device Overview

The K230 supports emulating the development board as a UVC (USB Video Class) device. When the K230 board is connected to a PC via USB, the PC will recognize it as a UVC camera.

## UVC Device Configuration

To use UVC Device, apply the following configuration:

```bash
make rtsmart-menuconfig

# Locate the relevant option
 > Components Configuration > Enable CherryUSB > Enable CherryUSB Device
        -> USB Device Function   # select UVC

# After selecting the UVC function, "Enable UVC" is automatically enabled.
#    Under that option, configure the resolution (width x height) and frame rate.
> Components Configuration > Enable CherryUSB > Enable CherryUSB Device > Enable CherryUSB Device Class Driver
        -> Enable UVC
```

![UVC FUNC](https://www.kendryte.com/api/post/attachment?id=777)

![UVC CONFIG](https://www.kendryte.com/api/post/attachment?id=776)

## UVC Device Sample Programs

Two sample programs are provided:

```bash
src/rtsmart/examples/mpp/sample_uvc_dev_picture  # data source: a static JPEG image
src/rtsmart/examples/mpp/sample_uvc_dev_vicap    # data source: the on-board CMOS camera (connect a camera before use)
```

To build these sample programs, enable the following options:

```bash
make menuconfig
        > RT-Smart UserSpace Examples Configuration > Enable MPP examples
                -> Enable Build sample_uvc_dev_picture
                -> Enable Build sample_uvc_dev_vicap
```

After completing the configuration, run the sample programs on the board:

```bash
msh />/sdcard/app/examples/mpp/sample_uvc_dev_picture.elf
# or
msh />/sdcard/app/examples/mpp/sample_uvc_dev_vicap.elf
```

## Troubleshooting

1. First check whether `/dev/video` exists. If it does not, the configuration changes were not compiled into the firmware.
1. When running `sample_uvc_dev_vicap.elf`, make sure a CMOS camera is connected to the board.
