1

What provides the clock signal for the CSI2 interface used for many cameras? Does the camera provide it or is it the processor the camera is interfacing to?

hacktastical
  • 49,832
  • 2
  • 47
  • 138
FourierFlux
  • 660
  • 3
  • 16

1 Answers1

2

MIPI CSI-2 data clock comes from the camera as a separate pair (D-PHY) or encoded with the signal (C-PHY).

In D-PHY both clock edges are used to sample data from the data lanes. In C-PHY every trio change-of-state encodes a clock and a multi-bit symbol, this clock is recovered by the receiver.

Now, let’s talk about the camera timebase.

Normally, the camera reference clock, or timebase, originates from the camera itself from a local crystal oscillator. This reference isn’t output by the camera directly, but the delivered data rate and frame rate would be related to it.

The host can optionally provide a reference clock to the camera, separate from the MIPI data signals, as a timebase reference. 24MHz is common.

Another method is to provide a frame sync or trigger signal to the camera. The camera will send its frame each time it is triggered.

Either way, this host-driven reference is typically used for multi-camera setups to synchronize the frames (e.g., for stereo, multi-focal or surround cameras.)

hacktastical
  • 49,832
  • 2
  • 47
  • 138
  • I was wondering about this, I don't understand why the host doesn't drive the clock since it would make time syncing a lot easier. There are different ways people try to synchronize the IMX219 cameras on the jetson nano but unless there is some way to have them share a clock it's basically not possible for them to stay synced due to oscillator drift between them. – FourierFlux Feb 13 '23 at 18:48
  • I believe the Nano can provide reference clocks and/or frame sync to its CSI-2 ports. There are pins allocated on the connectors for this purpose. R.pi camera connectors also have extra signals that can be used for clock or frame sync. – hacktastical Feb 13 '23 at 19:18
  • I confirmed that the Nano provides MCLK to its CSI-2 header. MCLK. Typically around 24MHz. Check with NVidia on how to enable it. In my opinion it's not as good of an option as providing a frame sync signal, because even with a shared timebase the frames could still be not aligned closely. And, at 24MHz, it's a noise source getting kicked to the camera. – hacktastical Feb 13 '23 at 21:11
  • Raspberry pi has an MCLK and generic GPIO, the latter which can be defined by the user. – hacktastical Feb 13 '23 at 21:17
  • It looks like the cameras use their own 24Mhz oscillator, maybe this means it's not possible to use the system clock. – FourierFlux Feb 13 '23 at 22:08
  • You would need to change the camera setting to accept the external reference clock. – hacktastical Feb 13 '23 at 22:14
  • This may be of interest: https://www.arducam.com/jetson-nano-stereo-camera-sync-issue-arducam/ – hacktastical Feb 13 '23 at 22:21
  • Yeah thanks, I have a couple monochrome cameras with external trigger I will use but it was a very odd design choice. The new Pi Camera lets you sync through connecting a couple wires. I have a stereo board for the IMX219 but they didn't tie the clocks together which was very odd - could have tweaked it a little and had synchronized system. – FourierFlux Feb 13 '23 at 23:18