Skip to content

boards: frdm_mcxn947: turn OV7670 into a shield #89131

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

josuah
Copy link
Collaborator

@josuah josuah commented Apr 26, 2025

Dependencies:

The FRDM-MCXN board is featuring an Arducam connector originally designed for the Arduino GIGA R1, and spread broadly since then for inexpensive OmniVision and low-power Himax image sensor modules.

Other modules than the Olimex OV7670 can be used.

PXL_20250426_115548902
PXL_20250426_115605997
PXL_20250426_115649291

This also proposes an arducam,dvp-20pin-connector GPIO nexus:
https://github.com/zephyrproject-rtos/zephyr/pull/89131/files#diff-a39283efe7f5b76e206c8d2b9b65c4b45d130ceb1aa6bb8a0083486793172537

@josuah
Copy link
Collaborator Author

josuah commented Apr 26, 2025

Tested with UVC (by cherry-picking commits):

Before:

mpv-shot0001-before

After:

mpv-shot0001

It does not really look like correct data, but it is showing the same thing before and after, which shows the current PR does not break the sensor operation. :)

[EDIT: no problem with other hardware on UVC (i.e. Arducam Nicla or virtual source), I'll try with other sensors to debug this, which this PR helps doing]

@josuah josuah added the In progress For PRs: is work in progress and should not be merged yet. For issues: Is being worked on label Apr 26, 2025
@josuah josuah force-pushed the pr-frdm-mcxn947-shield branch from a0d81be to e03e9da Compare April 26, 2025 12:29
@josuah josuah force-pushed the pr-frdm-mcxn947-shield branch from e03e9da to 283745b Compare April 26, 2025 13:24
@josuah josuah force-pushed the pr-frdm-mcxn947-shield branch from 283745b to d171799 Compare April 26, 2025 13:29
@josuah josuah removed the In progress For PRs: is work in progress and should not be merged yet. For issues: Is being worked on label Apr 26, 2025
@josuah josuah force-pushed the pr-frdm-mcxn947-shield branch from d171799 to c159802 Compare April 26, 2025 15:27
@josuah josuah marked this pull request as ready for review April 26, 2025 15:27
Copy link
Collaborator

@ngphibang ngphibang left a comment

Choose a reason for hiding this comment

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

Thanks for the added shield.
Did you test the video capture sample ? I think you need to update the frdm_mcxn947_cpu0.overlay in the sample as well because the camera is now moved out of the board.

Comment on lines 125 to 129
port {
sdma_ep_in: endpoint {
remote-endpoint-label = "ov7670_ep_out";
dvp_20pin_ep_in: endpoint {
remote-endpoint-label = "dvp_20pin_ep_out";
};
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should not be here but in the overlay as it is out of the board. If there are multiple ports / endpoints, you can reserve a port for it as below (but it's not the case here):

https://github.com/zephyrproject-rtos/zephyr/blob/main/dts/arm/nxp/nxp_rt11xx.dtsi#L911-#L934

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I removed the remote-endpoint-label = "dvp_20pin_ep_out"; and it still works!
Is that what I should remove?

I am not sure how to remove the label itself dvp_20pin_ep_in: as the shield cannot know where it should insert itself on every board, the board.dts has to provide a label for the shield insertion point?

Thank you for your help as I learn DTS further.

@josuah josuah force-pushed the pr-frdm-mcxn947-shield branch 2 times, most recently from 8f6cc03 to a094905 Compare April 27, 2025 00:06
@josuah
Copy link
Collaborator Author

josuah commented Apr 27, 2025

Did you test the video capture sample ? I think you need to update the frdm_mcxn947_cpu0.overlay in the sample as well

Good point! Now I can remove it as the shield would select the zephyr,camera = &dvp_20pin_interface;.

Trying again after enabling the debug logging:

...
[00:00:05.271,000] <dbg> main: main: Got frame 307! size: 19200; timestamp 5271 ms
[00:00:05.286,000] <dbg> main: main: Got frame 308! size: 19200; timestamp 5286 ms
[00:00:05.302,000] <dbg> main: main: Got frame 309! size: 19200; timestamp 5302 ms
[00:00:05.318,000] <dbg> main: main: Got frame 310! size: 19200; timestamp 5318 ms
[00:00:05.334,000] <dbg> main: main: Got frame 311! size: 19200; timestamp 5334 ms
[00:00:05.357,000] <dbg> main: main: Got frame 312! size: 19200; timestamp 5357 ms
[00:00:05.373,000] <dbg> main: main: Got frame 313! size: 19200; timestamp 5373 ms
[00:00:05.388,000] <dbg> main: main: Got frame 314! size: 19200; timestamp 5388 ms
[00:00:05.404,000] <dbg> main: main: Got frame 315! size: 19200; timestamp 5404 ms
[00:00:05.420,000] <dbg> main: main: Got frame 316! size: 19200; timestamp 5420 ms
...

@josuah josuah force-pushed the pr-frdm-mcxn947-shield branch from a094905 to ecee1dd Compare April 27, 2025 00:23
@josuah
Copy link
Collaborator Author

josuah commented Apr 27, 2025

Copy link
Collaborator

@ngphibang ngphibang left a comment

Choose a reason for hiding this comment

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

Thanks

@josuah josuah force-pushed the pr-frdm-mcxn947-shield branch 2 times, most recently from 13ea982 to cb237fc Compare April 27, 2025 11:11
@josuah
Copy link
Collaborator Author

josuah commented Apr 27, 2025

Force-push:

  • Added a README entry for the video capture sample, preview soon available here or in the meantime here.
  • Modified the devicetree to use the same declaration style as mimxrt1064_evk

not sure if this 20-pin shield is generic and not specific only to NXP boards

It is the closest thing from a standard for DVP we might have, plenty of Arducam modules available via UCTRONICS, and some 3rd-party too, like the Olimex one for the OV7670. But a de-facto standard, no official document describing it.

This will help for testing all these drivers!

Add the 20-pin camera connector used by at least Arducam, Waveshare,
Olimex, Arduino, NXP, ST, Adafruit that connects image sensor module
boards and devkits.

Signed-off-by: Josuah Demangeon <[email protected]>
@josuah josuah force-pushed the pr-frdm-mcxn947-shield branch from cb237fc to b1d86c1 Compare April 29, 2025 13:33
josuah added 2 commits April 29, 2025 17:24
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]>
Add FRDM-MCXN947 to the video capture sample documentation and twister
YAML configuration, using the DVP OV7670 camera module newly introduced.

Signed-off-by: Josuah Demangeon <[email protected]>
@josuah josuah force-pushed the pr-frdm-mcxn947-shield branch from b1d86c1 to 29d6608 Compare April 29, 2025 17:26
The script zephyr/scripts/kconfig/kconfigfunctions.py used by
Kconfig's "shields_list_contains" searches shield names in lower-case,
like they are passed through the SHIELD in CMake, --shield argument
in west. Make the mt9m114 shield upper-case. This has no effect currently
as this Kconfig entry is not used anywhere in Zephyr.

Signed-off-by: Josuah Demangeon <[email protected]>
@josuah josuah requested a review from ngphibang April 29, 2025 17:33
@kartben kartben requested a review from Copilot May 3, 2025 06:17
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces support for using the Olimex OV7670 camera with the FRDM-MCXN947 board by adding a new shield configuration and related GPIO nexus definitions. Key changes include:

  • Adding a new board configuration entry in the sample YAML file for frdm_mcxn947 using the set shield parameters.
  • Introducing a new header file (dvp-20pin-connector.h) defining pin mappings for the Arducam DVP 20-pin connector.
  • Updating vendor prefixes and adding a device tree binding YAML for the new arducam,dvp-20pin-connector.

Reviewed Changes

Copilot reviewed 4 out of 11 changed files in this pull request and generated 2 comments.

File Description
samples/drivers/video/capture/sample.yaml Added new board configuration for frdm_mcxn947 shield.
include/zephyr/dt-bindings/gpio/dvp-20pin-connector.h Added definitions for the Arducam DVP 20-pin connector.
dts/bindings/vendor-prefixes.txt Included vendor prefix for Arducam.
dts/bindings/gpio/arducam,dvp-20pin-connector.yaml Added YAML binding for the Arducam DVP 20-pin connector nexus.
Files not reviewed (7)
  • boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi: Language not supported
  • boards/shields/dvp_20pin_ov7670/Kconfig.shield: Language not supported
  • boards/shields/dvp_20pin_ov7670/doc/index.rst: Language not supported
  • boards/shields/dvp_20pin_ov7670/dvp_20pin_ov7670.overlay: Language not supported
  • boards/shields/dvp_fpc24_mt9m114/Kconfig.shield: Language not supported
  • samples/drivers/video/capture/README.rst: Language not supported
  • samples/drivers/video/capture/boards/frdm_mcxn947_cpu0.overlay: Language not supported

Comment on lines +8 to +9
/** Pin number mask (0..20). */
#define DVP_20PIN_MASK 0xff
Copy link
Preview

Copilot AI May 3, 2025

Choose a reason for hiding this comment

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

The comment indicates a valid range of 0..20, but the mask value 0xff does not clearly reflect this range. Consider updating the comment or adjusting the mask value to avoid confusion.

Suggested change
/** Pin number mask (0..20). */
#define DVP_20PIN_MASK 0xff
/** Pin number mask (0..20). Covers values from 0 to 31 (0x1f). */
#define DVP_20PIN_MASK 0x1f

Copilot uses AI. Check for mistakes.

- dvp_20pin_gpio: the GPIO nexus using the arducam,dvp-20pin-connector
that defines the camera pins ('reset' (PEN), 'power-down' (PDN)...)

See <zephyr/dt-bindings/gpio/dvp-20pin-gpio.h> for pin description.
Copy link
Preview

Copilot AI May 3, 2025

Choose a reason for hiding this comment

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

The reference to 'dvp-20pin-gpio.h' appears inconsistent with the new header file 'dvp-20pin-connector.h'; please update the reference for consistency.

Suggested change
See <zephyr/dt-bindings/gpio/dvp-20pin-gpio.h> for pin description.
See <zephyr/dt-bindings/gpio/dvp-20pin-connector.h> for pin description.

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants