Strobe signal output on Pointgrey Firefly MV using libdc1394

1.1k Views Asked by At

I am using a Pointgrey Firefly MV (FFMV-03M2M/C to be precise) and want to trigger some external device with every shutter start. According to the datasheet, the camera supports IIDC 1.31 and also provides four GPIOs usable as a trigger and/or strobe signal outputs. As described in section 4.11.3 of the IIDC standard it should be possible to configure those strobe signal outputs using IIDC.

My application is implemented in C++ and uses libdc1394 to access and control the camera. So far, everything works quite nicely, but I cannot manage to configure the strobe signal outputs. As far as I understand libdc and IIDC it should be possible to enable the first output as follows (camera is a pointer to a valid dc1394camera_t):

dc1394error_t err;
uint64_t strobe_offset = 0x200;
uint32_t strobe_settings = 0;

err = dc1394_get_strobe_register(camera, strobe_offset, &strobe_settings);
if (err == DC1394_SUCCESS) {
    /* Set bits 6 (strobe on) and 7 (active-high level)
       IIDC uses msb 0, so we need to shift by 25/24 instead of 6/7 */
    strobe_settings = strobe_settings | (1 << 25) | (1 << 24);

    err = dc1394_set_strobe_register(camera, strobe_offset, strobe_settings);

}

if (err != DC1394_SUCCESS) {
    log(LOG_ERROR, "Failed to set strobe.");
}

This does not generate any errors, but it also does not turn on the strobe signal output (even though the camera is capturing frames). I also tried all the other outputs by using a different offset (0x204, 0x208 and 0x20C) but to no avail. Then I checked all the availability inquiry fields at Strobe_CTRL_Inq and Strobe_[0123]_Inq but they all report that the strobe signal outputs are present. But interestingly, the On/Off_Inq field in Strobe_[0123]_Inq tells me that it is not possible to switch the output on or off while the Polarity_Inq tells me that I could change the polarity setting (which I actually can't because you can only change settings when the strobe signal output is switched on). I tried configuring the outputs using the windows based driver utility provided by Pointgrey and there it works without any problems.

Any ideas what I might be doing wrong? Or is this camera not IIDC compatible in this regard?

Update: Ok, I tried three ways to enable the strobe output: Using my orignal code, using the absolute offset 0x1300 as suggested in the answer and using the offset 0x1110/0x1114 as written in the PointGrey register reference manual. I also tried setting delays, durations and/or directions (even though PIOs are not to be confused with the strobe outputs). No combination of registers and flags works so far. Maybe it is a bug in libdc1394 or PointGrey does some other magic in their proprietary driver. For now I give up and will try to find a different solution for triggering an external device.

1

There are 1 best solutions below

2
On BEST ANSWER

Browsing through the (accessible, can't get to the technical reference) camera documentation it seems like you need to set a direction for the GPIOs, that is whether they are inputs or outputs. The documentation describes a PIO_DIRECTION register at 0x11F8 where low signifcant bits control whether the IO is input (0) or output (1). Perhaps your problem is that the direction is not set?

http://ptgrey.com/support/downloads/documents/TAN2005002_Output_strobe_signal_pulse.pdf

Comparing the camera register map with the standard it seems like the camera should support this. I can't find any documentation for get/set_strobe_register API in libdc1394. Perhaps get or set_register using the camera documented register offsets would work better. How did you figure 0x200 as your offset?

This http://www.cs.unc.edu/Research/stc/FAQs/Cameras_Lenses/PtGrey/DcamRegisterRefManual.pdf documents the register you're trying to access at 0x1300 so perhaps there is some fixed known offset applied for accessing "strobe" registers? Again, perhaps using set_register will allow access to all the camera registers directly so you can use the older set documented.

Another thing is that you need to set a delay and count for the strobe.