Skip to content

Conversation

@NeilChen93
Copy link
Contributor

@NeilChen93 NeilChen93 commented Jun 24, 2025

Add support for using the SMARTDMA engine on the FRDM-MCXN236 board with the video capture sample.

Comment on lines 8 to 14
chosen {
zephyr,uart-mcumgr = &flexcomm0_lpuart0;
zephyr,console = &flexcomm0_lpuart0;
zephyr,shell-uart = &flexcomm0_lpuart0;
};
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems these chosen node are not video-specific. Could you explain why we don't set it elsewhere (e.g, board's dts) but need to set it here in the video capture sample overlay ?

Copy link
Contributor Author

@NeilChen93 NeilChen93 Jun 25, 2025

Choose a reason for hiding this comment

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

Hi @ngphibang , the default console pins(P1_8,P1_9) are duplicated with camera header. So I chose another flexcomm(flexcomm0_lpuart0) as smartdma_camera serial output.
image

@@ -0,0 +1,2 @@
CONFIG_VIDEO_BUFFER_POOL_SZ_MAX=40000
CONFIG_VIDEO_BUFFER_POOL_NUM_MAX=2
Copy link
Contributor

Choose a reason for hiding this comment

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

CONFIG_VIDEO_BUFFER_POOL_NUM_MAX is set to 2 by default so this is not needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for reminder, I will update.

@hakehuang
Copy link
Contributor

@NeilChen93 the sample fails on frdm_mcxn947, due to hal upgrade sdma, so it is fixed now?

@ngphibang
Copy link
Contributor

@hakehuang It is fixed by #91760 (comment) (sorry not to inform you as I think you were aware of it). The problem was finally found due to ov7670 init sequence (not sdma)

@hakehuang
Copy link
Contributor

hakehuang commented Jun 25, 2025

@hakehuang It is fixed by #91760 (comment) (sorry not to inform you as I think you were aware of it). The problem was finally found due to ov7670 init sequence (not sdma)

@ngphibang, @NeilChen93 can you help to add - video to those boards frdm_mcxn947_cpu0 and frdm_mcxn236

and it fails at my frdm_mcxn947 board
#91760 (comment)

@NeilChen93 NeilChen93 force-pushed the add_mcxn236_smartdma_support branch 2 times, most recently from 74411e6 to 639bff4 Compare June 25, 2025 07:02
@NeilChen93
Copy link
Contributor Author

Hi @hakehuang , using below command, it can work fine on my side.
west build -p auto -b frdm_mcxn947/mcxn947/cpu0 samples/drivers/video/capture --shield dvp_20pin_ov7670 --shield lcd_par_s035_8080

ngphibang
ngphibang previously approved these changes Jun 25, 2025
Copy link
Contributor

@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.

LGTM

Copy link
Contributor

@hakehuang hakehuang left a comment

Choose a reason for hiding this comment

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

add - video to <platform.yaml> support list

@hakehuang
Copy link
Contributor

Hi @hakehuang , using below command, it can work fine on my side. west build -p auto -b frdm_mcxn947/mcxn947/cpu0 samples/drivers/video/capture --shield dvp_20pin_ov7670 --shield lcd_par_s035_8080

DEBUG   - Running cmake on /home/ubuntu/zephyrproject/zephyr/samples/drivers/video/capture for frdm_mcxn947/mcxn947/cpu0
DEBUG   - Calling cmake: /usr/bin/cmake -B/home/ubuntu/zephyrproject/zephyr/twister-out/frdm_mcxn947_mcxn947_cpu0/zephyr/samples/drivers/video/capture/sample.video.capture -DTC_RUNID=5bb652bcf663d31b08b68d3279ff329c -DTC_NAME=samples/drivers/video/capture/sample.video.capture -DCONFIG_COMPILER_WARNINGS_AS_ERRORS=y -DEXTRA_GEN_EDT_ARGS=--edtlib-Werror -GNinja -DPython3_EXECUTABLE=/home/ubuntu/zephyrproject/.venv/bin/python3 -DZEPHYR_TOOLCHAIN_VARIANT=zephyr -S/home/ubuntu/zephyrproject/zephyr/samples/drivers/video/capture '-DSHIELD=dvp_20pin_ov7670;lcd_par_s035_8080' -DOVERLAY_CONFIG=/home/ubuntu/zephyrproject/zephyr/twister-out/frdm_mcxn947_mcxn947_cpu0/zephyr/samples/drivers/video/capture/sample.video.capture/twister/testsuite_extra.conf -DBOARD=frdm_mcxn947/mcxn947/cpu0
DEBUG   - Launched 8 jobs
DEBUG   - Finished running cmake /home/ubuntu/zephyrproject/zephyr/samples/drivers/video/capture for frdm_mcxn947/mcxn947/cpu0 in 6.84 seconds
DEBUG   - build test: frdm_mcxn947/mcxn947/cpu0/zephyr/samples/drivers/video/capture/sample.video.capture
DEBUG   - Building /home/ubuntu/zephyrproject/zephyr/samples/drivers/video/capture for frdm_mcxn947/mcxn947/cpu0
DEBUG   - Running /usr/bin/cmake --build /home/ubuntu/zephyrproject/zephyr/twister-out/frdm_mcxn947_mcxn947_cpu0/zephyr/samples/drivers/video/capture/sample.video.capture
DEBUG   - Finished building /home/ubuntu/zephyrproject/zephyr/samples/drivers/video/capture for frdm_mcxn947/mcxn947/cpu0 in 2.75 seconds
DEBUG   - run test: frdm_mcxn947/mcxn947/cpu0/zephyr/samples/drivers/video/capture/sample.video.capture
DEBUG   - Reset instance status from 'passed' to None before run.
DEBUG   - Retain DUT:frdm_mcxn947/mcxn947/cpu0, Id:AXFHGR0OBA23F, counter:1, failures:0
DEBUG   - Using serial device /dev/serial/by-id/usb-NXP_Semiconductors_MCU-LINK_FRDM-MCXN947__r0E7__CMSIS-DAP_V3.128_AXFHGR0OBA23F-if02 @ 115200 baud
DEBUG   - Flash command: ['west', 'flash', '--skip-rebuild', '-d', '/home/ubuntu/zephyrproject/zephyr/twister-out/frdm_mcxn947_mcxn947_cpu0/zephyr/samples/drivers/video/capture/sample.video.capture', '--runner', 'linkserver', '--probe=AXFHGR0OBA23F']
DEBUG   - DEVICE: *** Booting Zephyr OS build v4.1.0-6641-gfa732ece862a ***
DEBUG   - DEVICE: I: Video device: video-sdma
DEBUG   - DEVICE: I: - Capabilities:
DEBUG   - DEVICE: I:   RGBP width [320; 320; 0] height [240; 240; 0]
DEBUG   - DEVICE: I: - Video format: RGBP 320x240
DEBUG   - DEVICE:
DEBUG   - DEVICE: uart:~$ I: - Supported frame intervals for the default format:
DEBUG   - DEVICE: I: - Supported controls:
DEBUG   - DEVICE: I:            device: ov7670@21
DEBUG   - DEVICE: I:                  Horizontal Flip 0x00980914 (bool)   (flags=0x00) : min=0 max=1 step=1 default=0 value=0
DEBUG   - DEVICE: I:              E: ***** USAGE FAULT *****
DEBUG   - DEVICE: E:   Stack overflow (context area not valid)
DEBUG   - DEVICE: E: r0/a1:  0xaaaaaaaa  r1/a2:  0xaaaaaaaa  r2/a3:  0x1000a2ec
DEBUG   - DEVICE: E: r3/a4:  0x09100000 r12/ip:  0xaaaaaaaa r14/lr:  0xaaaaaaaa
DEBUG   - DEVICE: E:  xpsr:  0xaaaaaa00
DEBUG   - DEVICE: E: s[ 0]:  0xaaaaaaaa  s[ 1]:  0xaaaaaaaa  s[ 2]:  0x00000000  s[ 3]:  0x0000000a
DEBUG   - DEVICE: E: s[ 4]:  0x300169f0  s[ 5]:  0x00000000  s[ 6]:  0x00000000  s[ 7]:  0x0000002d
DEBUG   - DEVICE: E: s[ 8]:  0x00000000  s[ 9]:  0x10000c21  s[10]:  0x30016998  s[11]:  0x10013be7
DEBUG   - DEVICE: E: s[12]:  0x00000000  s[13]:  0x00000000  s[14]:  0x100121b5  s[15]:  0x00000020
DEBUG   - DEVICE: E: fpscr:  0x10014204
DEBUG   - DEVICE: E: Faulting instruction address (r15/pc): 0xaaaaaaaa
DEBUG   - DEVICE: E: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
DEBUG   - DEVICE: E: Current thread: 0x30000bf8 (main)
DEBUG   - DEVICE: E: Halting system

I will get another camera to try, but it looks not like camera issue

@decsny decsny removed their request for review June 25, 2025 15:20
Copy link
Contributor

@josuah josuah left a comment

Choose a reason for hiding this comment

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

In case the error for MCXN236 is the same as the error for MCXN947:

If so, then this PR is probably not causing this error.


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

@decsny decsny added this to the v4.2.0 milestone Jun 27, 2025
josuah
josuah previously approved these changes Jun 27, 2025
Copy link
Contributor

@josuah josuah left a comment

Choose a reason for hiding this comment

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

This works with UVC (git rebase main of this branch).
mpv-shot0001

- mimxrt1170_evk/mimxrt1176/cm7
- mimxrt1170_evk@B/mimxrt1176/cm7
- frdm_mcxn947/mcxn947/cpu0
- frdm_mcxn236
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be full name frdm_mcxn236/mcxn236 ?

- 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:SHIELD="dvp_20pin_ov7670;lcd_par_s035_8080"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be full name frdm_mcxn236/mcxn236 ?


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.

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

@hakehuang
Copy link
Contributor

I will get another camera to try, but it looks not like camera issue

I change to another camera which has the same problem.

Add smartdma nodes to NXP MCXN23x dtsi file

Signed-off-by: Neil Chen <[email protected]>
Support smartdma and flexcomm0 for NXP frdm_mcxn236 board.
The default console pins are duplicated with camera header pins, so
add flexcomm0_lpuart0 for smartdma_camera serial output.

Signed-off-by: Neil Chen <[email protected]>
@ngphibang
Copy link
Contributor

I change to another camera which has the same problem.

Maybe the same issue related to log as described here ?
#92299

Add support for using the SMARTDMA engine on the FRDM-MCXN236 board with
the video capture sample.
Replace console pins, because default console pins(P1_8, P1_9) are
duplicated with camera header pins.

Signed-off-by: Neil Chen <[email protected]>
Add video support in frdm_mcxn947 board yaml

Signed-off-by: Neil Chen <[email protected]>
@NeilChen93 NeilChen93 dismissed stale reviews from josuah and ngphibang via 33667b4 June 30, 2025 07:49
@NeilChen93 NeilChen93 force-pushed the add_mcxn236_smartdma_support branch from 639bff4 to 33667b4 Compare June 30, 2025 07:49
@sonarqubecloud
Copy link

@hakehuang
Copy link
Contributor

west build -p auto -b frdm_mcxn947/mcxn947/cpu0 samples/drivers/video/capture --shield dvp_20pin_ov7670 --shield lcd_par_s035_8080

you should use

west build -b frdm_mcxn947/mcxn947/cpu0 --shield=dvp_20pin_ov7670 --shield=lcd_par_s035_8080 -- -DCONFIG_FPU=y -DCONFIG_TEST=y

Copy link
Contributor

@hakehuang hakehuang left a comment

Choose a reason for hiding this comment

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

there is a failure in samples/driver/video/capture which reported in #92299
but not related to this PR.

Copy link
Contributor

@josuah josuah left a comment

Choose a reason for hiding this comment

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

LGTM thank you for the changes!
I am adding a DNM flag so that it does not accidentally arrive in the merge-list before NXP and others could decide if it is ok to add it now that we are in feature-freeze (4.2-rc1 released)

Feel free to remove the DNM flag!

@josuah josuah added the DNM This PR should not be merged (Do Not Merge) label Jun 30, 2025
Copy link
Contributor

@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.

LGTM. The failure with mcxn947 is not related to this PR (CONFIG_TEST is an additional test that helps to automatically detects issues without human check, it is not a CI test to pass ...)

@ngphibang ngphibang removed the DNM This PR should not be merged (Do Not Merge) label Jun 30, 2025
@mmahadevan108
Copy link
Contributor

Please add information about this support and how to test it in the documentation page.

@danieldegrasse danieldegrasse modified the milestones: v4.2.0, v4.3.0 Jul 1, 2025
@danieldegrasse
Copy link
Contributor

Moving to 4.3 milestone as this is a new feature

@nashif nashif merged commit 7dcb3b8 into zephyrproject-rtos:main Jul 19, 2025
34 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants