Error in IMX219 camera mode modification

Hi all,
I am trying to bin the pixel of IMX219 (x2 analog binning) so that I can collect more lights.

I modified mode1 to work as 1640 x 1232 @ 120 fps. ( Refered topic)
But the camera cannot be opened in that mode.
When I opened the camera, it suddenly closed, and the system was down.

I am new to modifying the driver.
If you give me some advice, I will be grateful.


static imx219_reg imx219_mode_3264x2464_21fps = {
/* capture settings /
{0x0157, 0x00}, /
{0x015A, 0x09}, /
{0x015B, 0xbd}, /
format settings /
{0x0160, 0x09}, /
FRM_LENGTH[15:8] /
{0x0161, 0xC1}, /
{0x0162, 0x0D}, /
{0x0163, 0xE8}, /
LINE_LENGTH[7:0] / <-modified
{0x0164, 0x00},
{0x0165, 0x08},
{0x0166, 0x0C},
{0x0167, 0xC7},
{0x0168, 0x00},
{0x0169, 0x00},
{0x016A, 0x09},
{0x016B, 0x9F},
{0x016C, 0x06}, <-modified
{0x016D, 0x68}, <-modified
{0x016E, 0x04}, <-modified
{0x016F, 0xD0}, <-modified
{0x0170, 0x01},
{0x0171, 0x01},
{0x0174, 0x03}, <-modified
{0x0175, 0x03}, <-modified
{0x018C, 0x0A},
{0x018D, 0x0A},
{0x0264, 0x00},
{0x0265, 0x08},
{0x0266, 0x0C},
{0x0267, 0xC7},
{0x026C, 0x0C},
{0x026D, 0xC0},
clock dividers /
{0x0301, 0x05},
{0x0303, 0x01},
{0x0304, 0x03},
{0x0305, 0x03},
{0x0306, 0x00},
{0x0307, 0x39},
{0x0309, 0x0A},
{0x030B, 0x01},
{0x030C, 0x00},
{0x030D, 0x72},
{IMX219_TABLE_END, 0x00}
static const struct camera_common_frmfmt imx219_frmfmt[] = {
{{1640, 1232}, imx219_120fps, 1, 0, IMX219_MODE_3264x2464_21FPS}, <-modified
Add modes with no device tree support after below */
//{{1640, 1232}, imx219_120fps, 1, 0, IMX219_MODE_1640x1232_120FPS},
{{3264, 1848}, imx219_28fps, 1, 0, IMX219_MODE_3264x1848_28FPS},
{{1920, 1080}, imx219_30fps, 1, 0, IMX219_MODE_1920x1080_30FPS},
{{1280, 720}, imx219_60fps, 1, 0, IMX219_MODE_1280x720_60FPS},
{{1280, 720}, imx219_120fps, 1, 0, IMX219_MODE_1280x720_120FPS},


mode0 { /* IMX219_MODE_3264x2464_21FPS */
mclk_khz = “24000”;
num_lanes = “2”;
tegra_sinterface = “serial_a”;
phy_mode = “DPHY”;
discontinuous_clk = “yes”;
dpcm_enable = “false”;
cil_settletime = “0”;
active_w = “1640”; <-modified
active_h = “1232”; <-modified
pixel_t = “bayer_rggb”;
readout_orientation = “90”;
line_length = “3448”;
inherent_gain = “1”;
mclk_multiplier = “9.33”;
pix_clk_hz = “182400000”;

hello riul5627k,

may I know… do you have sensor vendor to support this? it’s straightforward for asking them of IMX219 (x2 analog binning) sensor init settings.

even though.
I’m not quite understand your purpose for binning the pixel to collect more lights.
why don’t you increase exposure time?

Hello JerryChang, Of course I did increase exposure time. But it was not sufficient…

hello riul5627k,

I’m not quite understand your purpose for binning the pixel to collect more lights.

please check above.
pixel binning it has advantage of frame-rate instead of more lux to pixels.

I know that the IMX219 supports analog pixel binning. (0x03 for analog pixel binning)
Unlike digital pixel binning, analog pixel binning uses multiple pixel detectors as one. That means we can collect more lights in a single (binned) pixel. Do I misunderstand something?

hello riul5627k,

let’s say it’s 2x2 averaged binning operations.
since the pixels of two adjacent row/column are averaged. it has not improved to the lux values.

could you please share the capture results for reference,
please also provide capture pipeline of the exposure settings you’ve used.

You already know that the larger the pixel, the more light you can get. I heard that analog binning works like a single large pixel, while digital binning is just useful for reducing the data. Are you saying that the IMX219’s analog pixel binning is average binning rather than additive binning? Could you kindly let me know if I’m missing anything?

I asked the image sensor provider(SONY) about the register but they say the camera driver is not belong their area. I know the NVIDIA offers camera driver. Where can I ask about the camera drivers? Could you please let me know?

This is my image, but I don’t know whether it is useful. I captured a fluorescence signal, and its dim intensity is widely known, so I should gather as much light as possible.

This is my pipline.

def pip_video(exp):
return “nvarguscamerasrc wbmode=1 aelock=true awblock=true exposuretimerange = "”+ str(exp)+" “+str(exp)+”" ispdigitalgainrange="10 10" gainrange="10.25 10.25" ! video/x-raw(memory:NVMM), width=(int)1640, height=(int)1232,format=(string)NV12, framerate=(fraction)21/1, exposurecompensation=0 ! tee name=t t. ! queue ! nvvidconv ! videobalance brightness=0 saturation=1 contrast=1 ! video/x-raw, format=(string)I420, width=1632, height=1232 ! appsink sync=0 ";

hello riul5627k,

yes… this is what I realize from IMX219 sensor specification.
however, I’m not sensor vendor, please contact with Sony team to double confirm this.

that should be some misunderstanding.
you should not bother the drivers as IMX219 default sensor mode is already worked. sensor initial register settings (i.e. imx219_mode_tbls.h) were provided by sensor vendor.
maybe you could searching for githubs for IMX219 (x2 analog binning) mode settings.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.