profile
viewpoint

Ask questionsExposure failure with ov9281_external_trigger.c

I am trying to run a handful of ArduCam's OV9281 modules with a synchronized external trigger, but I am running into issues when I run the ov9281_external_trigger.c code to change the trigger mode.

At the moment the write_regs() function is called (tested by changing the argument of the preceding usleep() function), the camera exposure seems to drop to nearly zero, outputting all black except when pointed at a bright light source. The below images are taken of my ceiling, before and after the change.

Reducing the clock pulse frequency (supplied via pigpio on a Raspberry Pi separate from the one controlling the camera) from 60Hz to 30Hz returns the camera to normal exposure but results in alternating frames of normal video and all black--presumably because the software is expecting twice as many frames as it is receiving.

My best guess is that at 60Hz, the camera's exposure isn't complete when the next trigger pulse comes in, leading to the described failure, but manually changing V4L2_CID_EXPOSURE and V4L2_CID_GAIN has no effect, regardless of the status of arducam_software_auto_exposure() and arducam_set_resolution(). Is there an undocumented loss of user control over exposure time associated with the register changes in write_regs()?

Other diagnostics notes:

  • I have tried swapping out both the OV9281 and the Raspberry Pi it is connected to with no change
  • I have checked the clock signal with an oscilloscope and it is a clean 3.3V pulse at the expected frequency

Screenshot from 2019-08-02 11-37-58 Screenshot from 2019-08-02 11-38-34

ArduCAM/MIPI_Camera

Answer questions kpmoorse

With some help from Lee at ArduCam, I was able to find a two-step solution:

  1. If you call arducam_set_resolution() a second time after calling write_regs(), you regain control of the V4L2 settings without undoing the switch to external trigger mode. Why this works is a mystery, but it does the job.

  2. Fixing that problem introduced an irregular jitter where some frames had the rightmost few columns of pixels wrapped around to the left. It turns out that in my system, with an external raspberry pi supplying the clock pulse to the camera, I needed to have GND and FSIN connected (obviously), but I needed to disconnect VCC in order to get rid of the jitter.

        Untitled Diagram

The C code that I can now use to switch the camera to external trigger mode and dump the bitstream to stdout can be found here.

useful!

Related questions

No questions were found.
Github User Rank List