Skip to content

Commit 09d1e95

Browse files
committed
boards: nxp: frdm_mcxn947: migrate ov7670 to a shield
The OV7670 was defined as part of the FRDM-MCXN947 board attached to the SmartDMA and I2C peripheral. Migrate the devicetree to a reusable shield that can be swapped with other image sensors. Signed-off-by: Josuah Demangeon <[email protected]>
1 parent 2aedf16 commit 09d1e95

File tree

5 files changed

+146
-30
lines changed

5 files changed

+146
-30
lines changed

boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi

+23-19
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "frdm_mcxn947-pinctrl.dtsi"
88
#include <zephyr/dt-bindings/i2c/i2c.h>
99
#include <zephyr/dt-bindings/input/input-event-codes.h>
10+
#include <zephyr/dt-bindings/gpio/dvp-20pin-connector.h>
1011

1112
/ {
1213
aliases{
@@ -95,38 +96,22 @@ nxp_8080_touch_panel_i2c: &flexcomm2_lpi2c2 {
9596
pinctrl-0 = <&pinmux_flexcomm7_lpi2c>;
9697
pinctrl-names = "default";
9798
clock-frequency = <I2C_BITRATE_STANDARD>;
98-
ov7670: ov7670@21 {
99-
compatible = "ovti,ov7670";
100-
reset-gpios = <&gpio1 19 GPIO_ACTIVE_HIGH>;
101-
pwdn-gpios = <&gpio1 18 GPIO_ACTIVE_HIGH>;
102-
reg = <0x21>;
103-
104-
port {
105-
ov7670_ep_out: endpoint {
106-
remote-endpoint-label = "sdma_ep_in";
107-
};
108-
};
109-
};
11099
};
111100

112101
/* SmartDMA is used for video driver on this board */
113102
&smartdma {
103+
/* Shields do not enable video-sdma parent node so enable it by default */
114104
status = "okay";
115105
program-mem = <0x4000000>;
106+
116107
video_sdma: video-sdma {
117-
status = "okay";
108+
status = "disabled";
118109
compatible = "nxp,video-smartdma";
119110
pinctrl-0 = <&pinmux_smartdma_camera>;
120111
pinctrl-names = "default";
121112
vsync-pin = <4>;
122113
hsync-pin = <11>;
123114
pclk-pin = <5>;
124-
125-
port {
126-
sdma_ep_in: endpoint {
127-
remote-endpoint-label = "ov7670_ep_out";
128-
};
129-
};
130115
};
131116
};
132117

@@ -300,3 +285,22 @@ zephyr_mipi_dbi_parallel: &flexio0_lcd {
300285
pinctrl-0 = <&pinmux_sctimer>;
301286
pinctrl-names = "default";
302287
};
288+
289+
/*
290+
* Connection with camera modules such as the dvp_20pin_ov7670 shield
291+
*/
292+
293+
/ {
294+
dvp_20pin_gpio: dvp-20pin-connector {
295+
compatible = "arducam,dvp-20pin-connector";
296+
#gpio-cells = <2>;
297+
gpio-map-mask = <DVP_20PIN_MASK 0x0>;
298+
gpio-map-pass-thru = <0x0 GPIO_DT_FLAGS_MASK>;
299+
gpio-map = <DVP_20PIN_PEN 0 &gpio1 19 0>,
300+
<DVP_20PIN_PDN 0 &gpio1 18 0>;
301+
};
302+
};
303+
304+
dvp_20pin_i2c: &flexcomm7_lpi2c7 {};
305+
306+
dvp_20pin_interface: &video_sdma {};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright 2025 tinyVision.ai Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SHIELD_DVP_20PIN_OV7670
5+
def_bool $(shields_list_contains,SHIELD_DVP_20PIN_OV7670)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
.. _dvp_20pin_ov7670:
2+
3+
DVP 20-pin OV7670 Camera Module
4+
###############################
5+
6+
Overview
7+
********
8+
9+
This series of shields supports the camera modules which use a 18-pin connector compatible with
10+
the ``arducam,dvp-20pin-connector`` to connect a devkit to an OV7670 image sensor via DVP
11+
(Digital Video Port), aka parallel interface.
12+
13+
Only 18 pins out of the 20-pin connector are present
14+
15+
It was originally produced by `Arducam`_ but is discontinuited, and now `Olimex`_ provides it.
16+
17+
Pins assignment
18+
===============
19+
20+
+-----+--------------+-----+--------------+
21+
| Pin | Function | Pin | Function |
22+
+=====+==============+=====+==============+
23+
| 1 | 3V3 | 2 | GND |
24+
+-----+--------------+-----+--------------+
25+
| 3 | SCL | 4 | SDA |
26+
+-----+--------------+-----+--------------+
27+
| 5 | VS | 6 | HS |
28+
+-----+--------------+-----+--------------+
29+
| 7 | PCLK | 8 | XCLK |
30+
+-----+--------------+-----+--------------+
31+
| 9 | D7 | 10 | D6 |
32+
+-----+--------------+-----+--------------+
33+
| 11 | D5 | 12 | D4 |
34+
+-----+--------------+-----+--------------+
35+
| 13 | D3 | 14 | D2 |
36+
+-----+--------------+-----+--------------+
37+
| 15 | D1 | 16 | D0 |
38+
+-----+--------------+-----+--------------+
39+
| 17 | POWER_EN | 18 | POWER_DOWN |
40+
+-----+--------------+-----+--------------+
41+
42+
Requirements
43+
************
44+
45+
This shield can be used with any board which provides a 18 or 20-pin header spread over two rows
46+
of 9 or 10 pins each with the above pinout, such as the `arduino Giga R1`_, `NXP FRDM-MCXN947`_,
47+
ST boards with the `ST-CAMS-OMV`_ adapter, or any other board with a compatible connector.
48+
49+
Alternatively, it is possible to use jumper wires to connect the module to any devkit that
50+
exposes their camera parallel port to pin headers.
51+
52+
Programming
53+
***********
54+
55+
Set ``--shield dvp_20pin_ov7670`` when you invoke ``west build``. For example:
56+
57+
.. zephyr-app-commands::
58+
:zephyr-app: samples/drivers/video/capture
59+
:board: frdm_mcxn947
60+
:shield: dvp_20pin_ov7670
61+
:goals: build
62+
63+
References
64+
**********
65+
66+
.. target-notes::
67+
68+
.. _ST-CAMS-OMV:
69+
https://www.st.com/en/evaluation-tools/b-cams-omv.html
70+
71+
.. _Arducam:
72+
https://docs.arducam.com/DVP-Camera-Module/Arduino-GIGA/Arduino-GIGA/Quick-Start-Guide/
73+
74+
.. _Arduino Giga R1:
75+
https://docs.arduino.cc/tutorials/giga-r1-wifi/giga-camera/
76+
77+
.. _NXP FRDM-MCXN947:
78+
https://www.nxp.com/docs/en/application-note/AN14191.pdf
79+
80+
.. _Olimex:
81+
https://www.olimex.com/Products/Components/Camera/CAMERA-OV7670/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright 2024 NXP
3+
* Copyright 2025 tinyVision.ai Inc.
4+
*
5+
* SPDX-License-Identifier: Apache-2.0
6+
*/
7+
8+
/ {
9+
chosen {
10+
zephyr,camera = &dvp_20pin_interface;
11+
};
12+
};
13+
14+
&dvp_20pin_i2c {
15+
ov7670: ov7670@21 {
16+
compatible = "ovti,ov7670";
17+
reg = <0x21>;
18+
reset-gpios = <&dvp_20pin_gpio DVP_20PIN_PEN GPIO_ACTIVE_HIGH>;
19+
pwdn-gpios = <&dvp_20pin_gpio DVP_20PIN_PDN GPIO_ACTIVE_HIGH>;
20+
21+
port {
22+
ov7670_ep_out: endpoint {
23+
remote-endpoint-label = "dvp_20pin_ep_in";
24+
};
25+
};
26+
};
27+
};
28+
29+
&dvp_20pin_interface {
30+
status = "okay";
31+
32+
port {
33+
dvp_20pin_ep_in: endpoint {
34+
remote-endpoint-label = "ov7670_ep_out";
35+
};
36+
};
37+
};

samples/drivers/video/capture/boards/frdm_mcxn947_cpu0.overlay

-11
This file was deleted.

0 commit comments

Comments
 (0)