Posts: 1
Joined: Thu Jun 17, 2021 5:41 pm

imx219 register access

Thu Jun 17, 2021 5:45 pm

I need a way to directly access some of the registers for the IMX219. Specifically, I want to change 'windowing' of the sensor when using a selected resolution. On the OV5640 this was called "Image Windowing" (section 4.2 of the ov5640 spec). If I'm reading the IMX219 datasheet correctly, the imx219 calls this the Pixel Re-alignment in H and V directions and refer to the X_ADDR_STA_*, X_ADD_END_*, Y_ADD_STA_*, and Y_ADD_END_* registers. Any recommendations for how I can access these registers directly? I tried v4l2-dbg to read the registers but I get a "ioctl: VIDIOC_DBG_G_REGISTER failed" error. Any help would be greatly appreciated.

Posts: 3187
Joined: Tue Jun 30, 2015 1:35 pm

Re: imx219 register access

Fri Jun 18, 2021 5:05 am

Did you have a look at the libcamera sources on how to access the sensor?

Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11475
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: imx219 register access

Fri Jun 18, 2021 3:57 pm

Driver at ... c/imx219.c for use with libcamera or if you want raw Bayer images.

Writing a driver that allows the creation of a generic crop is generally incredibly difficult due to dependencies between registers, hence the tabled list of modes. Allowing userspace to freely prod registers is also generally a bad idea, hence the S_REGISTER ioctl not being implemented (nor is CONFIG_VIDEO_ADV_DEBUG enabled in the kernel builds).
Feel free to mess with the register sets as you wish.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Return to “Interfacing (DSI, CSI, I2C, etc.)”