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

Re: Hardware camera sync pulses

Sun Apr 28, 2019 3:16 pm

I thought the idea was you redirect the output to a gpio you do have access to, eg one of the GPIO pins on the pi.

To use pin 18 I changed... (note not a zero)

Lines 1226 to 1228 to

pin_define@CAMERA_0_LED {
type = "internal";
number = <18>;

and LIne 1193 to

pin@p18 { 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.
Last edited by gordon77 on Tue Jun 04, 2019 8:29 am, edited 1 time in total.

User avatar
HermannSW
Posts: 1239
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Hardware camera sync pulses

Tue Jun 04, 2019 6:55 am

In my 4 months ago posting in this thread I was finally able to get the hardware sync pulses show up on GPIO18. But until yesterday I had no real application making use of that firmware feature.

Because of "Raspberry v1 camera global external shutter" tool "shots" missing synchronization of generating strobe pulses and camera frame capturing I had to go back to pigpio C library yesterday. If the total length of the "shots" waveform is less than 0.5s, then getting all pulses recorded onto a single "-fps 1" raspivid frame is not really a problem (just try several times). But I had to try 15 times to get two 9µs strobe pulses 0.9s apart onto a same frame.

I remembered this thread and used the frame end signal to start the waveform just in time for the new frame to be recorded. The passed argument N states how many frames with (this time 0.925s apart) double exposure should be taken. I tried with 20 and each and every frame got its double exposure correctly. I learned about gpioSetAlertFunc() function, and with that function the code is simple.

More details in "Hardware camera sync pulses" section on "Raspberry v1 camera global external shutter" github repo:
https://github.com/Hermann-SW/Raspberry ... ync-pulses


I did try with double exposure pulses 0.95s apart and got two strange frames instead of one. Because the length between both pulses can be specified with microsecond resolution, it seems that arbitrary length partial frames can be generated (I see no use of that for now, and that was exactly what I wanted to avoid). Anyway it is nice to see that these exact timings are possible thanks to the 2017 firmware change in this thread.

This is the 1st strange frame (as I said this never happens with strobe pulses 0.925s apart). The 2nd strobe pulse happens while nearly half of the frame got transmitted to Pi already, and thefore only the lower left part of the blade shows up on 1st frame:
Image


And this is the 2nd:
Image



These are samples for 0.925s apart strobe pulses, captured on a single frame thanks hardware camera sync pulses. The relative blade positions in each frame differ because of slight changes of propeller speed:
Image


Image


Image
bookmark list: https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://github.com/Hermann-SW/fork-raspiraw
https://github.com/Hermann-SW/userland
https://twitter.com/HermannSW

Kinn
Posts: 1
Joined: Fri Jul 12, 2019 5:53 am

Re: Hardware camera sync pulses

Fri Jul 12, 2019 5:55 am

The dts has no entry for the pi4b, any way to get this working?

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

Re: Hardware camera sync pulses

Fri Jul 12, 2019 9:08 am

Kinn wrote:
Fri Jul 12, 2019 5:55 am
The dts has no entry for the pi4b, any way to get this working?
You've already raised it as https://github.com/raspberrypi/firmware/issues/1186, so no point in posting here as well.
In turn you didn't do even a brief search there, as the question is a duplicate of https://github.com/raspberrypi/firmware/issues/1176
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Return to “Camera board”