Skip to content

Commit c0d60bf

Browse files
committed
samples: drivers: video: update video capture sample.
Update this sample is dedicated to support usb host video. This sample can enumerate UVC device, configure UVC device and start video stream transfers then display it on LCD. Signed-off-by: Aiden Hu <[email protected]>
1 parent c7f1766 commit c0d60bf

File tree

7 files changed

+309
-70
lines changed

7 files changed

+309
-70
lines changed

samples/drivers/display/sample.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ tests:
111111
- platform:frdm_mcxn236/mcxn236:SHIELD=lcd_par_s035_8080
112112
- platform:frdm_mcxa156/mcxa156:SHIELD=lcd_par_s035_8080
113113
- platform:frdm_rw612:SHIELD=lcd_par_s035_spi
114+
- platform:rd_rw612_bga:SHIELD=lcd_par_s035_spi
114115
- platform:ek_ra8d1:SHIELD=rtkmipilcdb00000be
115116
- platform:ek_ra8d1:SHIELD=rtk7eka6m3b00001bu
116117
- platform:nucleo_g071rb/stm32g071xx:SHIELD=x_nucleo_gfx01m2

samples/drivers/video/capture/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ config VIDEO_FRAME_WIDTH
4343
help
4444
Width of the video frame. If set to 0, the default width is used.
4545

46+
config VIDEO_TARGET_FPS
47+
int "Target frame rate for video capture"
48+
default 0
49+
help
50+
Target frame rate (FPS) for video capture. If set to 0, the device
51+
default frame rate is used. This value will be used to configure
52+
the video device's frame interval settings.
53+
4654
config VIDEO_PIXEL_FORMAT
4755
string "Pixel format of the video frame"
4856
help
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
CONFIG_UHC_DRIVER=y
2+
CONFIG_USB_HOST_STACK=y
3+
CONFIG_USBH_VIDEO_CLASS=y
4+
5+
# Video buffer configuration
6+
CONFIG_VIDEO_BUFFER_POOL_SZ_MAX=154000
7+
CONFIG_VIDEO_BUFFER_POOL_NUM_MAX=1
8+
CONFIG_VIDEO_BUFFER_POOL_ALIGN=32
9+
10+
11+
# Memory configuration for USB transfers
12+
CONFIG_HEAP_MEM_POOL_SIZE=70000
13+
CONFIG_MAIN_STACK_SIZE=12288
14+
CONFIG_USBH_USB_DEVICE_HEAP=8912
15+
CONFIG_UHC_BUF_POOL_SIZE=4096
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
* Copyright 2025 NXP
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
uvc_host: uvc_host {
9+
compatible = "zephyr,uvc-host";
10+
};
11+
};
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
CONFIG_VIDEO=y
1+
CONFIG_POLL=y
2+
CONFIG_EVENTS=y
23
CONFIG_SHELL=y
34
CONFIG_DEVICE_SHELL=y
5+
CONFIG_VIDEO=y
6+
CONFIG_USB_HOST_STACK=y
47
CONFIG_PRINTK=y
58
CONFIG_LOG=y
69
CONFIG_DISPLAY=y
710
CONFIG_REQUIRES_FLOAT_PRINTF=y
8-
CONFIG_LOG_MODE_DEFERRED=y
11+
CONFIG_DEBUG_OPTIMIZATIONS=y
12+
CONFIG_USBH_VIDEO_LOG_LEVEL_WRN=y
13+
CONFIG_VIDEO_FRAME_WIDTH=320
14+
CONFIG_VIDEO_FRAME_HEIGHT=240

samples/drivers/video/capture/sample.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ tests:
44
sample.video.capture:
55
tags:
66
- video
7+
- usb
78
- shield
89
- samples
910
extra_args:
@@ -13,9 +14,11 @@ tests:
1314
- platform:frdm_mcxn947/mcxn947/cpu0:SHIELD="dvp_20pin_ov7670;lcd_par_s035_8080"
1415
- platform:frdm_mcxn236/mcxn236:SHIELD="dvp_20pin_ov7670;lcd_par_s035_8080"
1516
- platform:stm32h7b3i_dk:SHIELD="st_b_cams_omv_mb1683"
17+
- platform:rd_rw612_bga/rw612:SHIELD="usb_camera;lcd_par_s035_8080"
1618
extra_configs:
1719
- CONFIG_TEST=y
1820
- CONFIG_FPU=y
21+
- CONFIG_USB_HOST=y
1922
harness: console
2023
harness_config:
2124
fixture: fixture_camera
@@ -31,15 +34,19 @@ tests:
3134
- mimxrt1064_evk/mimxrt1064
3235
- mimxrt1170_evk/mimxrt1176/cm7
3336
- mimxrt1170_evk@B/mimxrt1176/cm7
37+
- rd_rw612_bga/rw612
3438
- frdm_mcxn947/mcxn947/cpu0
3539
- frdm_mcxn236/mcxn236
3640
- mm_swiftio
3741
- esp32s3_eye/esp32s3/procpu
3842
- stm32h7b3i_dk
39-
depends_on: video
43+
depends_on:
44+
- video
45+
- usbh
4046
integration_platforms:
4147
- mimxrt1064_evk/mimxrt1064
4248
- mimxrt1170_evk/mimxrt1176/cm7
49+
- rd_rw612_bga/rw612
4350
sample.video.capture.shell:
4451
tags:
4552
- video

0 commit comments

Comments
 (0)