-
Notifications
You must be signed in to change notification settings - Fork 7.4k
boards: shields: add suport for weact_ov2640_cam_module #77949
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
dleach02
merged 2 commits into
zephyrproject-rtos:main
from
CharlesDias:weact_ministm32h7xx_ov2640
Oct 25, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Copyright (c) 2024 Charles Dias | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config SHIELD_WEACT_OV2640_CAM_MODULE | ||
def_bool $(shields_list_contains,weact_ov2640_cam_module) | ||
8 changes: 8 additions & 0 deletions
8
boards/shields/weact_ov2640_cam_module/boards/mini_stm32h743.conf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# | ||
# Copyright (c) 2024 Charles Dias <[email protected]> | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
CONFIG_VIDEO_HFLIP=y | ||
CONFIG_VIDEO_VFLIP=y |
59 changes: 59 additions & 0 deletions
59
boards/shields/weact_ov2640_cam_module/boards/mini_stm32h743.overlay
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright (c) 2024 Charles Dias | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/* AHB clocks must respect the minimum ratio AHB / DCMI_PIXCLK of 2.5 (AN5020 - Rev 3). | ||
* The OV2640 PCLK is around 72 MHz for QQVGA resolution (160x120) with MCO1_SEL_HSI48 | ||
* and MCO1_PRE_DIV_4. | ||
*/ | ||
&rcc { | ||
clocks = <&pll>; | ||
clock-frequency = <DT_FREQ_M(240)>; | ||
d1cpre = <1>; | ||
hpre = <1>; | ||
d1ppre = <2>; | ||
d2ppre1 = <2>; | ||
d2ppre2 = <2>; | ||
d3ppre = <2>; | ||
}; | ||
|
||
/* See reference manual (RM0433 Rev 8) page 390: | ||
* 100: HSI48 clock selected (hsi48_ck) | ||
*/ | ||
#define MCO1_SEL_HSI48 4 | ||
|
||
/* See reference manual (RM0433 Rev 8) page 391: | ||
* 0100: division by 4 | ||
*/ | ||
#define MCO1_PRE_DIV_4 4 | ||
|
||
&mco1 { | ||
status = "okay"; | ||
clocks = <&rcc STM32_SRC_HSI48 MCO1_SEL(MCO1_SEL_HSI48)>; | ||
prescaler = <MCO1_PRE(MCO1_PRE_DIV_4)>; | ||
pinctrl-0 = <&rcc_mco_1_pa8>; | ||
pinctrl-names = "default"; | ||
}; | ||
|
||
&zephyr_camera_i2c { | ||
ov2640: ov2640@30 { | ||
supply-gpios = <&dcmi_camera_connector 8 GPIO_ACTIVE_HIGH>; | ||
clock-rate-control = <0x80>; | ||
}; | ||
}; | ||
|
||
&zephyr_camera_dvp { | ||
dmas = <&dma1 0 75 (STM32_DMA_PERIPH_TO_MEMORY | STM32_DMA_PERIPH_NO_INC | | ||
STM32_DMA_MEM_INC | STM32_DMA_PERIPH_8BITS | STM32_DMA_MEM_32BITS | | ||
STM32_DMA_PRIORITY_HIGH) STM32_DMA_FIFO_1_4>; | ||
}; | ||
|
||
&dma1 { | ||
status = "okay"; | ||
}; | ||
|
||
&dmamux1 { | ||
status = "okay"; | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
.. _weact_ov2640_cam_module: | ||
|
||
WeAct Studio MiniSTM32H7xx OV2640 Camera Sensor | ||
############################################### | ||
|
||
Overview | ||
******** | ||
|
||
The OV2640 camera sensor is designed to interface with the WeAct Studio | ||
MiniSTM32H7xx boards, providing camera sensor capabilities. This shield | ||
integrates the OV2640 camera module, which is capable of capturing images | ||
and video with a resolution of up to 2 megapixels. | ||
|
||
.. figure:: ov2640.webp | ||
:align: center | ||
:alt: OV2640 Camera Sensor | ||
|
||
More information about the OV2640 camera sensor can be found on the | ||
`MiniSTM32H7xx GitHub`_ and in the `OV2640 datasheet`_. | ||
|
||
Requirements | ||
************ | ||
|
||
Your board needs to have a ``zephyr_camera_dvp`` device tree label to work with this shield. | ||
|
||
Pin Assignments | ||
=============== | ||
|
||
The shield connects to the WeAct Studio MiniSTM32H7xx board via the | ||
following pins: | ||
|
||
+--------------+-----------+-----------------------------+ | ||
| Shield Pin | Board Pin | Function | | ||
+==============+===========+=============================+ | ||
| DCMI_D0 | PC6 | DCMI Data Line 0 | | ||
+--------------+-----------+-----------------------------+ | ||
| DCMI_D1 | PC7 | DCMI Data Line 1 | | ||
+--------------+-----------+-----------------------------+ | ||
| DCMI_D2 | PE0 | DCMI Data Line 2 | | ||
+--------------+-----------+-----------------------------+ | ||
| DCMI_D3 | PE1 | DCMI Data Line 3 | | ||
+--------------+-----------+-----------------------------+ | ||
| DCMI_D4 | PE4 | DCMI Data Line 4 | | ||
+--------------+-----------+-----------------------------+ | ||
| DCMI_D5 | PD3 | DCMI Data Line 5 | | ||
+--------------+-----------+-----------------------------+ | ||
| DCMI_D6 | PE5 | DCMI Data Line 6 | | ||
+--------------+-----------+-----------------------------+ | ||
| DCMI_D7 | PE6 | DCMI Data Line 7 | | ||
+--------------+-----------+-----------------------------+ | ||
| DCMI_HSYNC | PA4 | DCMI HSYNC | | ||
+--------------+-----------+-----------------------------+ | ||
| DCMI_VSYNC | PB7 | DCMI VSYNC | | ||
+--------------+-----------+-----------------------------+ | ||
| DCMI_PIXCLK | PA6 | DCMI Pixel Clock | | ||
+--------------+-----------+-----------------------------+ | ||
| I2C_SDA | PB9 | I2C Data Line | | ||
+--------------+-----------+-----------------------------+ | ||
| I2C_SCL | PB8 | I2C Clock Line | | ||
+--------------+-----------+-----------------------------+ | ||
| RCC_MCO1 | PA8 | Clock Output | | ||
+--------------+-----------+-----------------------------+ | ||
| SUPPLY | PA7 | Power Supply Control (GPIO) | | ||
+--------------+-----------+-----------------------------+ | ||
|
||
Programming | ||
*********** | ||
|
||
Set ``--shield weact_ov2640_cam_module`` when you invoke ``west build``. For example: | ||
|
||
.. zephyr-app-commands:: | ||
:zephyr-app: samples/drivers/video/capture_to_lvgl/ | ||
:board: mini_stm32h743 | ||
:shield: weact_ov2640_cam_module | ||
:gen-args: -DCONFIG_BOOT_DELAY=2000 | ||
:goals: build | ||
|
||
.. _MiniSTM32H7xx GitHub: | ||
https://github.com/WeActStudio/MiniSTM32H7xx | ||
|
||
.. _OV2640 datasheet: | ||
https://www.uctronics.com/download/cam_module/OV2640DS.pdf |
Binary file not shown.
44 changes: 44 additions & 0 deletions
44
boards/shields/weact_ov2640_cam_module/weact_ov2640_cam_module.overlay
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright (c) 2024 Charles Dias | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/ { | ||
chosen { | ||
zephyr,camera = &zephyr_camera_dvp; | ||
}; | ||
}; | ||
|
||
&zephyr_camera_i2c { | ||
status = "okay"; | ||
clock-frequency = <I2C_BITRATE_FAST>; | ||
|
||
ov2640: ov2640@30 { | ||
compatible = "ovti,ov2640"; | ||
reg = <0x30>; | ||
status = "okay"; | ||
|
||
port { | ||
ov2640_ep_out: endpoint { | ||
remote-endpoint = <&zephyr_camera_dvp_in>; | ||
}; | ||
}; | ||
}; | ||
}; | ||
|
||
&zephyr_camera_dvp { | ||
status = "okay"; | ||
sensor = <&ov2640>; | ||
bus-width = <8>; | ||
hsync-active = <0>; | ||
vsync-active = <0>; | ||
pixelclk-active = <1>; | ||
capture-rate = <1>; | ||
|
||
port { | ||
zephyr_camera_dvp_in: endpoint { | ||
remote-endpoint = <&ov2640_ep_out>; | ||
}; | ||
}; | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
description: | | ||
GPIO pins exposed on the DCMI camera connector used for interfacing | ||
with the OV2640, OV7670, and OV5640 camera sensors. | ||
|
||
Connector layout (not mapped GPIOs in parentheses): | ||
|
||
(1) OV_STROBE (Unused) (2) AGND | ||
3 DVP_SDA (4) AVDD-2V8 | ||
5 DVP_SCL (6) DVP_RST | ||
7 DVP_VSYNC 8 DVP_PWDN | ||
9 DVP_HSYNC (10) DVDD-1V5 | ||
(11) 2V8 12 DVP_D7 | ||
13 DVP_XCLK 14 DVP_D6 | ||
(15) GND 16 DVP_D5 | ||
17 DVP_PCLK 18 DVP_D4 | ||
19 DVP_D0 20 DVP_D3 | ||
21 DVP_D1 22 DVP_D2 | ||
(23) AF-2V8 (24) GND | ||
|
||
compatible: "weact,dcmi-camera-connector" | ||
|
||
include: [gpio-nexus.yaml, base.yaml] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,9 @@ | |
# Copyright (c) 2024 Charles Dias <[email protected]> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
source "Kconfig.zephyr" | ||
mainmenu "Video capture to LVGL sample application" | ||
|
||
menu "Video capture configuration" | ||
|
||
config VIDEO_WIDTH | ||
int "Define the width of the video" | ||
|
@@ -20,3 +22,7 @@ config VIDEO_HFLIP | |
config VIDEO_VFLIP | ||
bool "Vertical flip" | ||
default n | ||
|
||
endmenu | ||
|
||
source "Kconfig.zephyr" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.