Skip to content

Draft PR for exploring fixes to 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

Draft
wants to merge 2 commits into
base: rpi-6.12.y
Choose a base branch
from

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.

@@ -112,6 +112,9 @@ MODULE_PARM_DESC(trigger_mode, "Set vsync trigger mode: 1=source, 2=sink");
#define IMX477_REG_XVS_IO_CTRL 0x3040
#define IMX477_REG_EXTOUT_EN 0x4b81

/* Temperature sensor */
#define IMX477_REG_TEMP_SEN_CTL 0x0138
Copy link
Contributor

Choose a reason for hiding this comment

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

As you've defined this, it'd be nice to use that define in mode_common_regs so all instances of 0x0138 are by name.

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

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

2 participants