Correct register value for RAW12 data reception

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Correct register value for RAW12 data reception

1,893 Views
t-sugiyama
Contributor II

Hello,
I want to receive RAW12 image data with MIPI-CSI and set the data to FB1 and FB2 with DMA of CSI Bridge.
However, I don't know the proper register settings for MIPI-CSI and CSI Bridge for RAW12.

1.TWO_8BIT_SENSOR
When TWO_8BIT_SENSOR is 0, it doesn't look like an image at all, but when TWO_8BIT_SENSOR is 1, it looks like an image.
(debayer is required separately)
Is 1 the right choice for TWO_8BIT_SENSOR in a RAW12 receiving environment?

2.BASEADDR_CHHANGE_ERROR
When receiving RAW12 and setting DMA1's FB1 and FB2 to be switched as follows, BASEADDR_CHHANGE_ERROR will occur and the data set will not be completed in FB1 and FB2.
CSI_CSICR18:BASEADDR_SWITCH_EN 1

With the following settings, the data will be set in FB1 and FB2, but the images cannot be synchronized well.
CSI_CSICR18:BASEADDR_SWITCH_EN 0

I would like to know if there is a missing setting for the above problem.

Since we are trying to acquire VGA size images with RAW12, we have made the following settings.
CSI_CSIIMAG_PARA:IMAGE_WIDTH 640
CSI_CSIIMAG_PARA:IMAGE_HEIGHT 480
CSI_CSICR18:MIPI_DATA_FORMAT RAW12(0x2C)

Thanks.
Tetsuya.

0 Kudos
2 Replies

1,743 Views
joanxie
NXP TechSupport
NXP TechSupport

did you change anything in the bsp? try to add the source code as below in your bsp:

 add  #define BIT_MIPI_DATA_FORMAT_RAW12    (0x2C << 25 ) , and

add this code to the "struct mx6s_fmt formats"

{
        .name        = "RAWRGB12 (SGRBG12)",
        .fourcc        = V4L2_PIX_FMT_SGRBG12,
       .pixelformat    = V4L2_PIX_FMT_SGRBG12,
       .mbus_code    = MEDIA_BUS_FMT_SRGGB12_1X12,

        .bpp        = 1,
     }

static int mx6s_configure_csi(struct mx6s_csi_dev *csi_dev)
     switch (csi_dev->fmt->pixelformat) {
     case V4L2_PIX_FMT_YUV32:
     case V4L2_PIX_FMT_SBGGR8:
+    case V4L2_PIX_FMT_SGRBG12:
         width = pix->width;
         break;
     case V4L2_PIX_FMT_UYVY:
 

static int mx6s_configure_csi(struct mx6s_csi_dev *csi_dev)
         case V4L2_PIX_FMT_SBGGR8:
             cr18 |= BIT_MIPI_DATA_FORMAT_RAW8;
             break;
+        case V4L2_PIX_FMT_SGRBG12:
+            cr18 |= BIT_MIPI_DATA_FORMAT_RAW12;
+            break;
         default:
             pr_debug("   fmt not supported\n");
             return -EINVAL;

pls set the bsp correct firstly

1,743 Views
t-sugiyama
Contributor II

Hello joan,

Thanks for the answer.
I am trying to control MIPI-CSI with cortex-M4 of i.MX8Mmini to get RAW12 format image from camera.
However, when I control to get the RAW12 data, I am missing one pixel for every two pixels I get.
So I'm looking into the correct acquisition method of RAW12.
The reference manual does not contain much information on how to handle images in RAW12 format, so I believe that if the correct register value is known, investigation will proceed.
The source code information given to me by Joan is a hint to find the register settings for RAW12 format.

Best regards
Tetsuya

0 Kudos