Skip to content

Commit

Permalink
boards: nxp: frdm_mcnx947: add support for SMARTDMA camera engine
Browse files Browse the repository at this point in the history
Add support for SMARTDMA camera engine, and a OV7670 parallel camera
definition for the frdm_mcnx947 board. This support has been tested with
the video capture sample.

Signed-off-by: Daniel DeGrasse <[email protected]>
  • Loading branch information
danieldegrasse committed Jun 3, 2024
1 parent ab2098f commit df9aa23
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
13 changes: 13 additions & 0 deletions boards/nxp/frdm_mcxn947/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,19 @@ static int frdm_mcxn947_init(void)
CLOCK_AttachClk(kFRO_HF_to_USDHC);
#endif

#if DT_NODE_HAS_STATUS(DT_NODELABEL(smartdma), okay)
CLOCK_EnableClock(kCLOCK_Smartdma);
RESET_PeripheralReset(kSMART_DMA_RST_SHIFT_RSTn);
#if DT_NODE_HAS_STATUS(DT_NODELABEL(video_sdma), okay)
/* Drive CLKOUT from PLL0, divided by 27 to yield ~5.5MHz clock
* The camera will use this clock signal to generate
* PCLK, HSYNC, and VSYNC
*/
SYSCON->CLKOUTSEL = 0x1;
SYSCON->CLKOUTDIV = 26;
#endif
#endif

#if CONFIG_FLASH_MCUX_FLEXSPI_NOR
/* We downclock the FlexSPI to 50MHz, it will be set to the
* optimum speed supported by the Flash device during FLEXSPI
Expand Down
25 changes: 25 additions & 0 deletions boards/nxp/frdm_mcxn947/frdm_mcxn947-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,31 @@
};
};

pinmux_smartdma_camera: pinmux_smartdma_camera {
group0 {
/*
* SmartDMA pinmux is not defined by SOC header, so
* we encode it manually
*/
pinmux = <N9X_MUX('1',4,7)>,
<N9X_MUX('1',5,7)>,
<N9X_MUX('1',6,7)>,
<N9X_MUX('1',7,7)>,
<N9X_MUX('3',4,7)>,
<N9X_MUX('3',5,7)>,
<N9X_MUX('1',10,7)>,
<N9X_MUX('1',11,7)>,
<PIO0_4>,
<PIO0_5>,
<PIO0_11>,
<CLKOUT_PIO2_2>,
<CLKOUT_PIO0_6>;
drive-strength = "low";
slew-rate = "fast";
input-enable;
};
};

pinmux_usdhc0: pinmux_usdhc0 {
group0 {
pinmux = <SDHC0_CMD_PIO2_5>,
Expand Down
22 changes: 22 additions & 0 deletions boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,28 @@
pinctrl-0 = <&pinmux_flexcomm7_lpi2c>;
pinctrl-names = "default";
clock-frequency = <I2C_BITRATE_STANDARD>;
ov7670: ov7670@21 {
compatible = "ovti,ov7670";
reset-gpios = <&gpio1 19 GPIO_ACTIVE_HIGH>;
pwdn-gpios = <&gpio1 18 GPIO_ACTIVE_HIGH>;
reg = <0x21>;
};
};

/* SmartDMA is used for video driver on this board */
&smartdma {
status = "okay";
program-mem = <0x4000000>;
video_sdma: video-sdma {
status = "okay";
compatible = "nxp,video-smartdma";
pinctrl-0 = <&pinmux_smartdma_camera>;
pinctrl-names = "default";
sensor = <&ov7670>;
vsync-pin = <4>;
hsync-pin = <11>;
pclk-pin = <5>;
};
};

/*
Expand Down

0 comments on commit df9aa23

Please sign in to comment.