DART-MX8M Android Camera: Difference between revisions

From Variscite Wiki
(Created page with "<!-- Set release according to "release" parameter in URL and use RELEASE_O8.1.0_1.3.0_8M_DART-MX8M as default --> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!-- --> {{#...")
 
 
(33 intermediate revisions by 3 users not shown)
Line 2: Line 2:
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!--
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!--
--> {{#lst:Android_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_O8.1.0_1.3.0_8M_DART-MX8M}}}} <!--
--> {{#lst:Android_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_O8.1.0_1.3.0_8M_DART-MX8M}}}} <!--
--> {{PageHeader|{{#var:HARDWARE_NAME}} - Android {{#var:ANDROID_NAME}} {{#var:ANDROID_VERSION}} Developer Guide}} {{DocImage|category1={{#var:HARDWARE_NAME}}|category2=Android}} __toc__
--> {{PageHeader|{{#var:HARDWARE_NAME}} - {{#switch: {{#var:ANDROID_NAME}} | Android 10 = {{#var:ANDROID_NAME}} | Android 11 = {{#var:ANDROID_NAME}} | | Android 12 = {{#var:ANDROID_NAME}} | Android 13 = {{#var:ANDROID_NAME}} | Android {{#var:ANDROID_NAME}} }} - Camera}} {{DocImage|category1=Android|category2={{#var:HARDWARE_NAME}}}} __toc__


=Overview=
=Overview=
{{#var:HARDWARE_NAME}} is capable of driving video input via MIPI CSI-2 cameras.  
The {{#var:HARDWARE_NAME}} is capable of driving video input via MIPI CSI-2 cameras.  


The CSI-2 Host Controller is a digital core that implements all protocol functions defined in <br>
The CSI-2 Host Controller is a digital core that implements all protocol functions defined in the MIPI CSI-2 specification.<br>
the MIPI CSI-2 specification, providing an interface between the system and the MIPI D-PHY, <br>
It provides an interface between the system and the MIPI D-PHY.<br>  
allowing communication with an MIPI CSI-2 compliant camera sensor. <br>
This allows communication with a MIPI CSI-2 compliant camera sensor to host processor bus.<br>
Key features include:<br>
The Key features include:<br>
* Module provides {{#ifeq: {{#var:HARDWARE_NAME}} | DART-MX8M| Two |One}} four-lane MIPI camera serial interfaces
* Module provides {{#ifeq: {{#var:HARDWARE_NAME}} | DART-MX8M| Two |One}} four-lane MIPI camera serial interfaces.
* MIPI D-PHY specification V1.2 (Board Approved)
* MIPI D-PHY specification V1.2 (Board Approved).
* Compliant to MIPI CSI2 Specification V1.3 except for C-PHY feature (Board Approved)
* Compliant to MIPI CSI2 Specification V1.3 except for C-PHY feature (Board Approved).
* Support primary and secondary Image format
* Support primary and secondary Image format.
** YUV420, YUV420 (Legacy), YUV420 (CSPS), YUV422 of 8-bits and 10-bits
** YUV420, YUV420 (Legacy), YUV420 (CSPS), YUV422 of 8-bits and 10-bits.
**  RGB565, RGB666, RGB888
**  RGB565, RGB666, RGB888
** RAW6, RAW7, RAW8, RAW10, RAW12, RAW14
** RAW6, RAW7, RAW8, RAW10, RAW12, RAW14
** All of User defined Byte-based Data packet
** All User-defined Byte-based Data packet.
* Support up to 4 lanes of D-PHY, which operates up to a maximum bit rate of 1.5 Gbps/lane.
* Support up to 4 lanes of D-PHY, which operates up to a maximum bit rate of 1.5 Gbps/lane.
* Interfaces
* Interfaces:
**  Compatible to PPI (Protocol-to-PHY Interface) in MIPI D-PHY Specification
**  Compatible to PPI (Protocol-to-PHY Interface) in MIPI D-PHY Specification.
** AMBA3.0 APB Slave for Register configuration.
** AMBA3.0 APB Slave for Register configuration.
** Image output data bus width: 32 bits
** Image output data bus width: 32 bits.
* Image memory
* Image memory:
** Size of SRAM is 4KB
** The size of SRAM is 4KB.
* Pixel clock can be gated when no PPI data is coming
* Pixel clock can be gated when no PPI data is coming.


Note:<br>
Note:<br>
Line 32: Line 32:


== MIPI-CSI2 ==
== MIPI-CSI2 ==
The {{#var:HARDWARE_NAME}} exposes {{#ifeq: {{#var:HARDWARE_NAME}} | DART-MX8M| Two |One}} <br>
The {{#var:HARDWARE_NAME}} exposes {{#ifeq: {{#var:HARDWARE_NAME}} | DART-MX8M| two |one}} MIPI-CSI input {{#ifeq: {{#var:HARDWARE_NAME}} | DART-MX8M| ports|port}} of the SOC. <br>
MIPI-CSI input port of the SOC. <br>
Refer to: {{#ifeq: {{#var:HARDWARE_NAME}}|DART-MX8M| https://www.variscite.com/wp-content/uploads/2018/03/DART-MX8M-datasheet.pdf | {{#ifeq: {{#var:HARDWARE_NAME}}|VAR-SOM-MX8|https://www.variscite.com/wp-content/uploads/2019/04/VAR-SOM-MX8_Datasheet.pdf |https://www.variscite.com/wp-content/uploads/2019/02/DART-MX8M-MINI_Datasheet.pdf}}}} for more details.
Refer to : {{#ifeq: {{#var:HARDWARE_NAME}}|DART-MX8M| https://www.variscite.com/wp-content/uploads/2018/03/DART-MX8M-datasheet.pdf | https://www.variscite.com/wp-content/uploads/2019/02/DART-MX8M-MINI_Datasheet.pdf}} for more details.  


=Hardware Availability and Setup=
=Hardware Availability and Setup=
Connect the relevant camera accessories to the right connector.  
Make sure you have the camera(s) connected to the board before booting.  
*{{#var:HARDWARE_NAME}} Development Kit:
*{{#var:HARDWARE_NAME}} Development Kit:
**CSI1 - MIPI Clock + 4 Data lanes are accessible via Carrier board header.
**CSI1 - MIPI Clock + 4 Data lanes are accessible via the Carrier board header.
**J11: MIPI - 4 Lane + CLK + I2C + GPIOs<br>
**J11: MIPI - 4 Lane + CLK + I2C + GPIOs.<br>
For more details refer to: https://www.variscite.com/wp-content/uploads/2018/03/VAR-DT8MCustomBoard-Schematics.pdf
**MIPI Camera Accessories Required: https://www.variscite.com/product/accessories/var-ext-cb8/
**MIPI Camera Accessories Required: https://www.variscite.com/product/accessories/var-ext-cb8/
For maximum, supported resolution and combinations refer to
{{#ifeq: {{#var:HARDWARE_NAME}}|DART-MX8M| https://www.nxp.com/docs/en/data-sheet/IMX8MDQLQIEC.pdf | https://www.nxp.com/docs/en/data-sheet/IMX8MMCEC.pdf}}<br>


[[File:IMX8_Image_Processing_Chain.png]]
Note:
 
* {{#var:HARDWARE_NAME}} platform doesn't have the SOC-based Image Signal Processing (ISP) unit to convert bayer data to RGB and YUV.
Note: {{#var:HARDWARE_NAME}} platform doesn't have the SOC based Image Signal Processing (ISP) unit to convert bayer data to RGB and YUV.<br>
* {{#var:HARDWARE_NAME}} platform relies on the MIPI camera to convert the Bayer data to YUV format.
{{#var:HARDWARE_NAME}} platform relies on MIPI camera to convert the Bayer data to YUV format.
* For maximum, supported resolution and combinations refer to the datasheet.


=Software Setup=
=Software Setup=
Line 56: Line 52:
By default, MIPI cameras are supported out of the box.<br>
By default, MIPI cameras are supported out of the box.<br>
Android System / Vendor images contain Camera HAL already support for OV5640 5MP support available.<br>
Android System / Vendor images contain Camera HAL already support for OV5640 5MP support available.<br>
You don't need to do any special build/addition below HAL if you are using the standard camera.  
You don't need to do any special build/addition below HAL if you are using the standard camera. <br>
Unless you wish to modify for your custom camera type,
Note:
If you wish to modify it for your custom camera type and for all customization refer to:
*For Android {{#var:ANDROID_NAME}}:
*For Android {{#var:ANDROID_NAME}}:
Source Path: <android_build>/vendor/nxp-opensource/imx/libcamera3/
Source Path: <android_build>/vendor/nxp-opensource/imx/libcamera3/


Note:<br>
Note:<br>
* Android 8.0 and above Camera2 APIs are standard and are supported.<br>
* Android 8.0 and above Camera2 APIs are standard.
* Auto Focus, Manual Focus, Auto Exposure and Manual exposure are not supported at present.
* Camera2 APIs are supported out of the box.
 
* Legacy Camera1 APIs supported out of the box.
==UVC Camera Setup==
* By default camera is configured for Auto Focus, Auto Exposure, and Auto White Balance.
===Change android_build/device/variscite/var_mx6/init.rc===
setprop back_camera_name uvc
 
===Change android_build/device/variscite/var_mx6/BoardConfig.mk===
BOARD_HAVE_USB_CAMERA := true
 
===Make sure your kernel have===
$ CONFIG_USB_VIDEO_CLASS=y
For that add CONFIG_USB_VIDEO_CLASS=y to  arch/{{#ifeq: {{#var:HARDWARE_NAME}}|DART-MX8M|arm64|arm}}/configs/{{#var:KERNEL_DEFCONFIG}} and make sure you have UVC / USB WebCam driver enabled. <br>
Refer to: {{Varlink|Android_Customizing_the_Linux_kernel|{{#var:RELEASE_LINK}}|Customizing the Linux kernel}} for detailed steps about kernel customization.<br>
You may be able to find the UVC class USB drivers here:https://github.com/varigit/{{#var:KERNEL_REPO_NAME}}/tree/{{#var:KERNEL_BRANCH}}/drivers/media/usb
 
==Build your new boot-<setup-name>.img==
Refer to: {{Varlink|Android_Customizing_the_Linux_kernel|{{#var:RELEASE_LINK}}|Customizing the Linux kernel}} for detailed steps about building kernel. <br>
 
==Flash your new boot-<setup-name>.img via fastboot and reboot device==
'''Connect the target with host PC at fastboot mode:'''
#Connect a USB OTG cable from the target board OTG port to a your host machine USB HOST port.
#Power up the board and hit return/space to stop the boot at U-Boot.
#type '''fastboot usb0''' in the U-Boot command line.
 
'''On the Host PC:'''
{{#ifeq: {{#var:ANDROID_NXP_VERSION}} | O8.0.0_1.0.0 |
$ sudo `which fastboot` flash boot out/target/product/var_mx6/boot-''SETUP_NAME''.img
$ sudo `which fastboot` flash recovery out/target/product/var_mx6/recovery-''SETUP_NAME''.img
$ sudo `which fastboot` flash system out/target/product/var_mx6/system.img
$ sudo `which fastboot` flash vendor out/target/product/var_mx6/vendor.img
|
$ sudo `which fastboot` flash boot out/target/product/var_mx6/boot-''SETUP_NAME''.img
$ sudo `which fastboot` flash recovery out/target/product/var_mx6/recovery-''SETUP_NAME''.img
$ sudo `which fastboot` flash system out/target/product/var_mx6/system.img
}}
$ sudo `which fastboot` reboot
Replace ''SETUP_NAME'' with the actual desired setup name accrding to the second table in the [[#Images_created_by_the_Android_build_for_Variscite_MX6_system|"images created" section]].


=Testing Camera=
=Testing Camera=
If the camera is connected/configured correctly. Once you click the Android Camera Application mentioned blow.
If the camera is connected/configured correctly you will see the Camera APP icon.<br>
 
Once you click the Android Camera Application mentioned below.<br>
[[File:Camera_App.png]]
[[File:Imx8_Camera_App.png]]<br>
 
Note: If you don't see the camera application that means either camera is not connected or not detected by software.<br><br>
 
It will ask you for location, and storage permissions, click on allow and then click next.  
The camera preview should start, like below<br>
 
[[File:Camera_Preview.png]]


Click on the Camera icon, it will take JPEG snapshot.  
==Snapshot==
* The camera preview should start on the screen.<br>
* Click on the Camera icon, it will take a JPEG snapshot.
* JPEG snapshot with maximum 5MP supported.


==Video Recording==
If you wish to record/video, click on the leftmost side of the preview screen you will see moving UI.<br>
If you wish to record/video, click on the leftmost side of the preview screen you will see moving UI.<br>
[[File:Camera_Recording_opts.png]]
* Click on the Video Recording Button.<br>
Video Recording:
{{#ifeq: {{#var:HARDWARE_NAME}} | DART-MX8M| * Encoding up to 480@30fps (Software based)| * Encoding 1080p@30fps hardware based supported}}

Latest revision as of 07:28, 21 September 2023

DART-MX8M - Android Oreo - Camera

Overview

The DART-MX8M is capable of driving video input via MIPI CSI-2 cameras.

The CSI-2 Host Controller is a digital core that implements all protocol functions defined in the MIPI CSI-2 specification.
It provides an interface between the system and the MIPI D-PHY.
This allows communication with a MIPI CSI-2 compliant camera sensor to host processor bus.
The Key features include:

  • Module provides Two four-lane MIPI camera serial interfaces.
  • MIPI D-PHY specification V1.2 (Board Approved).
  • Compliant to MIPI CSI2 Specification V1.3 except for C-PHY feature (Board Approved).
  • Support primary and secondary Image format.
    • YUV420, YUV420 (Legacy), YUV420 (CSPS), YUV422 of 8-bits and 10-bits.
    • RGB565, RGB666, RGB888
    • RAW6, RAW7, RAW8, RAW10, RAW12, RAW14
    • All User-defined Byte-based Data packet.
  • Support up to 4 lanes of D-PHY, which operates up to a maximum bit rate of 1.5 Gbps/lane.
  • Interfaces:
    • Compatible to PPI (Protocol-to-PHY Interface) in MIPI D-PHY Specification.
    • AMBA3.0 APB Slave for Register configuration.
    • Image output data bus width: 32 bits.
  • Image memory:
    • The size of SRAM is 4KB.
  • Pixel clock can be gated when no PPI data is coming.

Note:

  • At present OV5640 supports only YUV 422 image format.

MIPI-CSI2

The DART-MX8M exposes two MIPI-CSI input ports of the SOC.
Refer to: https://www.variscite.com/wp-content/uploads/2018/03/DART-MX8M-datasheet.pdf for more details.

Hardware Availability and Setup

Make sure you have the camera(s) connected to the board before booting.

Note:

  • DART-MX8M platform doesn't have the SOC-based Image Signal Processing (ISP) unit to convert bayer data to RGB and YUV.
  • DART-MX8M platform relies on the MIPI camera to convert the Bayer data to YUV format.
  • For maximum, supported resolution and combinations refer to the datasheet.

Software Setup

Make sure you have the required hardware as per above.

MIPI Cameras

By default, MIPI cameras are supported out of the box.
Android System / Vendor images contain Camera HAL already support for OV5640 5MP support available.
You don't need to do any special build/addition below HAL if you are using the standard camera.
Note: If you wish to modify it for your custom camera type and for all customization refer to:

  • For Android Oreo:

Source Path: <android_build>/vendor/nxp-opensource/imx/libcamera3/


Note:

  • Android 8.0 and above Camera2 APIs are standard.
  • Camera2 APIs are supported out of the box.
  • Legacy Camera1 APIs supported out of the box.
  • By default camera is configured for Auto Focus, Auto Exposure, and Auto White Balance.

Testing Camera

If the camera is connected/configured correctly you will see the Camera APP icon.
Once you click the Android Camera Application mentioned below.
Imx8 Camera App.png
Note: If you don't see the camera application that means either camera is not connected or not detected by software.

It will ask you for location, and storage permissions, click on allow and then click next.

Snapshot

  • The camera preview should start on the screen.
  • Click on the Camera icon, it will take a JPEG snapshot.
  • JPEG snapshot with maximum 5MP supported.

Video Recording

If you wish to record/video, click on the leftmost side of the preview screen you will see moving UI.

  • Click on the Video Recording Button.

Video Recording:

  • Encoding up to 480@30fps (Software based)