Skip to content
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
19 changes: 19 additions & 0 deletions boards/nxp/frdm_mcxn236/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ void board_early_init_hook(void)
CLOCK_SetClkDiv(kCLOCK_DivPLL1Clk0, 1U);
#endif

#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcomm0))
/* Configure input clock to be able to reach the datasheet specified SPI band rate. */
CLOCK_SetClkDiv(kCLOCK_DivFlexcom0Clk, 1u);
CLOCK_AttachClk(kFRO_HF_DIV_to_FLEXCOMM0);
#endif

#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcomm1))
/* Configure input clock to be able to reach the datasheet specified SPI band rate. */
CLOCK_SetClkDiv(kCLOCK_DivFlexcom1Clk, 1u);
Expand Down Expand Up @@ -305,6 +311,19 @@ void board_early_init_hook(void)
CLOCK_AttachClk(kPLL0_to_I3C1FCLK);
#endif

#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(smartdma))
CLOCK_EnableClock(kCLOCK_Smartdma);
RESET_PeripheralReset(kSMART_DMA_RST_SHIFT_RSTn);
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(video_sdma))
/* Drive CLKOUT from main clock, divided by 25 to yield 6MHz clock
* The camera will use this clock signal to generate
* PCLK, HSYNC, and VSYNC
*/
CLOCK_AttachClk(kMAIN_CLK_to_CLKOUT);
CLOCK_SetClkDiv(kCLOCK_DivClkOut, 25U);
#endif
#endif

/* Set SystemCoreClock variable. */
SystemCoreClock = CLOCK_INIT_CORE_CLOCK;
}
30 changes: 30 additions & 0 deletions boards/nxp/frdm_mcxn236/frdm_mcxn236-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@
#include <nxp/mcx/MCXN236VDF-pinctrl.h>

&pinctrl {
pinmux_flexcomm0_lpuart: pinmux_flexcomm0_lpuart {
group0 {
pinmux = <FC0_P0_PIO0_16>,
<FC0_P1_PIO0_17>;
slew-rate = "fast";
drive-strength = "low";
input-enable;
};
};

pinmux_flexcomm2_lpuart: pinmux_flexcomm2_lpuart {
group0 {
pinmux = <FC2_P2_PIO4_2>,
Expand Down Expand Up @@ -177,4 +187,24 @@
bias-pull-up;
};
};

pinmux_smartdma_camera: pinmux_smartdma_camera {
group0 {
pinmux = <EZH_PIO0_PIO1_4>,
<EZH_PIO1_PIO1_5>,
<EZH_PIO2_PIO1_6>,
<EZH_PIO3_PIO1_7>,
<EZH_PIO4_PIO1_8>,
<EZH_PIO5_PIO1_9>,
<EZH_PIO6_PIO1_10>,
<EZH_PIO7_PIO1_11>,
<PIO0_4>,
<PIO0_5>,
<PIO0_7>,
<CLKOUT_PIO2_2>;
drive-strength = "low";
slew-rate = "fast";
input-enable;
};
};
};
43 changes: 43 additions & 0 deletions boards/nxp/frdm_mcxn236/frdm_mcxn236.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "frdm_mcxn236-pinctrl.dtsi"
#include <zephyr/dt-bindings/i2c/i2c.h>
#include <zephyr/dt-bindings/input/input-event-codes.h>
#include <zephyr/dt-bindings/gpio/dvp-20pin-connector.h>

/ {
aliases{
Expand Down Expand Up @@ -62,6 +63,12 @@
};
};

&flexcomm0_lpuart0 {
current-speed = <115200>;
pinctrl-0 = <&pinmux_flexcomm0_lpuart>;
pinctrl-names = "default";
};

&flexcomm2_lpuart2 {
current-speed = <115200>;
pinctrl-0 = <&pinmux_flexcomm2_lpuart>;
Expand Down Expand Up @@ -185,3 +192,39 @@ zephyr_mipi_dbi_parallel: &flexio0_lcd {

p3t1755dp_ard_i3c_interface: &i3c1 {};
p3t1755dp_ard_i2c_interface: &flexcomm5_lpi2c5 {};

/* SmartDMA is used for video driver on this board */
&smartdma {
/* Shields do not enable video-sdma parent node so enable it by default */
status = "okay";
program-mem = <0x4000000>;

video_sdma: video-sdma {
status = "disabled";
compatible = "nxp,video-smartdma";
pinctrl-0 = <&pinmux_smartdma_camera>;
pinctrl-names = "default";
vsync-pin = <4>;
hsync-pin = <5>;
pclk-pin = <7>;
};
};

/*
* Connection with camera modules such as the dvp_20pin_ov7670 shield
*/

/ {
dvp_20pin_connector: dvp-20pin-connector {
compatible = "arducam,dvp-20pin-connector";
#gpio-cells = <2>;
gpio-map-mask = <0xffffffff 0xffffffc0>;
gpio-map-pass-thru = <0x0 GPIO_DT_FLAGS_MASK>;
gpio-map = <DVP_20PIN_PEN 0 &gpio1 19 0>,
<DVP_20PIN_PDN 0 &gpio1 18 0>;
};
};

dvp_20pin_i2c: &flexcomm2_lpi2c2 {};

dvp_20pin_interface: &video_sdma {};
Copy link
Contributor

Choose a reason for hiding this comment

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

This line should have been enough for allowing the chosen { zephyr,camera = <...>; } to take effect through the shield:

chosen {
zephyr,camera = &dvp_20pin_interface;
};

Not sure yet why there is the CI error...

/__w/zephyr/zephyr/include/zephyr/device.h:96:41: error: '__device_dts_ord_DT_CHOSEN_zephyr_camera_ORD' undeclared (first use in this function)
   96 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                         ^~~~~~~~~

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe because of not use the full board name frdm_mcxn236/mcxn236 ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe because of not use the full board name frdm_mcxn236/mcxn236 ?

yes this should be change to frdm_mcxn236/mcxn236, the extra_config only accept full name

1 change: 1 addition & 0 deletions boards/nxp/frdm_mcxn236/frdm_mcxn236.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ supported:
- regulator
- spi
- usbd
- video
- watchdog
vendor: nxp
1 change: 1 addition & 0 deletions boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ supported:
- sdhc
- spi
- usb_device
- video
- watchdog
vendor: nxp
9 changes: 9 additions & 0 deletions dts/arm/nxp/nxp_mcxn23x_common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,15 @@
clock-src = <0>;
alarms-count = <1>;
};

smartdma: smartdma@33000 {
compatible = "nxp,smartdma";
reg = <0x33000 0x1000>;
status = "disabled";
interrupts = <53 0>;
program-mem = <0x4000000>;
#dma-cells = <0>;
};
};

&systick {
Expand Down
1 change: 1 addition & 0 deletions samples/drivers/video/capture/boards/frdm_mcxn236.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_VIDEO_BUFFER_POOL_SZ_MAX=40000
23 changes: 23 additions & 0 deletions samples/drivers/video/capture/boards/frdm_mcxn236.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2025 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/

/ {
chosen {
/* Switch to flexcomm0_lpuart0(P0_16,P0_17), since default console
* pins are duplicated with camera header pins
*/
zephyr,console = &flexcomm0_lpuart0;
zephyr,shell-uart = &flexcomm0_lpuart0;
};
};

&flexcomm0 {
status = "okay";
};

&flexcomm0_lpuart0 {
status = "okay";
};
2 changes: 2 additions & 0 deletions samples/drivers/video/capture/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ tests:
- platform:mimxrt1170_evk/mimxrt1176/cm7:SHIELD="nxp_btb44_ov5640;rk055hdmipi4ma0"
- platform:mimxrt1170_evk@B/mimxrt1176/cm7:SHIELD="nxp_btb44_ov5640;rk055hdmipi4ma0"
- platform:frdm_mcxn947/mcxn947/cpu0:SHIELD="dvp_20pin_ov7670;lcd_par_s035_8080"
- platform:frdm_mcxn236/mcxn236:SHIELD="dvp_20pin_ov7670;lcd_par_s035_8080"
extra_configs:
- CONFIG_TEST=y
- CONFIG_FPU=y
Expand All @@ -30,6 +31,7 @@ tests:
- mimxrt1170_evk/mimxrt1176/cm7
- mimxrt1170_evk@B/mimxrt1176/cm7
- frdm_mcxn947/mcxn947/cpu0
- frdm_mcxn236/mcxn236
- mm_swiftio
- esp32s3_eye/esp32s3/procpu
depends_on: video
Expand Down
Loading