Camera image corruption problem - horizontal black lines


We have changed the regmap used to initialize the camera copying the one you can find in the current Linux OV7251 driver instead of the one we got from the driver developer before.

On our custom boards, this turned out to work correctly with Jetsons NX and Nano.

static const ov7251_reg mode_640x480[] = {
	{0x0103, 0x01},
	{0x0100, 0x00},
	{0x3005, 0x00},
	{0x3012, 0xc0},
	{0x3013, 0xd2},
	{0x3014, 0x04},
	{0x3016, 0xF0},
	{0x3017, 0xF0},
	{0x3018, 0xF0},
	{0x301a, 0xF0},
	{0x301b, 0xF0},
	{0x301c, 0xF0},
	{0x3023, 0x05},
	{0x3037, 0xf0},
	{0x303b, 0x02},
	{0x3098, 0x04}, 
	{0x3099, 0x28},
	{0x309a, 0x05},
	{0x309b, 0x04},
	{0x309d, 0x00},
	{0x30b0, 0x0a},
	{0x30b1, 0x01},
	{0x30b3, 0x64},
	{0x30b4, 0x03},
	{0x30b5, 0x05},
	{0x3106, 0xda},
	// {0x3009, 0x08}, // strobe
	// {0x3027, 0x08},
	// {0x3500, 0x00},
	// {0x3501, 0x1f},
	// {0x3502, 0x80},
	{0x3503, 0x07},
	{0x3509, 0x10},
	{0x350b, 0x10},
	{0x3600, 0x1c},
	{0x3602, 0x62},
	{0x3620, 0xb7},
	{0x3622, 0x04},
	{0x3626, 0x21},
	{0x3627, 0x30},
	{0x3630, 0x44},
	{0x3631, 0x35},
	{0x3634, 0x60},
	{0x3636, 0x00},
	{0x3662, 0x01},
	{0x3663, 0x70},
	{0x3664, 0x50},
	{0x3666, 0x0a},
	{0x3669, 0x1a},
	{0x366a, 0x00},
	{0x366b, 0x50},
	{0x3673, 0x01},
	{0x3674, 0xff},
	{0x3675, 0x03},
	{0x3705, 0xc1},
	{0x3709, 0x40},
	{0x373c, 0x08},
	{0x3742, 0x00},
	{0x3757, 0xb3},
	{0x3788, 0x00},
	{0x37a8, 0x01},
	{0x37a9, 0xc0},
	{0x3800, 0x00},
	{0x3801, 0x04},
	{0x3802, 0x00},
	{0x3803, 0x04},
	{0x3804, 0x02},
	{0x3805, 0x8b},
	{0x3806, 0x01},
	{0x3807, 0xeb},
	{0x3808, 0x02},
	{0x3809, 0x80},
	{0x380a, 0x01},
	{0x380b, 0xe0},
	{0x380c, 0x03},
	{0x380d, 0xa0},
	{0x380e, 0x06}, 
	{0x380f, 0xbc}, 
	{0x3810, 0x00},
	{0x3811, 0x04},
	{0x3812, 0x00},
	{0x3813, 0x05},
	{0x3814, 0x11},
	{0x3815, 0x11},
	{0x3820, 0x00}, 
	{0x3821, 0x00},
	{0x382f, 0x0e}, 
	{0x3832, 0x00},
	{0x3833, 0x05},
	{0x3834, 0x00},
	{0x3835, 0x0c},
	{0x3837, 0x00},
	{0x3b80, 0x00},
	{0x3b81, 0xa5},
	{0x3b82, 0x10},
	{0x3b83, 0x00},
	{0x3b84, 0x08},
	{0x3b85, 0x00},
	{0x3b86, 0x01},
	{0x3b87, 0x00},
	{0x3b88, 0x00},
	{0x3b89, 0x00},
	{0x3b8a, 0x00},
	{0x3b8b, 0x05},
	{0x3b8c, 0x00},
	{0x3b8d, 0x00},
	{0x3b8e, 0x00},
	{0x3b8f, 0x1a},
	{0x3b94, 0x05},
	{0x3b95, 0xf2},
	{0x3b96, 0x40},
	{0x3c00, 0x89},
	{0x3c01, 0x63},
	{0x3c02, 0x01},
	{0x3c03, 0x00},
	{0x3c04, 0x00},
	{0x3c05, 0x03},
	{0x3c06, 0x00},
	{0x3c07, 0x06},
	{0x3c0c, 0x01},
	{0x3c0d, 0xd0},
	{0x3c0e, 0x02},
	{0x3c0f, 0x0a},
	{0x4001, 0x42},
	{0x4004, 0x04},
	{0x4005, 0x00},
	{0x404e, 0x01},
	{0x4300, 0xff},
	{0x4301, 0x00},
	{0x4315, 0x00},
	{0x4501, 0x48},
	{0x4600, 0x00},
	{0x4601, 0x4e},
	{0x4801, 0x0f},
	{0x4806, 0x0f},
	{0x4819, 0xaa},
	{0x4823, 0x3e},
	{0x4837, 0x19},
	{0x4a0d, 0x00},
	{0x4a47, 0x7f},
	{0x4a49, 0xf0},
	{0x4a4b, 0x30},
	{0x5000, 0x85}, 
	{0x5001, 0x80},
	{0x0100, 0x01},
	{0x5E00, 0x0C},
	{ov7251_TABLE_END, 0x00}

You can safely ignore all of the V4L edits and try this with a clean kernel and DT.
Also, the last time we have updated the L4T package was around Aug '21.

Good luck!

Hi @drndarevicnikola ,

Thank you for your quick reply.
Actually, our sensor is AR0135, but we have same effect, black line, as yours.
So you only change the sensor setting without changing device three or others, the black line is disappear?

Thank you again!!

Hi @kingkong, you’re welcome!

We tried for a long time to fix the lines by changing the DT, changing the V4L2 drivers, Tegra code, nothing made a difference.
After that, we got some active scope probes and sniffed the MIPI lines, decoded the packets and saw that everything was OK from the camera.

Banging our heads on the wall, last ditch effort was hooking our custom boards with an adapter to a RPi 3, that proved that our setup was working fine, after that we “copied” the OV7251 driver from the mainline Linux to our Tegra board and voila.

Of course, your problem can very well sit somewhere else, in the DT or Nvidia pipeline. I would start by printing all of the debug messages from the argus, v4l, etc, making sure you don’t have any errors there. There is plenty of tutorials for that on this forum.

Hi @drndarevicnikola ,

Thank you very much.

We also sniff the MIPI lines, but it seems ok. Maybe we also try on another platform.