Camera Development Guide_Rev1.3

中文

Revision History

Version

Date

Author

Reviewer

Revision Content

V1.0

2023-12-13

SXX

zlc

Initial document creation

V1.1

2024-03-25

sxx

Changed document name

V1.2

2024-11-15

zw

Changed document format, removed demo

V1.3

2025-04-18

ZH

\

Added common issues section

1 Introduction

This document introduces the LTE-EC71X camera interface APIs. The API interfaces are declared in the file components/kernel/lierda_api/liot_camera/liot_camera.h.

Currently, the camera only supports I2C0 for configuring camera register parameters by default. When both CSPI1 and CSPI0 are enabled simultaneously, CSPI1 is prioritized for communication with the camera.

The default camera model is: GC032A 2DDR 300K pixels

The list of camera models that have been successfully debugged is as follows: BF30A2, GC032A, GC6123, GC6153, SP0A39, SP0821.

2 API Function Overview

Function

Description

liot_CamInit()

Initialize camera function

liot_CamDeInit()

Deinitialize camera function

liot_CamCaptureImage()

Capture an image

liot_CamPreview()

Open camera preview on LCD screen (not currently supported)

liot_CamStopPreview()

Stop camera preview on LCD screen (not currently supported)

3 Type Descriptions

3.1 liot_errcode_camera_e

CAM API execution result error codes.

  1. Declaration

typedef enum {
    LIOT_CAMERA_SUCCESS = LIOT_SUCCESS,
    LIOT_CAMERA_INIT_ERR = (0x10) | LIOT_COMPONENT_STATE_INFO,
    LIOT_CAMERA_POWER_ON_ERR,
    LIOT_CAMERA_CLOSE_ERR,
    LIOT_CAMERA_PREVIEW_ERR,
    LIOT_CAMERA_STOP_PREVIEW_ERR,
    LIOT_CAMERA_CAPTURE_ERR,
    LIOT_CAMERA_GET_INFO_ERR,
    LIOT_CAMERA_PRINT_ERR,
    LIOT_CAMERA_BUF_ERR,
    LIOT_CAMERA_SET_BUF_ERR,
} liot_errcode_camera_e;
  1. Parameters

  • LIOT_CAMERA_SUCCESS: Execution successful.

  • LIOT_CAMERA_INIT_ERR: Camera initialization failed.

  • LIOT_CAMERA_POWER_ON_ERR: Failed to power on camera.

  • LIOT_CAMERA_CLOSE_ERR: Failed to close camera.

  • LIOT_CAMERA_PREVIEW_ERR: Failed to open camera preview.

  • LIOT_CAMERA_STOP_PREVIEW_ERR: Failed to stop camera preview.

  • LIOT_CAMERA_CAPTURE_ERR: Failed to capture image.

  • LIOT_CAMERA_GET_INFO_ERR: Error getting camera information.

  • LIOT_CAMERA_PRINT_ERR: Failed to print image preview.

  • LIOT_CAMERA_BUF_ERR: Camera buffer error.

  • LIOT_CAMERA_SET_BUF_ERR: Error setting buffer.

4 API Function Details

4.1 liot_CamInit

Initialize camera function.

  1. Declaration

liot_errcode_camera_e liot_CamInit(void);
  1. Parameters

  • None

  1. Return Value

  • liot_errcode_camera_e, see 3.1 for reference.

4.2 liot_CamDeInit

Deinitialize camera function.

  1. Declaration

liot_errcode_camera_e liot_CamDeInit(void);
  1. Parameters

  • None

  1. Return Value

  • liot_errcode_camera_e, see 3.1 for reference.

4.3 liot_CamCaptureImage

Capture an image.

  1. Declaration

liot_errcode_camera_e liot_CamCaptureImage(uint8_t *pFrameBuf, uint16_t width, uint16_t height);
  1. Parameters

  • pFrameBuf: Buffer for capturing image. Note that buffer size is width*height.

  • width: Image width.

  • height: Image height.

  1. Return Value

  • liot_errcode_camera_e, see 3.1 for reference.

4.4 liot_CamPreview

Open camera preview on LCD screen (not currently supported).

4.5 liot_CamStopPreview

Stop camera preview on LCD screen (not currently supported).

5 Common Issues

5.1 Can Camera be Connected to Any SPI Port?

No, it must be connected to CSPI port. If you need to use the scan preview hardware acceleration function, it only supports USP1 connecting to camera (CSPI) and USP2 connecting to LCD (LSPI).

Recommendation: Use USP0 as I2S function to connect codec. Use USP1 as CSPI function to connect camera. Use USP2 as LSPI function to connect LCD.