Skip to content
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

boards: shields: Add shield for NXP's ov5640 camera modules #72434

Merged
merged 2 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions boards/nxp/mimxrt1160_evk/mimxrt1160_evk_mimxrt1166_cm7.dts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,21 @@
aliases {
watchdog0 = &wdog1;
};

/*
* This node describes the GPIO pins mapping of the 44-pin camera
* connector, J2 on the EVK. This camera interface is supported
* on several NXP RT11xx EVKs, such as RT1170 and RT1160 EVK and
* is used with an ov5640 camera module available as a Zephyr shield
*/
nxp_cam_connector: cam-connector {
compatible = "nxp,cam-44pins-connector";
#gpio-cells = <2>;
gpio-map-mask = <0xffffffff 0xffffffc0>;
gpio-map-pass-thru = <0 0x3f>;
gpio-map = <9 0 &gpio11 15 0>, /* Pin 9, RESETB */
<17 0 &gpio9 25 0>; /* Pin 17, PWDN */
};
};

&lpuart1 {
Expand Down Expand Up @@ -97,3 +112,9 @@ zephyr_udc0: &usb1 {
&pit2 {
status = "okay";
};

nxp_cam_i2c: &lpi2c6 {};

nxp_mipi_csi: &mipi_csi2rx {};

nxp_csi: &csi {};
3 changes: 3 additions & 0 deletions boards/nxp/mimxrt1170_evk/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ RT1170 EVKB (`mimxrt1170_evk@B//cm7/cm4`)
+-----------+------------+-------------------------------------+-----------------+-----------------+
| PIT | on-chip | pit | Supported (M7) | Supported (M7) |
+-----------+------------+-------------------------------------+-----------------+-----------------+
| VIDEO | on-chip | CSI; MIPI CSI-2 Rx. Tested with | Supported (M7) | Supported (M7) |
| | | :ref:`nxp_btb44_ov5640` shield | | |
+-----------+------------+-------------------------------------+-----------------+-----------------+

The default configuration can be found in the defconfig files:
:zephyr_file:`boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm7_defconfig`
Expand Down
21 changes: 21 additions & 0 deletions boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm7.dts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,21 @@
<32 0 &gpio11 16 0>, /* Pin 32, PWR_EN */
<34 0 &gpio9 29 0>; /* Pin 34, BL_PWM */
};

/*
* This node describes the GPIO pins mapping of the 44-pin camera
* connector, J2 on the EVK. This camera interface is supported
* on several NXP RT11xx EVKs, such as RT1170 and RT1160 EVK and
* is used with an ov5640 camera module available as a Zephyr shield
*/
nxp_cam_connector: cam-connector {
compatible = "nxp,cam-44pins-connector";
#gpio-cells = <2>;
gpio-map-mask = <0xffffffff 0xffffffc0>;
gpio-map-pass-thru = <0 0x3f>;
gpio-map = <9 0 &gpio11 15 0>, /* Pin 9, RESETB */
<17 0 &gpio9 25 0>; /* Pin 17, PWDN */
};
};

zephyr_lcdif: &lcdif {};
Expand Down Expand Up @@ -146,3 +161,9 @@ zephyr_udc0: &usb1 {
&pit2 {
status = "okay";
};

nxp_cam_i2c: &lpi2c6 {};

nxp_mipi_csi: &mipi_csi2rx {};

nxp_csi: &csi {};
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ supported:
- spi
- usb_device
- watchdog
- video
vendor: nxp
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ supported:
- spi
- usb_device
- watchdog
- video
vendor: nxp
5 changes: 5 additions & 0 deletions boards/shields/nxp_btb44_ov5640/Kconfig.shield
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2024 NXP
# SPDX-License-Identifier: Apache-2.0

config SHIELD_NXP_BTB44_OV5640
def_bool $(shields_list_contains,nxp_btb44_ov5640)
134 changes: 134 additions & 0 deletions boards/shields/nxp_btb44_ov5640/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
.. _nxp_btb44_ov5640:

NXP BTB-44 OV5640 Camera Module
###############################

Overview
********

This shield supports ov5640 camera modules which use a 44-pin board-to-board connector and
a MIPI CSI or DVP (parallel) interface. These camera modules are made specifically for and
provided together with NXP's i.MX RT1160 and RT1170 EVK boards.
kartben marked this conversation as resolved.
Show resolved Hide resolved

More information about this OV5640 camera module can be found at `Camera iMXRT`_.

Pins assignment of the NXP board-to-board 44-pin OV5640 camera module
======================================================================

+----------------------+--------------------+
| Camera Connector Pin | Function |
+======================+====================+
| 1 | AGND |
+----------------------+--------------------+
| 2 | AF_GND |
+----------------------+--------------------+
| 3 | STROBE |
+----------------------+--------------------+
| 4 | AF_VCC |
+----------------------+--------------------+
| 5 | SDA |
+----------------------+--------------------+
| 6 | VCMSINK |
+----------------------+--------------------+
| 7 | SCL |
+----------------------+--------------------+
| 8 | AVDD |
+----------------------+--------------------+
| 9 | RESETB |
+----------------------+--------------------+
| 10 | GPIO1 |
+----------------------+--------------------+
| 11 | PCLK |
+----------------------+--------------------+
| 12 | GPIO0 |
+----------------------+--------------------+
| 13 | VSYNC |
+----------------------+--------------------+
| 14 | FREX |
+----------------------+--------------------+
| 15 | HREF |
+----------------------+--------------------+
| 16 | MIPI_CSI_DP1 / D9 |
+----------------------+--------------------+
| 17 | PWDN |
+----------------------+--------------------+
| 18 | MIPI_CSI_DN1 / D8 |
+----------------------+--------------------+
| 19 | MIPI_CSI_DP1 / D9 |
+----------------------+--------------------+
| 20 | DGND |
+----------------------+--------------------+
| 21 | MIPI_CSI_DN1 / D8 |
+----------------------+--------------------+
| 22 | MIPI_CSI_CLKP / D7 |
+----------------------+--------------------+
| 23 | MIPI_CSI_CLKP / D7 |
+----------------------+--------------------+
| 24 | MIPI_CSI_CLKN / D6 |
+----------------------+--------------------+
| 25 | MIPI_CSI_CLKN / D6 |
+----------------------+--------------------+
| 26 | DGND |
+----------------------+--------------------+
| 27 | MIPI_CSI_DP0 / D5 |
+----------------------+--------------------+
| 28 | MIPI_CSI_DP0 / D5 |
+----------------------+--------------------+
| 29 | MIPI_CSI_DN0 / D4 |
+----------------------+--------------------+
| 30 | MIPI_CSI_DN0 / D4 |
+----------------------+--------------------+
| 31 | D3 |
+----------------------+--------------------+
| 32 | DGND |
+----------------------+--------------------+
| 33 | D2 |
+----------------------+--------------------+
| 34 | XCLK |
+----------------------+--------------------+
| 35 | D1 |
+----------------------+--------------------+
| 36 | DVDD |
+----------------------+--------------------+
| 37 | D0 |
+----------------------+--------------------+
| 38 | DOVDD |
+----------------------+--------------------+
| 39 | DGND |
+----------------------+--------------------+
| 40 | DGND |
+----------------------+--------------------+
| 41 | GND |
+----------------------+--------------------+
| 42 | GND |
+----------------------+--------------------+
| 43 | GND |
+----------------------+--------------------+
| 44 | AF_GND |
+----------------------+--------------------+
Comment on lines +18 to +108
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would probably make sense to also add in the documentation of the new binding for nexus (again, see e.g. the description field of arduino-header-r3 as an example)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, done


Requirements
************

This shield can only be used with a board which provides a 44-pin board-to-board
connector with MIPI CSI or DVP (parallel) interface where the pinouts are defined
as above, such as i.MX RT1160 and RT1170 EVK boards.

Programming
***********

Set ``-DSHIELD=nxp_btb44_ov5640`` when you invoke ``west build``. For example:

.. zephyr-app-commands::
:zephyr-app: samples/subsys/video/capture
:board: mimxrt1170_evk/mimxrt1176/cm7
:shield: nxp_btb44_ov5640
:goals: build

References
**********

.. target-notes::

.. _Camera iMXRT:
https://community.nxp.com/t5/i-MX-RT-Knowledge-Base/Connecting-camera-and-LCD-to-i-MX-RT-EVKs/ta-p/1122183
48 changes: 48 additions & 0 deletions boards/shields/nxp_btb44_ov5640/nxp_btb44_ov5640.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright 2024 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/

/{
chosen {
zephyr,camera = &nxp_csi;
};
};

&nxp_cam_i2c {
status = "okay";

ov5640: ov5640@3c {
compatible = "ovti,ov5640";
reg = <0x3c>;
reset-gpios = <&nxp_cam_connector 9 GPIO_ACTIVE_LOW>;
powerdown-gpios = <&nxp_cam_connector 17 GPIO_ACTIVE_HIGH>;

port {
ov5640_ep_out: endpoint {
remote-endpoint = <&mipi_csi2rx_ep_in>;
};
};
};
};

&nxp_mipi_csi {
status = "okay";

sensor = <&ov5640>;

ports {
port@1 {
reg = <1>;

mipi_csi2rx_ep_in: endpoint {
remote-endpoint = <&ov5640_ep_out>;
};
};
};
};

&nxp_csi {
status = "okay";
};
33 changes: 33 additions & 0 deletions dts/bindings/gpio/nxp,cam-44pins-connector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2024 NXP
# SPDX-License-Identifier: Apache-2.0

description: |
GPIO pins exposed on NXP 44-pin board-to-board camera connector.
The connector layout is depicted below:

42 GND GND 41
2 AF_GND AGND 1
4 AF_VCC STROBE 3
6 VCMSINK SDA 5
8 AVDD SCL 7
10 GPIO1 RESETB 9
12 GPIO0 PCLK 11
14 FREX VSYNC 13
16 MIPI_CSI_DP1/D9 HREF 15
18 MIPI_CSI_DN1/D8 PWDN 17
20 DGND MIPI_CSI_DP1/D9 19
22 MIPI_CSI_CLKP/D7 MIPI_CSI_DN1/D8 21
24 MIPI_CSI_CLKN/D6 MIPI_CSI_CLKP/D7 23
26 DGND MIPI_CSI_CLKN/D6 25
28 MIPI_CSI_DP0/D5 MIPI_CSI_DP0/D5 27
30 MIPI_CSI_DN0/D4 MIPI_CSI_DN0/D4 29
32 DGND D3 31
34 XCLK D2 33
36 DVDD D1 35
38 DOVDD D0 37
40 DGND DGND 39
44 AF_GND GND 43

compatible: "nxp,cam-44pins-connector"

include: [gpio-nexus.yaml, base.yaml]
Loading