OV5640 Auto Focus support on i.MX8M Mini

Showing results for 
Search instead for 
Did you mean: 

OV5640 Auto Focus support on i.MX8M Mini

Contributor I

Hi everyone,

I'm working on a project using an i.MX8M Mini Processor SOM that runs on Android 9 Pie and uses an OV5640 camera with Focus support connected over MIPI-CSI (LI-OV5640-MIPI-AF).

I’m working with this driver, into which I implemented a very basic always on autofocus function: https://source.codeaurora.org/external/imx/linux-imx/tree/drivers/media/platform/mxc/capture/ov5640_...
The driver puts the device into software power down mode everytime the configuration is updated and everytime it calls s_stream off. This makes the shutter to close and turns off the autofocus, so high resolutions photo are unusable (not in focus and almost black).

I've tried to remove the power down command, but it doesn't work, after acquisition is triggered the HAL cannot get the buffer for acquisition, giving this error back:

09-19 18:05:36.816  3270  4848 E Camera3-Stream: getBuffer: wait for output buffer return timed out after 3000ms (max_buffers 2)
09-19 18:05:36.816  3270  4848 E Camera3-Device: RequestThread: Can't get output buffer, skipping request: Connection timed out (-110)

Then the camera becomes unusable until reboot.

This happens only when the resolution is over 1280x720, because under it the driver is not triggered for capture.

I've seen a lot of OV5640 drivers with AF function and V4L2 support enabled, but the software power down is never triggered. I can't understand why, in this case, the software power down is needed. Is there a workaround to avoid it? How can I capture a photo without resetting the autofocus function?

Thank you for the support,

Kind Regards

0 Kudos
1 Reply

NXP TechSupport
NXP TechSupport

In the driver code, there is no support for AFC and shutter control. You may need to contact OmniVision for App. Note "Auto FocusCamera Module Application Notes". There is firmware and AF Sequence. You need to add the AFC function in the driver by yourself.

0 Kudos