From c304da7c673567a8254726399b8904f29ea08b67 Mon Sep 17 00:00:00 2001 From: Alain Volmat Date: Tue, 22 Oct 2024 21:27:59 +0200 Subject: [PATCH] shields: st_stm32f4dis_cam: ov9655 sensor based shield Introduction of the STM32F4DIS-CAM shield for STM32 boards embedding a DVP based OV9655 sensor. Signed-off-by: Alain Volmat --- .../shields/st_stm32f4dis_cam/Kconfig.shield | 6 ++ .../boards/stm32l4r9i_disco.conf | 1 + .../shields/st_stm32f4dis_cam/doc/index.rst | 32 ++++++++++ boards/shields/st_stm32f4dis_cam/shield.yml | 6 ++ .../st_stm32f4dis_cam.overlay | 62 +++++++++++++++++++ 5 files changed, 107 insertions(+) create mode 100644 boards/shields/st_stm32f4dis_cam/Kconfig.shield create mode 100644 boards/shields/st_stm32f4dis_cam/boards/stm32l4r9i_disco.conf create mode 100644 boards/shields/st_stm32f4dis_cam/doc/index.rst create mode 100644 boards/shields/st_stm32f4dis_cam/shield.yml create mode 100644 boards/shields/st_stm32f4dis_cam/st_stm32f4dis_cam.overlay diff --git a/boards/shields/st_stm32f4dis_cam/Kconfig.shield b/boards/shields/st_stm32f4dis_cam/Kconfig.shield new file mode 100644 index 00000000000..6cc24606629 --- /dev/null +++ b/boards/shields/st_stm32f4dis_cam/Kconfig.shield @@ -0,0 +1,6 @@ +# Copyright (c) 2025 STMicroelectronics + +# SPDX-License-Identifier: Apache-2.0 + +config SHIELD_ST_STM32F4DIS_CAM + def_bool $(shields_list_contains,st_stm32f4dis_cam) diff --git a/boards/shields/st_stm32f4dis_cam/boards/stm32l4r9i_disco.conf b/boards/shields/st_stm32f4dis_cam/boards/stm32l4r9i_disco.conf new file mode 100644 index 00000000000..88f8b23a71f --- /dev/null +++ b/boards/shields/st_stm32f4dis_cam/boards/stm32l4r9i_disco.conf @@ -0,0 +1 @@ +CONFIG_VIDEO_INIT_PRIORITY=72 diff --git a/boards/shields/st_stm32f4dis_cam/doc/index.rst b/boards/shields/st_stm32f4dis_cam/doc/index.rst new file mode 100644 index 00000000000..652a4a13401 --- /dev/null +++ b/boards/shields/st_stm32f4dis_cam/doc/index.rst @@ -0,0 +1,32 @@ +.. _st_stm32f4dis_cam: + +ST STM32F4DIS-CAM +################# + +Overview +******** + +The STM32F4DIS-CAM camera board embeds a 1.3MPix OV9655 sensor and a +30 pins FFC connector in order to be used for some of the STM32 Discovery +kits such as STM32L4R9I-disco board offering a DVP camera interface. + +Requirements +************ + +The camera module bundle is compatible with STM32 Discovery kits and +Evaluation boards featuring a 30 pins FFC connector, such as the STM32F4 +Discovery kit or STM32L4R9I Discovery kit. + +Usage +***** + +The shield can be used in any application by setting ``SHIELD`` to +``st_stm32f4dis_cam`` for boards with the necessary device tree node labels. + +Set ``--shield "st_stm32f4dis_cam"`` when you invoke ``west build``. For example: + +.. zephyr-app-commands:: + :zephyr-app: samples/drivers/video/capture + :board: stm32l4r9i_disco + :shield: st_stm32f4dis_cam + :goals: build diff --git a/boards/shields/st_stm32f4dis_cam/shield.yml b/boards/shields/st_stm32f4dis_cam/shield.yml new file mode 100644 index 00000000000..e96f6e537e1 --- /dev/null +++ b/boards/shields/st_stm32f4dis_cam/shield.yml @@ -0,0 +1,6 @@ +shield: + name: st_stm32f4dis_cam + full_name: ST STM32F4DIS-CAM + vendor: st + supported_features: + - video diff --git a/boards/shields/st_stm32f4dis_cam/st_stm32f4dis_cam.overlay b/boards/shields/st_stm32f4dis_cam/st_stm32f4dis_cam.overlay new file mode 100644 index 00000000000..f1e16a339a0 --- /dev/null +++ b/boards/shields/st_stm32f4dis_cam/st_stm32f4dis_cam.overlay @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2025 STMicroelectronics + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + zephyr,camera = &st_cam_dvp; + }; +}; + +&dma2 { + status = "okay"; +}; + +&dmamux1 { + status = "okay"; +}; + +&st_cam_i2c { + ov9655: camera@30 { + compatible = "ovti,ov9655"; + reg = <0x30>; + pwdn-gpios = <&dcmi_camera_connector 6 GPIO_ACTIVE_HIGH>; + + port { + ov9655_ep_out: endpoint { + remote-endpoint-label = "dcmi_ep_in"; + }; + }; + }; +}; + +#define MCO1_SEL_SYSCLK 1 + +#define MCO1_PRE_DIV_4 2 + +&mco1 { + status = "okay"; + clocks = <&rcc STM32_SRC_SYSCLK MCO1_SEL(MCO1_SEL_SYSCLK)>; + prescaler = ; + pinctrl-0 = <&rcc_mco_pa8>; + pinctrl-names = "default"; +}; + +&st_cam_dvp { + status = "okay"; + + /* DMA config is already hardcoded within the DCMI driver */ + dmas = <&dma2 5 0 0>; + + port { + dcmi_ep_in: endpoint { + remote-endpoint-label = "ov9655_ep_out"; + bus-width = <8>; + hsync-active = <1>; + vsync-active = <1>; + pclk-sample = <1>; + }; + }; +};