Skip to content

Candidate fixes for camera sync issues #6863

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

Merged
merged 2 commits into from
Jun 3, 2025

Conversation

njhollinghurst
Copy link
Contributor

@njhollinghurst njhollinghurst commented May 19, 2025

Two issues currently, one is #5821 and is specific to Raspberry Pi 5.

There is also an IMX477 issue, where there are very rarely extra XVS pulses, causing receiving cameras to record a blank frame.

To avoid lost frame start in a subsequent session, avoid setting
the number of lanes back to 1 or putting CSI-2 Host into reset.

It's not clear if this is a watertight fix -- what if the camera
itself produced a truncated or garbled packet, or continued to
send until the next start? -- but it does seem to fix the issue.

Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
Copy link
Contributor

@6by9 6by9 left a comment

Choose a reason for hiding this comment

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

Largely looks fine. Two very minor comments.

@6by9
Copy link
Contributor

6by9 commented May 20, 2025

My comments are largely in regard to the imx477 change. I know very little of the CFE DPHY side.

@njhollinghurst njhollinghurst force-pushed the camera-sync branch 2 times, most recently from 96379b5 to f1b9630 Compare May 20, 2025 17:53
@njhollinghurst njhollinghurst changed the title Draft PR for exploring fixes to camera sync issues Candidate fixes for camera sync issues May 21, 2025
@njhollinghurst njhollinghurst marked this pull request as ready for review May 21, 2025 09:32
@njhollinghurst
Copy link
Contributor Author

I think we need these changes (or something similar) for reliable cam->cam sync of IMX477 on Pi5.

But I guess we should hold off merging, until we get a comment from Sony about the temperature sensor issue. Perhaps they will recommend some simpler fix -- a chicken bit perhaps?

@njhollinghurst njhollinghurst marked this pull request as draft May 30, 2025 09:54
On IMX477 it appears that the on-chip temperature sensor causes
XVS (external sync out) to pulse every ~2ms when not streaming.

So now we do a little dance: Temperature sensor is enabled during
common register setup, giving it time to warm up (almost literally;
otherwise the first frame's reading might be 0C), disabled before
enabling sync out, then enabled again once the camera is streaming.

We already took care to disable XVS output in stop_streaming()
(though previously it wasn't understood why this was needed).

Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
@njhollinghurst
Copy link
Contributor Author

njhollinghurst commented Jun 3, 2025

Swapped two register writes in the second (IMX477) commit to make it closer to manufacturer's recommendation.
I think this is good to go now.

@njhollinghurst njhollinghurst marked this pull request as ready for review June 3, 2025 10:51
@pelwell pelwell merged commit 35ed272 into raspberrypi:rpi-6.12.y Jun 3, 2025
12 checks passed
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Jun 3, 2025
kernel: overlays: sc16is75x: Add generic SPI overlay
See: raspberrypi/linux#6865

kernel: add mira220 image sensor
See: raspberrypi/linux#6717

kernel: defconfigs: Enable WATCHDOG_SYSFS
See: raspberrypi/linux#6875

kernel: drivers: pci: hailo: Better lock handling when calling find_vdma()
See: raspberrypi/linux#6868

kernel: drivers: media: imx500: Enable sensor temperature monitoring
See: raspberrypi/linux#6877

kernel: firmware: rp1: Rename to rp1-fw to avoid module name collision
See: raspberrypi/linux#6879

kernel: Candidate fixes for camera sync issues
See: raspberrypi/linux#6863
popcornmix added a commit to raspberrypi/rpi-firmware that referenced this pull request Jun 3, 2025
kernel: overlays: sc16is75x: Add generic SPI overlay
See: raspberrypi/linux#6865

kernel: add mira220 image sensor
See: raspberrypi/linux#6717

kernel: defconfigs: Enable WATCHDOG_SYSFS
See: raspberrypi/linux#6875

kernel: drivers: pci: hailo: Better lock handling when calling find_vdma()
See: raspberrypi/linux#6868

kernel: drivers: media: imx500: Enable sensor temperature monitoring
See: raspberrypi/linux#6877

kernel: firmware: rp1: Rename to rp1-fw to avoid module name collision
See: raspberrypi/linux#6879

kernel: Candidate fixes for camera sync issues
See: raspberrypi/linux#6863
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