OV5640 Auto Focus support on i.MX8M Mini

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

OV5640 Auto Focus support on i.MX8M Mini

2,146件の閲覧回数
riccardoierardi
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

ラベル(3)
0 件の賞賛
返信
4 返答(返信)

548件の閲覧回数
mikebaird
Contributor I

I was able to port code from here to make it work:

https://github.com/0015/ESP32-OV5640-AF

0 件の賞賛
返信

549件の閲覧回数
mikebaird
Contributor I

I was able to port code from here to make it work:

https://github.com/0015/ESP32-OV5640-AF 

0 件の賞賛
返信

593件の閲覧回数
mikebaird
Contributor I

I'm trying to get the Autofocus to work on the MIMXRT1170 Eval Kit.
Using the example "evkmimxrt1170_csi_mipi_rgb_cm7", as far as I can tell, AF isn't enabled. 

Digging through the source there's a function "CAMERA_DEVICE_CONTROL".

It's not clear to me when this should be called (I've tried it in a few places) with little success. 
The result of the command is "0" so it seems to be being sent to the camera. 

Is there something I'm missing? Is there an application note somewhere on this?

 Thanks!

 status_t cam_result = CAMERA_DEVICE_Control(&cameraDevice, kCAMERA_DeviceAutoFocus, CAMERA_AUTO_FOCUS_ON );
PRINTF("Setting light mode: %i", cam_result);

/*! @brief Camera device control command. */
typedef enum _camera_device_cmd
{
kCAMERA_DeviceAutoFocus, /*!< Auto focus. */
#define CAMERA_AUTO_FOCUS_ON 1
#define CAMERA_AUTO_FOCUS_OFF 0



0 件の賞賛
返信

1,836件の閲覧回数
jimmychan
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 件の賞賛
返信