1. Home
  2. Docs
  3. Arducam USB Camera Shields
  4. USB3.0 Camera Shield
  5. Arducam MIPI Adapter Board for USB3.0 Camera Shield

Arducam MIPI Adapter Board for USB3.0 Camera Shield

Table Of Contents

Introduction

Arducam MIPI Adapter Board for USB3 Camera Shield (UC-628 Rev. B) works with Arducam USB3.0 Camera Shield (UC-425 Rev. C) to enable the USB3.0 platform to receive MIPI camera data.

Arducam MIPI Adapter Board for USB3 Camera Shield
Arducam MIPI Adapter Board for USB3 Camera Shield(UC 628 Rev.B)

Arducam MIPI Adapter Board for USB3.0 Camera Shield(UC-628 Rev.B)

ArduCAM USB3.0 Camera Shield(UC 425 Rev.C)
Arducam USB3.0 Camera Shield(UC-425 Rev.C)

For example, you can connect OV9281 camera to MIPI adapter board and USB3.0 camera shield. Then you will get the following product:

OV9281 1MP Global Shutter USB Camera Evaluation Kit

Arducam MIPI Adapter Board for USB3.0 Camera Shield (UC-628 Rev. B) and Arducam USB3.0 Camera Shield (UC-425 Rev. C) can be used with different cameras or different modes of the same camera. The upper computer needs to load different configuration files.

load different configuration files1
load different configuration files2

Arducam MIPI Adapter Board for USB3.0 Camera Shield (UC-628 Rev.B) configuration files:

https://github.com/ArduCAM/ArduCAM_USB_Camera_Shield/tree/master/Config/USB3.0_UC-425_Rev.C%2BUC-628_Rev.B
load different configuration files3

Configuration Files Guide

The following configuration file will be used as an example to illustrate a detailed description of the contents of the configuration file, so that you can modify it to suit your needs.

OV5647 MIPI 2Lane RAW8 8b 2592x1944 8fps.cfg

About Comments

The lines starting with “;” and “//” are all comments.

Large comments at the beginning of the configuration file are a description of the display mode, camera address, and other configuration methods.

About Comments1

Comments are sometimes added after the camera register configuration to explain the register function.

About Comments2

Display Mode and Camera Address Configuration

Lines starting with [camera parameter] are for configuring the display mode and camera address.

Display Mode and Camera Address Configuration0

① CFG_MODE

Display Mode and Camera Address Configuration1
Display Mode and Camera Address Configuration1 1
Display Mode and Camera Address Configuration2

CFG_MODE  = 0:Parameters can be modified in the upper computer software interface.

CFG_MODE  = 1:Parameters can not be modified in the upper computer software interface.

② TYPE

TYPE1
TYPE2

TYPE is used to mark the camera model for easy viewing.

TYPE3

NOTE: TYPE is just a comment, it doesn’t matter if you write it wrong.

③ SIZE

SIZE1
SIZE2
SIZE3

If it does not match the actual output resolution of the camera, a Bad frame received error will be displayed.

SIZE4

Click 【Tools】-【Data Info】 to view the MIPI camera resolution message from the hardware CPLD in real time.

SIZE5
SIZE

④ BIT_WIDTH

BIT WIDTH1
BIT WIDTH2
BIT WIDTH3

NOTE:

  • MIPI RAW8 mode: camera output is 8bit, BIT_WIDTH is set to 8bit.
  • MIPI RAW10 mode: camera output is 10bit. Because the upper computer cannot parse RAW10 at the moment, the CPLD hardware is throwing away the lower two bits of 10bit and turning them into 8bit before uploading, so BIT_WIDTH is also set to 8bit.
  • MIPI RAW12 mode: DVP input is 12bit. Because the upper computer cannot parse RAW12 at the moment, the CPLD hardware is throwing away the lower four bits of 12bit and turning them into 8bit before uploading, so BIT_WIDTH is also set to 8bit.

④ FORMAT

FORMAT1
FORMAT2
FORMAT3

FORMAT = 0, 2 means the order of GB in the four arrangements of RAW, or you can load the configuration file and then switch to adjust it in the lower right corner of the upper computer.

FORMAT4

⑤ I2C_MODE & I2C_ADDR

I2C MODE I2C ADDR1
I2C MODE I2C ADDR2
I2C MODE I2C ADDR3

I2C_MODE = 2 means the camera I2C operating mode is 16-bit address, 8-bit data.
I2C_ADDR = 0x6C means that the imager device address is 0x6C.

The I2C operating mode and device address of the imager should be referred to the imager manual or other reference materials.

I2C MODE I2C ADDR4
I2C MODE I2C ADDR5

USB Firmware and CPLD Configuration

7.3 USB and CPLD Configuration1
7.3 USB and CPLD Configuration2

[register parameter]: Register parameter set for USB2.0 & USB 3.0 mode.
[register parameter][dev2]: Register parameter set for USB2.0 mode.
[register parameter][dev3][inf2]: Register parameter set for USB3.0 mode and USB 2.0 interface.
[register parameter][dev3][inf3]: Register parameter set for USB3.0 mode and USB 3.0 interface.

When the USB3.0 Camera Shield is plugged into the USB3.0 port, the configurations in [register parameter] and [register parameter][dev3][inf3] will both work, and the later configurations will overwrite the earlier ones according to the order in which they are written and loaded.

USB Firmware Configuration

USB Firmware Configuration

VRCMD = 0xF6, 0x0000, 0x0000, 3, 0x03, 0x04, 0x0C
VRCMD = 0xF3, 0x0000, 0x0000, 0
VRCMD = 0xF9, 0x0001, 0x0000, 0 // 0x0001 is 16 bits; 0x0004 is 32 bits

These lines USB3.0 firmware configurations, which generally do not need to be changed.

CPLD Configuration

On the Arducam MIPI Adapter Board for USB3.0 Camera Shield (UC-628 Rev.B) has a CPLD for camera data processing.

CPLD Configuration

The CPLD can achieve different functions through register configuration.

7.3 USB and CPLD Configuration6

CPLD is 8-bit address, 8-bit data working mode.

① Set MIPI Lane channel and RAW format

VRCMD = 0xD7, 0x4600, 0x0C00, 1, 0x81
Set MIPI Lane channel and RAW format1
  • MIPI Lane channels have 1Lane, 2Lane and 4Lane configurations.
  • RAW has three types of RAW8 RAW10 and RAW12 (other RAW formats are not supported at this time).
Lane channelRAW Format0x0C value
1RAW80x80
2RAW80x81
4RAW80x82
1RAW100x90
2RAW100x91
4RAW100x92
1RAW120xA0
2RAW120xA1
4RAW120xA2

NOTE

If Lane channel and RAW format are not configured correctly, it will result in the CPLD not being able to parse the MIPI data and the upper computer not being able to output the image.

②  Set the MIPI resolution reference value

VRCMD = 0xD7, 0x4600, 0x0D00, 1, 0x0A
VRCMD = 0xD7, 0x4600, 0x0E00, 1, 0x20
VRCMD = 0xD7, 0x4600, 0x0F00, 1, 0x07
VRCMD = 0xD7, 0x4600, 0x1000, 1, 0x98
Set the MIPI resolution reference value

The registers 0x0D to 0x10 are used to set the resolution referenced value. 0x0D to 0x10 is meaningful when the wordcount checksum (bit[2] of register 0x11) is turned on for MIPI resolution.

  • If 0x11 is set to 0x03, the wordcount checksum is not turned on, 0x0D ~ 0x10 can be ignored.
  • If 0x11 is set to 0x07, 0x0D ~ 0x0E value must be correct, otherwise HREF can not be parsed out, the upper computer can not output the image.

③ Set MIPI checksum

VRCMD = 0xD7, 0x4600, 0x1100, 1, 0x07

Register 0x11 is used to set several MIPI checksum methods (DataID, WordCount, ECC).

MIPI data contains DataID, WordCount, and ECC data regardless of whether it is a short packet (indicating field start and field end) or a long packet (indicating a line of data).

7.3 USB and CPLD Configuration14
7.3 USB and CPLD Configuration15

DataID is divided into VC (Virtual Channel) and DT (DataType).

7.3 USB and CPLD Configuration16

VC is generally not used; RAW8 and RAW10 are commonly used by DT.

7.3 USB and CPLD Configuration17
Set MIPI checksum

NOTE

If the MIPI checksum is not set or set incorrectly, it may lead to the MIPI data parsing error and can not produce the map.

7.3 USB and CPLD Configuration19
  • bit[1] sets the DataType checksum. When set to 1, only MIPI data with RAW8 (DataType=0x2A), RAW10 (DataType=0x2B) and RAW12 (DataType=0x2C) can be parsed.
  • bit[2] sets the WordCount check, MIPI data can only be parsed if the WordCount is the same as the set value of 0x0D~0x0E when bit[2] is set to 1.
  • bit[5:4] sets the order of ECC generation. ECC is generated based on the three bytes DI, WC_H and WC_I, and the ECC values generated by different orders are different.

Most cameras can configure this order, and the default order is usually DI, WC_I, and WC_H.

7.3 USB and CPLD Configuration20

In general.

  • 2Lane or 4Lane only need to enable the ECC check and DataType check, WordCount check could not be enabled. In other words, the 0x11 register is set to 0x03, and it does not matter if the 0x0D to 0x10 registers are not used
VRCMD = 0xD7, 0x4600, 0x1100, 1, 0x03
  • WordCount checksum needs to be enabled at 1Lane, otherwise the parsing may be unstable. In other words, 0x11 register is set to 0x07, at this time, 0x0D~0x10 registers need to be set correctly according to the actual resolution, if the resolution is not set correctly, it will cause HREF not to be resolved, and the upper computer will not be able to output the image.

For example, OV7251 1Lane RAW8 configuration:

7.3 USB and CPLD Configuration21

Camera Configuration

7.3.3 Camera Configuration1
7.3.3 Camera Configuration2
7.3.3 Camera Configuration3

[register parameter]: Register parameter set for USB2.0 & USB 3.0 mode.
[register parameter][dev2]: Register parameter set for USB2.0 mode.
[register parameter][dev3][inf2]: Register parameter set for USB3.0 mode and USB 2.0 interface.
[register parameter][dev3][inf3]: Register parameter set for USB3.0 mode and USB 3.0 interface.

When the USB3.0 Camera Shield is plugged into the USB3.0 port, the configurations in [register parameter] and [register parameter][dev3][inf3] will both work, and the later configurations will overwrite the earlier ones according to the order in which they are written and loaded.

Also, some configuration files may have a large section starting with “VRCMD =“, which is used to configure older MIPI Adapter Boards (UC-489 Rev. C). Some configuration files retain this section for compatibility with older and newer models, but it does not actually work for the newer MIPI Adapter Board (UC-628 Rev. B).

Camera Configuration1

For example:

  • REG = 0x3035, 0x11 means the address is 16 bits and the data is 8 bits.
  • The I2C_MODE and I2C_ADDR at the beginning of the configuration file should be set correctly first.
7.3.3 Camera Configuration4

The specific configuration of the camera requires reference to the datasheet.
Commonly used registers such as PLL, VTS/HTS, Exposure, Gain, RAW mode, etc.

7.3.3 Camera Configuration5
7.3.3 Camera Configuration6
7.3.3 Camera Configuration7
7.3.3 Camera Configuration8

Modification Examples

The following are a few scenarios for modifying the configuration file for reference.

Change RAW8 to RAW10

Take the configuration file OV5647_MIPI_2Lane_RAW8_8b_2592x1944_8fps.cfg as an example, now we want to modify it to 2Lane RAW10 2592×1944 configuration, i.e. the number of Lanes and resolution remain the same, just modify the RAW format.

First, make a copy of OV5647_MIPI_2Lane_RAW8_8b_2592x1944_8fps.cfg.

7.4 Modification Examples1

Second, rename the copied file.

7.4 Modification Examples2

Third, open with a text editor (e.g. Notepad++).

Since the camera and resolution are not changed, the [Camera parameter] section does not need to be modified.

7.4 Modification Examples3

In the CPLD configuration, change the 0x0C register value from 0x81 to 0x91.

7.4 Modification Examples4
Lane channelRAW Format0x0C value
1RAW80x80
2RAW80x81
4RAW80x82
1RAW100x90
2RAW100x91
4RAW100x92
1RAW120xA0
2RAW120xA1
4RAW120xA2

Check the camera manual and find the register for modifying the RAW format.

7.4 Modification Examples6

The 0x3034 register defines the RAW format. The default value is 0x1A, which means RAW10; if it is 0x18, it means RAW8.

Then look for 0x3034 in the configuration file, and find it in two places, the last one prevailing.

7.4 Modification Examples7

0x3034 current value is 0x18, change it to 0x1A.

Save the modified configuration file.

Click 【refresh】 to see the newly created file only in the drop-down list.

7.4 Modification Examples8

Click 【load】-【open】-【play】 in turn, out normal image.

7.4 Modification Examples9

Click 【Tools】-【Data Info】

7.4 Modification Examples10
7.4 Modification Examples11

It shows that the DataType parsed by the CPLD is 0x2B, which also indicates that it is indeed in RAW10 format.

table

NOTE

1.If the upper computer reports badframe error after RAW8 is changed to RAW10, it may be because the amount of data in one line is increased to 1.25 times, and the HTS is too small, so the HTS needs to be increased to output the image.RAW10 changed to RAW8 without modifying HTS.

2.Some cameras also need to modify the PLL register when the RAW format is modified.

3.Because the upper computer cannot parse RAW10 at present, the CPLD on USB2.0 Camera Shield Rev. E is throwing away the lower two bits of 10bit and turning them into 8bit before uploading, so BIT_WIDTH is set to 8bit. BIT_WIDTH is also set to 8bit for RAW12.

Fix RAW Format and Resolution

The following is how to correct the profile if the number of Lanes is known, but the RAW format and exact resolution are not known ( assuming that the camera output is normal, just not sure that the USB2 Camera Shield is properly configured).

Still take OV5647_MIPI_2Lane_RAW8_8b_2592x1944_8fps.cfg configuration file as an example.

First, make a copy of OV5647_MIPI_2Lane_RAW8_8b_2592x1944_8fps.cfg, then modify this copy file.

7.4.2 Fix RAW Format and Resolution1

Open with a text editor (e.g. Notepad++).

We intentionally changed the SIZE wrong from 2592,1944 to 2500,1900

7.4.2 Fix RAW Format and Resolution2

Change the 0x0C register to 0x91 from 0x81 by mistake as well.

7.4.2 Fix RAW Format and Resolution3

The upper computer loads this configuration file and the error is reported (Bad frame received).

7.4.2 Fix RAW Format and Resolution4

MIPI Data Info information is also abnormal.

7.4.2 Fix RAW Format and Resolution5

Then, we change the 0x11 register value from 0x07 (or 0x03) to 0x01.

7.4.2 Fix RAW Format and Resolution6

Save, reload, and check the MIPI Data Info.

7.4.2 Fix RAW Format and Resolution7

0x2A indicates RAW8 with a resolution of 2592×1944.

table 1

Now fix the configuration file:

  • change the SIZE to 2592,1944.
  • change 0x11 to 0x03.
  • change 0x0C to 0x81.

The image will come out normally.

NOTE

If the camera output is in RAW10 format, after changing 0x11 to 0x01, the Col value in MIPI Data Info at this time is not the column resolution, but the number of rows (WordCount).
For example, the following figure shows the result after changing 0x11 to 0x01 on the RAW10 configuration.

7.4.2 Fix RAW Format and Resolution9

0x2B means it is RAW10, and the amount of RAW10 data is 1.25 times of RAW8, so the column resolution should be 3240/1.25=2592.

Or fix 0x11 and 0x0C first (change 0x11 to 0x03 and 0x0C to 0x91), then check MIPI Data Info (Col and Row are accurate at this point), and finally fix SIZE.

7.4.2 Fix RAW Format and Resolution10

Was this article helpful to you? Yes No