Skip to content

Commit a0d81be

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 <me@josuah.net>
1 parent c1716d8 commit a0d81be

File tree

4 files changed

+133
-16
lines changed

4 files changed

+133
-16
lines changed

boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi

+13-16
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{
@@ -66,6 +67,15 @@
6667
<10 0 &gpio4 5 0>, /* Pin 10, LCD backlight control */
6768
<11 0 &gpio4 7 0>; /* Pin 11, LCD and touch reset */
6869
};
70+
71+
dvp_20pin_gpio: dvp-20pin-connector {
72+
compatible = "arducam,dvp-20pin-connector";
73+
#gpio-cells = <2>;
74+
gpio-map-mask = <DVP_20PIN_MASK 0x0>;
75+
gpio-map-pass-thru = <0x0 GPIO_DT_FLAGS_MASK>;
76+
gpio-map = <DVP_20PIN_PEN 0 &gpio1 19 0>,
77+
<DVP_20PIN_PDN 0 &gpio1 18 0>;
78+
};
6979
};
7080

7181
&flexcomm1_lpspi1 {
@@ -91,29 +101,17 @@ nxp_8080_touch_panel_i2c: &flexcomm2_lpi2c2 {
91101
pinctrl-names = "default";
92102
};
93103

94-
&flexcomm7_lpi2c7 {
104+
dvp_20pin_i2c: &flexcomm7_lpi2c7 {
95105
pinctrl-0 = <&pinmux_flexcomm7_lpi2c>;
96106
pinctrl-names = "default";
97107
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-
};
110108
};
111109

112110
/* SmartDMA is used for video driver on this board */
113111
&smartdma {
114112
status = "okay";
115113
program-mem = <0x4000000>;
116-
video_sdma: video-sdma {
114+
dvp_20pin_interface: video_sdma: video-sdma {
117115
status = "okay";
118116
compatible = "nxp,video-smartdma";
119117
pinctrl-0 = <&pinmux_smartdma_camera>;
@@ -123,8 +121,7 @@ nxp_8080_touch_panel_i2c: &flexcomm2_lpi2c2 {
123121
pclk-pin = <5>;
124122

125123
port {
126-
sdma_ep_in: endpoint {
127-
remote-endpoint-label = "ov7670_ep_out";
124+
dvp_20pin_ep_in: endpoint {
128125
};
129126
};
130127
};
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,34 @@
1+
/*
2+
* Copyright 2024 NXP
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/{
8+
chosen {
9+
zephyr,camera = &dvp_20pin_interface;
10+
};
11+
};
12+
13+
&dvp_20pin_i2c {
14+
ov7670: ov7670@21 {
15+
compatible = "ovti,ov7670";
16+
reset-gpios = <&dvp_20pin_gpio DVP_20PIN_PEN GPIO_ACTIVE_HIGH>;
17+
pwdn-gpios = <&dvp_20pin_gpio DVP_20PIN_PDN GPIO_ACTIVE_HIGH>;
18+
reg = <0x21>;
19+
20+
port {
21+
dvp_20pin_ep_out: endpoint {
22+
remote-endpoint-label = "dvp_20pin_ep_in";
23+
};
24+
};
25+
};
26+
};
27+
28+
&dvp_20pin_ep_in {
29+
remote-endpoint-label = "dvp_20pin_ep_out";
30+
};
31+
32+
&dvp_20pin_interface {
33+
status = "okay";
34+
};

0 commit comments

Comments
 (0)