Camera
Board Resource
Firefly-RK3399 development board has two MIPIs and a DVP camera
interface. MIPI supports up to 4K photography, and supports video
recording above 1080P 30fps. In addition, the development board also
supports USB cameras.
This article will introduce how to make the camera work properly,
using OV13850/OV5640 as an example.
Board Interface
DTS Configuration
isp0: isp@ff910000 {
…
status = "okay";
}
isp1: isp@ff920000 {
…
status = "okay";
}
Driver
The code directories of camera are shown as followed:
Android:
`- hardware/rockchip/camera/
|- CameraHal # HAL source code for camera
`- SiliconImage # SP library, including driver source code for all supporting modules
`- isi/drv/OV13850 # The source code of OV13850 modules
`- calib/OV13850.xml # Adjustment parameters of OV13850 module
`- device/rockchip/rk3399/
|- rk3399_firefly_aio_box
| `- cam_board.xml # Adjustment parameters of camera
Kernel:
|- kernel/drivers/media/video/rk_camsys # Driver source code of CamSys
`- kernel/include/media/camsys_head.h
Configuration Theory
What you need to configure the camera is to make the pins and clock
work properly.
According to the schematic diagram below, you need to provide:
"AF_VDD28", "DOVDD18", "AVDD28", "DVDD12", "PWDN1", "RST" and "MCLK".
MIPI interface
DVP interface
AF_VDD28 is provided by hardware connection. No configuration is
needed.
DOVDD18,AVDD28: Controlled by DVP_PWR, DVP_PWR corresponds to GPIO1_C7
of RK3399:
DVDD12 is controlled by CIF_PWER, CIF_PWERcorresponds to GPIO1_C6 of
RK3399:
MIPI CIF: PWDN0(share), PWDN1, RST corresponds to GPIO2_B4, GPIO2_D4,
GPIO0_B0:
All the pins are configured in "cam_board.xml", with the exception of
"DVDD12 (CIF_POWER)", which is configured in DTS and driver.
Configuration Steps
Android Layer Configuration
Modify "device/rockchip/rk3399/$(TARGET_PRODUCT)/cam_board.xml" to
register camera:
The main modifications are as follows:
Sensor name
This name must match the name of the sensor driver, which has the
following format:
libisp_isi_drv_OV13850.so
Sensor software identification
Inconsistent registration marks are enough. You can fill with the
following values:
CAMSYS_DEVID_SENSOR_1A
CAMSYS_DEVID_SENSOR_1B
CAMSYS_DEVID_SENSOR_2
Collector Name
Currently only support:
CAMSYS_DEVID_MARVIN
I2C channel number
For the specific channel number, please refer to the camera schematic
diagram to connect the main I2C channel number.
Length of Register Address (in bytes)
Clock of I2C (in Hz). Used to set the frequency of I2C.
MCLK of Camera (in Hz). Used to set the clock of camera.
PMU LDO name connected to Sensor AVDD. Set to NC if not connected.
PMU LDO name Connected to Sensor DOVDD.
Set to "NC" if not connected to PMU. Note that the "min" and "max"
values must be filled in, which determines the IO voltage of the
sensor.
PMU LDO name Connected to Sensor DVDD.
Set to "NC" if not connected to PMU.
Sensor PowerDown.
Just fill in the name directly and "active" fill in the effective
level of dormancy.
Sensor Reset
Just fill in the name directly, and "active" fill in the effective
level of the reset.
Sensor Power
Just fill in the name directly, and "active" fill in the effective
level of the power supply.
Select Sensor as front or back
Can fill in "front" or "back".
Sensor's Interface Mode
The following values can be filled in:
CCIR601
CCIR656
MIPI
SMIA
Sensor's mirror mode
At present, it is not supported.
Sensor angle Information
Physical interface settings
MIPI
hyMode: Sensor hardware interface connection, for MIPI Sensor, this
value is CamSys_Phy_Mipi.
Lane: The data channel of Sensor MIPI interface.
Phyindex: Master MIPI PHY number for Sensor MIPI connection.
sensorFmt: Sensor output data format, currently only supports
CamSys_Fmt_Raw_10b.
DVP
hyMode: Sensor hardware interface connection, for DVP Sensor, this
value is CamSys_Phy_Cif.
Sensor_do_to_cif_d: Data bit number of master control DVP interface
connected with Sensor DVP output data bit D0.
cif_num: Master DVP interface number for Sensor DVP connection.
sensorFmt: Sensor output data format, currently only supports
CamSys_Fmt_Yuv422_8b.
Compiling the kernel requires encoding the
"drivers/media/video/rk_camsys" driver source code into the kernel,
which is configured as follo`s.
Execute commands in the kernel source directory:
make menuconfig
Then select the following configuration items:
Device Drivers --->
Multimedia support --->
camsys driver
RockChip camera system driver --->
camsys driver for marvin isp
camsys driver for cif
Finally, the following commands are executed to complete the kernel
compilation:
make ARCH=arm64 rk3399-firefly.img
DEBUG
The "system/etc/cam_board.xml" can be directly modified under the
terminal to debug the parameters and reboot for active them.
FAQs
Unable to open the camera, first determine whether sensor I2C is
communicating. If not, check the MCLK and whether the power supply is
normal. Check Power, PowerDown, Reset, Mclk, I2cBus respectively.
support listː
13Mː OV13850/IMX214-0AQH5
8Mː OV8825/OV8820/OV8858-Z(R1A)/OV8858-R2A
5Mː OV5648/OV5640
2Mː OV2680
Read SDK/RKDocs for detail.