Skip to content
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

Add an example of 2ch video capture. #2538

Merged
merged 9 commits into from
Apr 8, 2024

Conversation

kkitayam
Copy link
Collaborator

Describe the PR
Add an example of 2ch video capture.
Each channel represents an individual camera, but the video format used is the same.

Additional context
For reference, please see #2520.

@kkitayam kkitayam marked this pull request as draft March 24, 2024 13:57
@kkitayam kkitayam marked this pull request as ready for review March 25, 2024 14:34
@HiFiPhile
Copy link
Collaborator

Tested works well on STM32F407-DISCO and Nucleo-STM32G0B1.

@hathach
Copy link
Owner

hathach commented Apr 3, 2024

Tested on rp2040 and it works well. We may make 2 stream a bit different so that it is clearer which is stream (we can do it as follow-up PR no problems).

I add the new example to cmakelist include directoy, seem like some small MCU has SRAM overflowed with 2 stream buffer. I will check and exclude (add them to skip.txt) later on.

hathach added 2 commits April 5, 2024 00:52
this help reduce sram requirement for example, also provide different format (uncompressed & mpeg)
@hathach
Copy link
Owner

hathach commented Apr 4, 2024

Just push an update uvc 2ch example to stream0 use yuy2, stream1 use mpeg, this help reduce sram requirement for example, also provide different format (uncompressed & mpeg)
fixing build with lpc18xx, will fix more ci next

@HiFiPhile
Copy link
Collaborator

HiFiPhile commented Apr 4, 2024

With new changes for camera 2 bulk is ok but iso (#2567 applied) gives a strange output on STM32G0.

In the capture STM32G0 sends packets every frame while STM32F4 sends much less.

capture.zip

Then I added a gpio toggle in tud_video_frame_xfer_complete_cb, for camera 1 it toggles every 100ms, for camera 2 it toggles about every 1ms.... Seems fsdev driver need some fix...

@hathach
Copy link
Owner

hathach commented Apr 5, 2024

With new changes for camera 2 bulk is ok but iso (#2567 applied) gives a strange output on STM32G0.

In the capture STM32G0 sends packets every frame while STM32F4 sends much less.

capture.zip

Then I added a gpio toggle in tud_video_frame_xfer_complete_cb, for camera 1 it toggles every 100ms, for camera 2 it toggles about every 1ms.... Seems fsdev driver need some fix...

yeah, seems like fsdev specific issue, I have tested with rp2040 and it works great so far. Still trying to fix build with the rest of the mcus. We probably need a separated issue/pr for fsdev.

Copy link
Owner

@hathach hathach left a comment

Choose a reason for hiding this comment

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

everything is all good. I have change the 2 stream to have different format. @kkitayam please revise the changes in recent commit. Thank you for another brilliant PR. Let me know if this change make sense to you, and we can merge this.

@HiFiPhile regarding the fsdev driver issue with 2 ISO stream. We probably need to have its own issue/pr to fix.

@HiFiPhile
Copy link
Collaborator

regarding the fsdev driver issue with 2 ISO stream. We probably need to have its own issue/pr to fix.

Yeah, I've nearly sorted it out. For ISO transfer fsdev doesn't clear endpoint state upon transfer completion, once next IN token received it just resend current packet (even CPU halted) and trigger rx interrupt without way to mask...

The issue wasn't caught as in old examples the number of IN token corresponds to packets needs to send, but here all ZLP sent automatically are triggering rx interrupt.

@HiFiPhile HiFiPhile mentioned this pull request Apr 5, 2024
@hathach hathach merged commit ffab7bf into hathach:master Apr 8, 2024
94 checks passed
@kkitayam kkitayam deleted the add_uvc_2ch_example branch April 8, 2024 14:38
@HiFiPhile
Copy link
Collaborator

@hathach When I use CFG_EXAMPLE_VIDEO_READONLY I got incorrect output on stream 1 with both fsdev and dwc2 driver.

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

Successfully merging this pull request may close these issues.

3 participants