Notes for debugging the 5.0 M sensor Module

Source: Internet
Author: User

 

On the 25 platform, a 5.0 M sensor module with ISP processor was debugged, And the 5.0 M sensor preview function was implemented on the 25 platform. Below are some notes during the debugging process:

I. Knowledge about H-sync/V-Sync:

1. resolution: for example, if 640x480, there will be 640 pixel & 480 line, then there will be 480 H-sync in each V-sync signal time, A single H-sync will have 640 pixel entries. However, each pixel has 2 bytes. Therefore, we can add 1280 PCLK records in one H-sync.

2. h-sync/V-Sync polarity: polarity is the effective preparation of data. For example, H-sync on V-sync may be low in V-sync, it may also appear at high.

Ii. ISP processor Introduction: XXX838 is an isp (image signal processor) ic. The core is an arm7 process, which provides auto focus, face recognition, and other functions. BB uses i2c to communicate with the command class, while the sensor data is transmitted to BB through the CCIR bus.

3.25 process learning for camera

1. void cam_event_ind_hdlr (ilm_struct * ilm_ptr) // This function is to handle camera event indication.

In this function, use the camera_capture_mem_process (& capture_mem_param) command to obtain the capture data from the LCD layer, and then use the pai_encode_process (& jpg_encode) command to encode the data in jpeg format.

2. void cam_capture_req_hdlr (ilm_struct * ilm_ptr) // This function is to handle camera capture request.

(1) The function first executes exit_camera_preview_process (); the command exits the preview process;

(2)./* copy preview data to MMI buffer */

Memcpy (

(Kal_uint8 *) cam_context_p-> frame_buffer_p,

(Kal_uint8 *) cam_context_p-> int_frame_buffer_p,

Cam_context_p-> frame_buffer_size );

(3)./* release preview related memory */

Cam_release_memory ();

3. cam_context_p-> capture_buffer_p: pointer to the photo data to be stored

Cam_context_p-> file_size: data size to be stored

4. Execute the command in the cam_open_image_file Function

Cam_context_p-> capture_buffer_p = (kal_uint32) med_alloc_ext_mem (buffer_size );

To allocate memory.

Capture Data Storage pointer: capture_isp_param.target_buffer_start_address = (kal_uint32) cam_context_p-> capture_buffer_p;

Camera_capture_pai_process (& capture_isp_param );

Isp_capture_jpeg_data.target_buffer_start_address = isp_data-> target_buffer_start_address;

Sw_jpeg_encode_config_data.jpeg_file_start_address=isp_capture_jpeg_data.tar get_buffer_start_address;

5. Data Transfer Process after camera capture: cam_context_p-> intmem_start_address.

(1). capture_isp_param.intmem_start_address = cam_context_p-> intmem_start_address =

(Kal_uint32) med_alloc_int_mem (cam_capture_mem [0]); // only 45 k

Capture_isp_param.intmem_size = cam_context_p-> intmem_size = (kal_uint32) cam_capture_mem [0];

(2). file_size = camera_capture_pai_process (& capture_isp_param); // the size of the jpeg encoded file

(3). isp_capture_jpeg_data.intmem_start_address = isp_data-> intmem_start_address;

Isp_capture_jpeg_data.intmem_size = isp_data-> intmem_size;

(4). intmem_init (kal_uint32 *) isp_capture_jpeg_data.intmem_start_address,

Isp_capture_jpeg_data.intmem_size );

(5). sw_jpeg_encode_config_data.intmem_start_address = isp_capture_jpeg_data.intmem_start_address; // assign the obtained original capture data address pointer to the starting address of soft encoding.

Iv. Key Points of debugging

1. First, call the I2C communication, and ensure that the I2C communication between BB and ISP is normal;

2. Redefinition # define MAX_CAM_FILE_BUFFER_LEN (3150*1024)/* 2700kb for 5.0 M */

3. like the camera_capture_jpeg_process function, create a new function that stores the obtained data directly without passing through the jpeg encoding process (because XXX838 has transmitted jpeg data ).

Note:

(1) In this function, you need to set:

ENABLE_CAMERA_OUTPUT_TO_MEM; // ISP outputs to Memory,

SET_CAMERA_CAPTURE_MODE

/*** Capture, waiting for VSYNC interruption **/

(2) After capture is complete, DISABLE_CMOS_SESNOR; // disable the sensor signal.

(3) At this time, the obtained capture data has been stored in isp_data-> target_buffer_start_address;

Then read the data and use 0xff, 0xd8 to determine the file header, 0xff, and 0xd9 to determine the end and length of the jpeg file.

(4) Finally, save the file through kal_int32 cam_close_image_file (kal_uint32 size)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.