Author Topic: configure the frame of imx219 on vitis (TE0726-03Mo)  (Read 125 times)

Gloria

  • Active Member
  • *
  • Posts: 18
configure the frame of imx219 on vitis (TE0726-03Mo)
« on: April 11, 2021, 12:18:40 PM »
Hi,
I am a beginner of imx219 and I want to configure it in vitis.
However, I do not how to set the specified frames that I need. To set the correct frame, such as 16fps or 4 fps, which registers should I note and how to set these relevant registers?
Here, I have a demo for 1280*720@30fps, however, I still do not know how to modify the frames of 30fps to 16 or 4 fps.
Demo:
static struct sensor_cmd imx219_720p_regs[] = { //720: 1280*720@30fps
   {0x30EB, 0x05},
   {0x30EB, 0x0C},
   {0x300A, 0xFF},
   {0x300B, 0xFF},
   {0x30EB, 0x05},
   {0x30EB, 0x09},

   {0x0114, 0x01},   // CSI_LANE_MODE = 2-lane
   {0x0128, 0x00},   // DPHY_CTRL = auto mode

   {0x012A, 0x13},   // EXCLK_FREQ[15:8]
   {0x012B, 0x34},   // EXCLK_FREQ[7:0] = 4916 MHz

   {0x0160, 0x04},   // FRM_LENGTH_A[15:8]
   {0x0161, 0x60},   // FRM_LENGTH_A[7:0] = 1120
   {0x0162, 0x0D},   // LINE_LENGTH_A[15:8]
   {0x0163, 0x78},   // LINE_LENGTH_A[7:0] = 3448
   {0x0164, 0x01},   // XADD_STA_A[11:8]
   {0x0165, 0x58},   // XADD_STA_A[7:0] = X top left = 344
   {0x0166, 0x0B},   // XADD_END_A[11:8]
   {0x0167, 0x77},   // XADD_END_A[7:0] = X bottom right = 2935
   {0x0168, 0x01},   // YADD_STA_A[11:8]
   {0x0169, 0xF0},   // YADD_STA_A[7:0] = Y top left = 496
   {0x016A, 0x07},   // YADD_END_A[11:8]
   {0x016B, 0xAF},   // YADD_END_A[7:0] = Y bottom right = 1967
   {0x016C, 0x05},   // x_output_size[11:8]
   {0x016D, 0x10},   // x_output_size[7:0] = 1296
   {0x016E, 0x02},   // y_output_size[11:8]
   {0x016F, 0xE0}, // y_output_size[7:0] = 736
   {0x0170, 0x01},   // X_ODD_INC_A
   {0x0171, 0x01},   // Y_ODD_INC_A
   {0x0174, 0x01},   // BINNING_MODE_H_A = x2-binning
   {0x0175, 0x01},   // BINNING_MODE_V_A = x2-binning
//    {0x0174, 0x00}, // BINNING_MODE_H_A = no-binning
//    {0x0175, 0x00}, // BINNING_MODE_V_A = no-binning
   {0x0176, 0x01},   // BINNING_CAL_MODE_H_A
   {0x0177, 0x01},   // BINNING_CAL_MODE_V_A
   {0x018C, 0x0A},   // CSI_DATA_FORMAT_A[15:8]
   {0x018D, 0x0A},   // CSI_DATA_FORMAT_A[7:0]
   {0x0301, 0x05},
   {0x0303, 0x01},
   {0x0304, 0x02},
   {0x0305, 0x02},
    {0x0309, 0x0A}, // OPPXCK_DIV
   {0x030B, 0x01}, // OPSYCK_DIV

   {0x0306, 0x00},   // PLL_VT_MPY[10:8]
   //{0x0307, 0x2E},   // PLL_VT_MPY[7:0] = 46
    {0x0307, 0x17}, // PLL_VT_MPY[7:0] = 23
    //{0x0307, 0x0F}, // PLL_VT_MPY[7:0] = 15

   {0x030C, 0x00},   // PLL_OP_MPY[10:8]
   //{0x030D, 0x5C}, // PLL_OP_MPY[7:0] = 92
    {0x030D, 0x2E}, // PLL_OP_MPY[7:0] = 46
    //{0x030D, 0x1E}, // PLL_OP_MPY[7:0] = 30

   {0x455E, 0x00},
   {0x471E, 0x4B},
   {0x4767, 0x0F},
   {0x4750, 0x14},
   {0x4540, 0x00},
   {0x47B4, 0x14},
   {0x4713, 0x30},
   {0x478B, 0x10},
   {0x478F, 0x10},
   {0x4793, 0x10},
   {0x4797, 0x0E},
   {0x479B, 0x0E},
   //{0x0601, 0x02}, // Test pattern = Color bar
    {0x0601, 0x00}, // Test pattern = Normal work
   {0x0620, 0x00},   // TP_WINDOW_X_OFFSET[11:8]
    {0x0621, 0x00}, // TP_WINDOW_X_OFFSET[7:0]
    {0x0621, 0x00}, // TP_WINDOW_Y_OFFSET[11:8]
    {0x0623, 0x00}, // TP_WINDOW_Y_OFFSET[7:0]
    {0x0624, 0x05}, // TP_WINDOW_WIDTH[11:8]
    {0x0625, 0x00}, // TP_WINDOW_WIDTH[7:0] = 1280
    {0x0626, 0x02}, // TP_WINDOW_HEIGHT[11:8]
    {0x0627, 0xD0}, // TP_WINDOW_HEIGHT[7:0] = 720
    {0x0100, 0x01}, /* mode select streaming on */
    {TABLE_END, 0x00}
};

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1623
Re: configure the frame of imx219 on vitis (TE0726-03Mo)
« Reply #1 on: April 12, 2021, 07:43:47 AM »
Hi,
you must check documentation of the sensor manufacturer if you want to modify camera register.

We can't help much here, sorry.
If you are a beginner,  I would recommend to test ZynqBerry with our 2019.2  Demo design 1 (prebuilt binaries from the project delivery).
If this works, create the project by yourself without changes (use the scripts to create the Vivado project and provided petalinux template for linux part) and regenerate all files  by yourself and test again.
If this works, start to modify like you want.

br
John

Oleksandr Kiyenko

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 404
Re: configure the frame of imx219 on vitis (TE0726-03Mo)
« Reply #2 on: April 12, 2021, 08:31:18 AM »
Hi,

A good source for such information is Linux drivers. You can find the driver for the sensor you want and probably will find
the complete register set in it.

Best regards
Oleksandr Kiyenko

Gloria

  • Active Member
  • *
  • Posts: 18
Re: configure the frame of imx219 on vitis (TE0726-03Mo)
« Reply #3 on: April 12, 2021, 09:22:33 AM »
Hi, I have the demo about the register configuration. The example that I have posted is from demo1.
However, I feel confused about the calculation of frame rate.
according to the description of IMX219, I notice there a paragraph that is related with the calculation of frame rate :
frame rate=1/(Time per Line[sec] /Frame Length) formula 1-1;
Time per Line[sec]=Line Length pck/(2* Pix Clock Freq[MHz]) formula 1-2;

From the register configuration list in demo mentioned above:
Fram length=0x09c8=(2504)d Register:0x0160_0x0161
Line Length pck=0x0D78=(3448)d Register:0x0162_0x0163
INCK Frequency=0x1800=24MHz Register:0x012A_0x012B

However, put these values in formula 1-1 and 1-2, the frame value is not equal to 30fps.
I think may be the Pix Clock Freq is not equal to INCK Frequency.
What is the problem?
Thank you very much !