From 0b5da7a2eaff780a1aad598cc13aa9cc917720a9 Mon Sep 17 00:00:00 2001 From: Felipe Neves Date: Wed, 18 Sep 2024 16:54:31 -0300 Subject: [PATCH] samples: drivers: video: add arduino nicla vision As supported board to the video capture sample. Signed-off-by: Felipe Neves --- samples/drivers/video/capture/README.rst | 13 +++++++++++++ .../arduino_nicla_vision_stm32h747xx_m7.conf | 15 +++++++++++++++ ...arduino_nicla_vision_stm32h747xx_m7.overlay | 18 ++++++++++++++++++ samples/drivers/video/capture/sample.yaml | 1 + samples/drivers/video/capture/src/main.c | 2 +- 5 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 samples/drivers/video/capture/boards/arduino_nicla_vision_stm32h747xx_m7.conf create mode 100644 samples/drivers/video/capture/boards/arduino_nicla_vision_stm32h747xx_m7.overlay diff --git a/samples/drivers/video/capture/README.rst b/samples/drivers/video/capture/README.rst index eace71ecff0622..22634811a4ebd9 100644 --- a/samples/drivers/video/capture/README.rst +++ b/samples/drivers/video/capture/README.rst @@ -24,6 +24,9 @@ Supported camera modules on some i.MX RT boards can be found below. - :ref:`mimxrt1170_evk` - `OV5640 camera module`_ +Also :ref:`arduino_nicla_vision_board` can be used in this sample as capture device, in that case +The user can transfer the captured frames through on board USB. + Wiring ****** @@ -35,6 +38,8 @@ On :ref:`mimxrt1170_evk`, the OV5640 camera module should be plugged into the J2 camera connector. A USB cable should be connected from a host to the micro USB debug connector (J11) in order to get console output via the daplink interface. +For :ref:`arduino_nicla_vision_board` there is no extra wiring required. + Building and Running ******************** @@ -56,6 +61,14 @@ For :ref:`mimxrt1170_evk`, build this sample application with the following comm :goals: build :compact: +For :ref:`arduino_nicla_vision_board`, build this sample application with the following commands: + +.. zephyr-app-commands:: + :zephyr-app: samples/drivers/video/capture + :board: arduino_nicla_vision/stm32h747xx/m7 + :goals: build + :compact: + For testing purpose without the need of any real video capture and/or display hardwares, a video software pattern generator is supported by the above build commands without specifying the shields. diff --git a/samples/drivers/video/capture/boards/arduino_nicla_vision_stm32h747xx_m7.conf b/samples/drivers/video/capture/boards/arduino_nicla_vision_stm32h747xx_m7.conf new file mode 100644 index 00000000000000..6ae5e7da478a6c --- /dev/null +++ b/samples/drivers/video/capture/boards/arduino_nicla_vision_stm32h747xx_m7.conf @@ -0,0 +1,15 @@ +CONFIG_VIDEO_BUFFER_POOL_NUM_MAX=1 +CONFIG_VIDEO_BUFFER_POOL_SZ_MAX=160000 +CONFIG_DMA=y + +# Arduino Nicla Vision has easy access to the USB console +# So use it to check the log messages +CONFIG_USB_DEVICE_STACK=y +CONFIG_USB_WORKQUEUE_STACK_SIZE=8192 +CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=y +CONFIG_MAIN_STACK_SIZE=4096 + +CONFIG_SERIAL=y +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y +CONFIG_UART_LINE_CTRL=y diff --git a/samples/drivers/video/capture/boards/arduino_nicla_vision_stm32h747xx_m7.overlay b/samples/drivers/video/capture/boards/arduino_nicla_vision_stm32h747xx_m7.overlay new file mode 100644 index 00000000000000..93a64c17d7e544 --- /dev/null +++ b/samples/drivers/video/capture/boards/arduino_nicla_vision_stm32h747xx_m7.overlay @@ -0,0 +1,18 @@ +/* + * Copyright 2024 Felipe Neves + * + * SPDX-License-Identifier: Apache-2.0 + */ +/ { + chosen { + zephyr,console = &cdc_acm_uart0; + zephyr,shell-uart = &cdc_acm_uart0; + }; +}; + +zephyr_udc0: &usbotg_hs { + status = "okay"; + cdc_acm_uart0: cdc_acm_uart0 { + compatible = "zephyr,cdc-acm-uart"; + }; +}; diff --git a/samples/drivers/video/capture/sample.yaml b/samples/drivers/video/capture/sample.yaml index 34eaffdec69c42..882796cf674bbc 100644 --- a/samples/drivers/video/capture/sample.yaml +++ b/samples/drivers/video/capture/sample.yaml @@ -11,6 +11,7 @@ tests: - platform:mimxrt1064_evk:SHIELD="dvp_fpc24_mt9m114;rk043fn66hs_ctg" - platform:mimxrt1170_evk/mimxrt1176/cm7:SHIELD="nxp_btb44_ov5640;rk055hdmipi4ma0" platform_allow: + - arduino_nicla_vision/stm32h747xx/m7 - mimxrt1064_evk - mimxrt1170_evk/mimxrt1176/cm7 - mm_swiftio diff --git a/samples/drivers/video/capture/src/main.c b/samples/drivers/video/capture/src/main.c index 862dff287f7aa5..d04d0de0954d62 100644 --- a/samples/drivers/video/capture/src/main.c +++ b/samples/drivers/video/capture/src/main.c @@ -75,7 +75,7 @@ static inline void video_display_frame(const struct device *const display_dev, int main(void) { - struct video_buffer *buffers[2], *vbuf; + struct video_buffer *buffers[CONFIG_VIDEO_BUFFER_POOL_NUM_MAX], *vbuf; struct video_format fmt; struct video_caps caps; unsigned int frame = 0;