6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5805
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Hardware camera sync pulses

Thu Aug 02, 2018 10:02 am

gordon77 wrote:
Thu Aug 02, 2018 8:08 am
6by9 wrote:
Mon Aug 07, 2017 4:00 pm
There have been various requests over the years for external triggers for frame synchronisation. Generally it's been stated that doing such things isn't trivial, and it wasn't. However, as of the 22nd July firmware, there is support for repurposing the camera LED GPIO to change state on frame start and frame end interrupts.....
I don't quite see how this externally triggers cameras, it appears it just shows you when a picture is being taken. Anyone got any details how it can be used to trigger cameras?
It can't be, and I don't think I've ever said it could be.
You can use it alongside the frame rate control to produce effectively a phase lock loop that will pull things in to sync over a few seconds and keep them there.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

gordon77
Posts: 3403
Joined: Sun Aug 05, 2012 3:12 pm

Re: Hardware camera sync pulses

Thu Aug 02, 2018 12:24 pm

6by9 wrote:
Thu Aug 02, 2018 10:02 am
gordon77 wrote:
Thu Aug 02, 2018 8:08 am
6by9 wrote:
Mon Aug 07, 2017 4:00 pm
There have been various requests over the years for external triggers for frame synchronisation. Generally it's been stated that doing such things isn't trivial, and it wasn't. However, as of the 22nd July firmware, there is support for repurposing the camera LED GPIO to change state on frame start and frame end interrupts.....
I don't quite see how this externally triggers cameras, it appears it just shows you when a picture is being taken. Anyone got any details how it can be used to trigger cameras?
It can't be, and I don't think I've ever said it could be.
You can use it alongside the frame rate control to produce effectively a phase lock loop that will pull things in to sync over a few seconds and keep them there.
Thanks. It looks like I misunderstood "There have been various requests over the years for external triggers for frame synchronisation."

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5805
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Hardware camera sync pulses

Sun Aug 05, 2018 1:05 pm

gordon77 wrote:
Thu Aug 02, 2018 12:24 pm
Thanks. It looks like I misunderstood "There have been various requests over the years for external triggers for frame synchronisation."
True, I could have possibly phrased that better - now edited.
This is purely an output which synchronised with frame start/end events as received by the SoC.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Kozuch
Posts: 62
Joined: Sun Aug 10, 2014 10:35 am

Re: Hardware camera sync pulses

Sat Sep 15, 2018 6:27 pm

Do the camera sync pulses also work with the very high FPS mode that user HermannSW showed in the Raw sensor access / CSI-2 receiver peripheral thread? And also here. He claims some 900-1000 FPS.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5805
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Hardware camera sync pulses

Sat Sep 15, 2018 6:53 pm

Kozuch wrote:
Sat Sep 15, 2018 6:27 pm
Do the camera sync pulses also work with the very high FPS mode that user HermannSW showed in the Raw sensor access / CSI-2 receiver peripheral thread? And also here. He claims some 900-1000 FPS.
IIRC then no. They only work with the full camera stack, not rawcam/raspiraw.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Kozuch
Posts: 62
Joined: Sun Aug 10, 2014 10:35 am

Re: Hardware camera sync pulses

Sat Sep 15, 2018 10:50 pm

That really is a pity. Do you think there could be a way to get the closest possible to the moment when a frame is taken in raw camera mode?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5805
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Hardware camera sync pulses

Sun Sep 16, 2018 9:25 am

Kozuch wrote:
Sat Sep 15, 2018 10:50 pm
That really is a pity. Do you think there could be a way to get the closest possible to the moment when a frame is taken in raw camera mode?
I can do the same thing as for the main stack (it's less plumbing there too), although it still makes little real world sense with a rolling shutter camera where there isn't a single instant of capture.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Kozuch
Posts: 62
Joined: Sun Aug 10, 2014 10:35 am

Re: Hardware camera sync pulses

Sun Sep 16, 2018 1:01 pm

Sync does make a big reason for rolling shutter, especially when combined with a special camera mode (raw in this case) which further shortens the image readout etc. (in low resolution, but that is OK for many computer vision applications). There are also moments when the shutter speed is very short and the rolling shutter is negligible (I can think of a sunny outdoor scene etc.).

ds72
Posts: 3
Joined: Fri Sep 14, 2018 10:27 pm

Re: Hardware camera sync pulses

Tue Oct 30, 2018 8:37 pm

fishbeetle wrote:
Tue May 15, 2018 1:23 pm
Hi There,
I'm trying to use the LED flash sync feature in continuous grab mode on a Pi3B with a v2 camera. I followed the instructions from above and was able to get the flash pulse(s) for single grabs but in continuous grab mode (with exposure_mode off) I get no pulses. Should this possible?
---
EDIT
Subsequently, I re-tried disable_camera_led=2 in config.txt & re-compiling an edited dt-blob file to map IO17 to camera-0-LED and it works
perfectly.
---
Thanks again.
Steve.
I'm a little confused here, maybe someone can clear up for me. I also have a V2 camera but there's no LED on V2. How is the signal for the LED captured if it's not on the board?

ethanol100
Posts: 540
Joined: Wed Oct 02, 2013 12:28 pm

Re: Hardware camera sync pulses

Wed Oct 31, 2018 1:15 pm

ds72 wrote: I'm a little confused here, maybe someone can clear up for me. I also have a V2 camera but there's no LED on V2. How is the signal for the LED captured if it's not on the board?
The LED is not captured, the camera module and the Raspberry Pi's Image Signal Processor(ISP) are communicating. The ISP now uses these information to toggle the previously defined GPIO for the camera LED. Basically when it starts receiving some data, it will say "Yes I'm getting some data lets turn on the GPIO" and when the last piece of data is received it says "This is finished now, I will turn off the GPIO again".

It was just convenient to already have defined one GPIO which is used for the LED on the camera module, which is just re-purposed for the trigger pulses. Just lighting up a LED is not very useful and you need to assign the "camera LED" pin to another GPIO, this is done using the dt-blob. Now an external thing can be connected to this newly configured GPIO and gets informed when the image is captured. This could be for example a motor which will need to move to the next frame of a film roll to digitalize the film frame by frame.

(This is simplified, as we can configure if the ISP turns the led on or off during capture...)

jyviko
Posts: 2
Joined: Sat Apr 26, 2014 8:36 am

Re: Hardware camera sync pulses

Wed Nov 14, 2018 12:01 am

Hi All,
First of all, thank you for the effort making this happen!

I might have read this thread 100 times and I am still not able to get pulses from the camera. I have an RPI3+ and RPI3v1.2. I have added the following under pins_3bplus and pins_3b2, respectively, under pin_config:

Code: Select all

[email protected] { function = "output"; termination = "no_pulling"; }; // GPU WILL USE THIS PIN FOR CAMERA 0 LED
and under pin_defines:

Code: Select all

[email protected]_0_LED {
type = "internal";
number = <0x15>;
};
Should type be "external"? Moreover, should disable_camera_led in config.txt be 2 or 3? I would like to get a trigger using both the still and the video port mode.

Currently, I am planning to connect GPIO21 to GPIO20 and trigger an event once the state has changed. Is there a way to get the state of GPIO21 internally and attach a callback without connecting it to another pin?

Thank for your help and feedback
Jyviko

gordon77
Posts: 3403
Joined: Sun Aug 05, 2012 3:12 pm

Re: Hardware camera sync pulses

Wed Nov 14, 2018 11:14 am

To use pin 18 I changed...

Lines 1226 to 1228 to

Code: Select all

   [email protected]_0_LED {
               type = "internal";
               number = <18>;
and LIne 1193 to

Code: Select all

[email protected] { function = "output"; termination = "no_pulling"; }; // Camera LED
whether you use 2 or 3 depends which way you want the pulse to go

If 2, the camera LED GPIO will go low on a frame start, and high on frame end.
If 3, the camera LED GPIO will go high on a frame start, and low on frame end.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5805
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Hardware camera sync pulses

Wed Nov 14, 2018 12:25 pm

Don't forget to compile the dt-blob.dts file into a dt-blob.bin.

Code: Select all

sudo dtc -I dts -O dtb -o /boot/dt-blob.bin dt-blob.dts
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Return to “Camera board”