Skip to content

Conversation

zacck
Copy link
Contributor

@zacck zacck commented Oct 3, 2025

The video capture sample does not work when using a combination of the FRDM-MCXN236 and the OV5640 camera and this is due to the sensor and the underlying interface having different defaults. This patch sets the interface resolution to that selected by the sample which in turn is set in the CONFIG.

Copy link
Contributor

@JarmouniA JarmouniA left a comment

Choose a reason for hiding this comment

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

Please split this into 2 commits: driver changes, sample changes.
Also, explain why the driver change is needed in the commit message.

@zacck zacck force-pushed the pr-patch-sdma-for-mcxn236 branch from 91be28e to bafe2fb Compare October 3, 2025 19:31
@zacck
Copy link
Contributor Author

zacck commented Oct 3, 2025

Please split this into 2 commits: driver changes, sample changes. Also, explain why the driver change is needed in the commit message.

Thank you, this is done.

@zacck zacck force-pushed the pr-patch-sdma-for-mcxn236 branch from bafe2fb to aa93037 Compare October 6, 2025 05:19
@zacck zacck force-pushed the pr-patch-sdma-for-mcxn236 branch from aa93037 to d0069f2 Compare October 8, 2025 15:56
ngphibang
ngphibang previously approved these changes Oct 9, 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.

Could you confirm again this sole commit fixes the issue? I don't have HW to test.

@josuah josuah self-requested a review October 9, 2025 08:29
@zacck
Copy link
Contributor Author

zacck commented Oct 9, 2025

Could you confirm again this sole commit fixes the issue? I don't have HW to test.

Last I checked as stated on discord, no this does not, one needs the samples changes as well.

@zacck
Copy link
Contributor Author

zacck commented Oct 9, 2025

I’ll be at my lab in a couple of hours and will share the results.

@avolmat-st
Copy link

(oups, went too fast looking at previous comments, actually mine are close to some already made by @josuah)

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

josuah commented Oct 9, 2025

Adding a DNM flag that can be removed as soon as #96986 (comment) is ok

@zacck
Copy link
Contributor Author

zacck commented Oct 9, 2025

Could you confirm again this sole commit fixes the issue? I don't have HW to test.

@ngphibang ok here are the results

without the samples commit

*** Booting Zephyr OS build v4.2.0-4814-gbafe2fbba202 ***
[00:00:00.125,000] <inf> main: Video device: video-sdma
[00:00:00.125,000] <inf> main: - Capabilities:
[00:00:00.125,000] <inf> main:   RGBP width [320; 320; 0] height [240; 240; 0]
[00:00:00.125,000] <inf> main: - Video format: RGBP 1280x720
[00:00:00.125,000] <err> nxp_video_sdma: Unsupported format
[00:00:00.125,000] <err> main: Unable to set format

with the samples commit

*** Booting Zephyr OS build v4.2.0-5041-gd0069f2abe68 ***
[00:00:00.125,000] <inf> main: Video device: video-sdma
[00:00:00.125,000] <inf> main: - Capabilities:
[00:00:00.125,000] <inf> main:   RGBP width [320; 320; 0] height [240; 240; 0]
[00:00:00.125,000] <inf> main: - Video format: RGBP 320x240
[00:00:00.139,000] <inf> main: - Supported frame intervals for the default format:
[00:00:00.139,000] <inf> main: - Supported controls:
[00:00:00.139,000] <inf> main:          device: ov5640@3c
[00:00:00.139,000] <inf> video_ctrls:                       Brightness 0x00980900 (int)    (flags=0x00) : min=-15 max=15 step=1 default=0 value=0
[00:00:00.139,000] <inf> video_ctrls:                         Contrast 0x00980901 (int)    (flags=0x00) : min=0 max=255 step=1 default=0 value=0
[00:00:00.139,000] <inf> video_ctrls:                       Saturation 0x00980902 (int)    (flags=0x00) : min=0 max=255 step=1 default=64 value=64
[00:00:00.139,000] <inf> video_ctrls:                              Hue 0x00980903 (int)    (flags=0x00) : min=0 max=359 step=1 default=0 value=0
[00:00:00.139,000] <inf> video_ctrls:                  Gain, Automatic 0x00980912 (bool)   (flags=0x10) : min=0 max=1 step=1 default=1 value=1
[00:00:00.139,000] <inf> video_ctrls:                  Horizontal Flip 0x00980914 (bool)   (flags=0x00) : min=0 max=1 step=1 default=0 value=0
[00:00:00.139,000] <inf> video_ctrls:                    Vertical Flip 0x00980915 (bool)   (flags=0x00) : min=0 max=1 step=1 default=0 value=0
[00:00:00.139,000] <inf> video_ctrls:             Power Line Frequency 0x00980918 (menu)   (flags=0x00) : min=0 max=3 step=1 default=1 value=1
[00:00:00.140,000] <inf> video_ctrls:                                  0: Disabled
[00:00:00.140,000] <inf> video_ctrls:                                  1: 50 Hz
[00:00:00.140,000] <inf> video_ctrls:                                  2: 60 Hz
[00:00:00.140,000] <inf> video_ctrls:                                  3: Auto
[00:00:00.140,000] <inf> video_ctrls:                    Analogue Gain 0x009e0903 (int)    (flags=0x0c) : min=0 max=1023 step=1 default=0 value=16
[00:00:00.140,000] <inf> video_ctrls:                       Pixel Rate 0x009f0902 (int64)  (flags=0x01) : min=24000000 max=96000000 step=1 default=48000000 value=24000000
[00:00:00.140,000] <inf> video_ctrls:                     Test Pattern 0x009f0903 (menu)   (flags=0x00) : min=0 max=4 step=1 default=0 value=0
[00:00:00.140,000] <inf> video_ctrls:                                  0: Disabled
[00:00:00.140,000] <inf> video_ctrls:                                  1: Color bars
[00:00:00.140,000] <inf> video_ctrls:                                  2: Color bars with rolling bar
[00:00:00.140,000] <inf> video_ctrls:                                  3: Color squares
[00:00:00.140,000] <inf> video_ctrls:                                  4: Color squares with rolling bar
[00:00:00.140,000] <inf> main: Capture started

cc @josuah @avolmat-st

let me know if I should add back the samples commit

@avolmat-st
Copy link

cc @josuah @avolmat-st

let me know if I should add back the samples commit

Do you mean the 2 proposals I mentioned above in the driver ? Well if that's easy and you have possibility to do that, why not ;)
Those are not blocking remarks so that is up to you.

@zacck
Copy link
Contributor Author

zacck commented Oct 9, 2025

cc @josuah @avolmat-st
let me know if I should add back the samples commit

Do you mean the 2 proposals I mentioned above in the driver ? Well if that's easy and you have possibility to do that, why not ;) Those are not blocking remarks so that is up to you.

Oh no no, your comments I will add but there is a commit that we are unclear on it looks like below

/frdm_mcxn236.conf
index 0f4576e59d1..ad449bf981a 100644
--- a/samples/drivers/video/capture/boards/frdm_mcxn236.conf
+++ b/samples/drivers/video/capture/boards/frdm_mcxn236.conf
@@ -1 +1,3 @@
 CONFIG_VIDEO_BUFFER_POOL_SZ_MAX=40000
+CONFIG_VIDEO_FRAME_WIDTH=320
+CONFIG_VIDEO_FRAME_HEIGHT=240

I am positive this is needed but Phi thinks otherwise and I do trust he knows why but I cant seem to make it work without this.

@zacck
Copy link
Contributor Author

zacck commented Oct 13, 2025

@avolmat-st @ngphibang @josuah I would appreciate another review round I think I applied all the required changes.

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.

Although the 2nd commit is not really needed for the capture sample, configuring the frame width & height is still OK to ensure that if, for some reason, the sample application does not get the format before setting the format, it's still working.

BTW, could you change the commits title, to something like :

drivers: video: mcux_sdma: Reconfigure the source when getting format
Reconfigure the sensor format with the only supported format of the sdma when getting format

samples: video: capture: Configure frame width and heght for mcxn236

Thanks !

@zacck
Copy link
Contributor Author

zacck commented Oct 13, 2025

Although the 2nd commit is not really needed for the capture sample, configuring the frame width & height is still OK to ensure that if, for some reason, the sample application does not get the format before setting the format, it's still working.

BTW, could you change the commits title, to something like :

drivers: video: mcux_sdma: Reconfigure the source when getting format
Reconfigure the sensor format with the only supported format of the sdma when getting format

samples: video: capture: Configure frame width and heght for mcxn236

Thanks !

Can do!

@zacck zacck force-pushed the pr-patch-sdma-for-mcxn236 branch from 9d964a7 to 2ca712a Compare October 13, 2025 10:14
zacck added 2 commits October 13, 2025 18:23
Reconfigure the sensor format with the only supported format of the
sdma when getting format

Signed-off-by: Zacck Osiemo <[email protected]>
SDMA as the video interface on this board requires
this size frame to be set for the sample to work

Signed-off-by: Zacck Osiemo <[email protected]>
@zacck zacck force-pushed the pr-patch-sdma-for-mcxn236 branch from 2ca712a to f059ace Compare October 13, 2025 16:26
@zacck zacck requested a review from ngphibang October 13, 2025 16:28
Copy link

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.

The 2nd commit message needs a bit rewording but not a big problem to me. Thanks.

@ngphibang ngphibang requested review from josuah and removed request for josuah October 13, 2025 17: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.

Thanks for the commits/testing/bugfix!
This will help working with more sensors.

Copy link
Contributor

@josuah josuah Oct 15, 2025

Choose a reason for hiding this comment

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

Some light commit message rewording could be:

**With** SDMA as the video interface on this board**, it** requires
**the frame size** to be set for the sample to work

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

Removed DNM label as it seems @josuah has approved but forgot to do it.

@ngphibang ngphibang added this to the v4.3.0 milestone Oct 16, 2025
@cfriedt cfriedt merged commit 7f6937d into zephyrproject-rtos:main Oct 16, 2025
27 checks passed
Copy link

Hi @zacck!
Congratulations on getting your very first Zephyr pull request merged 🎉🥳. This is a fantastic achievement, and we're thrilled to have you as part of our community!

To celebrate this milestone and showcase your contribution, we'd love to award you the Zephyr Technical Contributor badge. If you're interested, please claim your badge by filling out this form: Claim Your Zephyr Badge.

Thank you for your valuable input, and we look forward to seeing more of your contributions in the future! 🪁

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.

7 participants