OV5640 FREX mode

Hello All,

Im eagerly awaiting my OpenMV Cam H7 +. One exciting feature I am looking forward to exploring FREX mode. I see it has been mentioned several times in the forum but not explored in great detail.

A little background about FREX mode also called Global Reset Mode:

The OV5640 is a rolling shutter. Rolling shutter are not well suited for capturing objects that are moving. For example try taking a photo of a fan while it is turned on. The resulting image will be distorted. This is do to the way the shutter is exposed.

The OV5640 is a unique camera sensor as it support FREX mode. This is a feature not really found in affordable camera sensors. Here is a description from the docs:

Compared with normal(rolling) exposure mode, frame exposure allows all rows integrated simultaneously rather than row by row. It is mainly used in image capture and can work accompany with flash strobe function to increase image brightness under dark situation.
Generally, the function works as follows:
(1) Initially, the sensor is in normal exposure mode. The electrical shutter is open.
(2) User sends a frex request.
(3) Photo-diode of all pixels in all rows start precharge and the precharge will last for a given time.
(4) Until a given precharge time, the precharge phase stops and all pixels start integration.
(5) During integration, flash strobe may turn on to increase exposure.
(6) Until a given exposure time, the electrical shutter closes to stop further integration, and whole image is then start to readout.
(7) After the readout is finished, the electrical shutter opens again and the sensor resume to normal mode.

How is FREX a benefit?

Essentially the camera can mimic a global shutter sensor. In global reset mode, all of the pixels on the sensor begin collecting charge simultaneously, rather than row by row. The end of integration, however, is still delayed on the sensor row by row from top to bottom as readout takes place. One result of this behavior is a partial reduction in motion blur and other effects typical of rolling shutters.


Technial Questions:

Will the OpenMV Cam H7 + have direct access to the Frex and Strobe pins?
If the pins are not exposed will we be able to write registers to the sensor to activate FREX and Strobe?
FSM12MGE_glovalreset.png


Rolling-Shutter.gif

1 Like

Hi, yes, this pin is hooked up on the OpenMV Cam H7.

Note the schematic is here: openmv-boards/OV5640.pdf at master · openmv/openmv-boards · GitHub

STORE is not hooked up. I read the data sheet on that pin and it’s useful for flash control. Anyway, the FSIN pin is on one of the OpenMV Cam H7 Plus headers. You can wire it to any I/O pin to control it. It’s on an external I/O pin so multiple units can be connected to each other.

Yes, you have direct register access with sensor.__read_reg() and sensor.__write_reg(). You can directly copy register addresses from the data sheet to peek and poke at things. I will include a sensor.ioctl() however to make this feature operational for you also.

Awesome! Looking forward to it. I’ll document all of my findings here.

Here is some interesting stuff about Frex and the OV5640 camera, from the raspberry pi forum:

The main issues I have with his execution is requiring that raspivid_ges has to be run then the frex commands issued during the stream. So the stream is constantly writing to disk taking up space then you have to manually use something like ffmpeg to extract frames from the video file to grab only the frames where you issued the Frex commands. Then do the processing.

From my understanding of how frex works the camera needs to be in “free run” then the frex commands can be initialized.

Ideally I imagine it working like this:
Have the camera running in free run mode the at a reduced resolution checking for motion.
Motion Detected
Switch the camera into single frame acquisition mode with a exposure time of 2ÎĽs.
Begin Frame acquisition
send 4 frex signals
end frame acquisition
send frame to camera ram for processing with machine vision algorithm.


Should get my cameras soon so I will probably be more useful once I finally get my hands on some hardware. :smiley:

Hi, I have exactly the same issue in using OV5640.
I read in a software application notes of OV5640, which is modified in May 25, 2011, mentioned that “…In both Mode 1 and Mode 2, we have the option(0x3817[3]) of turning off normal(rolling) mode timing. In that case, the sensor will not output image unless frex request comes. Every single request results in one single frame of image.”
I tried changing that resgister 0x3817, but no difference occurred, the normal(rolling) mode still running.
Do you guys find anything new about it?

Haven’t gotten t working on this. Will do soon.

Hi,

I am also interested in using the FREX mode available in the OV5640 for acquiring single frame images. Has any progress been made in making this work with the H7+?

None, it’s a low priority for me. You should create a GitHub issue ticket about it so that it’s tracked.

I have to fix an issue with the register settings for the OV5640 involving the greenish spot in the center of the field of view under certain lighting situations. So, I can look at adding an IOCTL to enable this then.