Raspberry Pi MIPI Camera calibration

We have been trying to get imx219 raspberry pi camera to work on rockpi for quite some time. While it somewhat works on Debian out of the box (you own test_camera.sh script for example), rkcamsrc refuses to take calibration xml file from /etc/cam_iq/imx219.xml. Without it the color balance is all screwed up and the image is GREEN. We are using the latest debian patched with https://wiki.radxa.com/Rockpi4/radxa-apt.

Example of a working(green) gstreamer pipeline:

gst-launch-1.0 rkcamsrc device=/dev/video0 io-mode=4 isp-mode=0A ! videoconvert ! video/x-raw,format=NV12,width=1920,height=1080 ! jpegenc ! multifilesink location=%d.jpg

Example of a pipeline with xml calibrations that should work according to https://github.com/rockchip-linux/gstreamer-rockchip-extra, but doesn’t:

gst-launch-1.0 rkcamsrc device=/dev/video0 io-mode=4 isp-mode=2A tuning-xml-path=/etc/cam_iq/imx219.xml ! videoconvert ! video/x-raw,format=NV12,width=1920,height=1080 ! jpegenc ! multifilesink location=%d.jpg

Error log on the latter pipeline:

gst-launch-1.0 rkcamsrc device=/dev/video0 io-mode=4 isp-mode=2A tuning-xml-path=/etc/cam_iq/imx219.xml ! videoconvert ! video/x-raw,format=NV12,width=1920,height=1080 ! jpegenc ! multifilesink location=%d.jpg
Setting pipeline to PAUSED …
CAMHALInfo: load tunning file success.
CAMHALInfo: rk_aiq_init: initstatic success - rkisp ver 1.03
Pipeline is live and does not need PREROLL …
Setting pipeline to PLAYING …
New clock: GstSystemClock
CAMHALInfo: ------------INITIALIZE STATIC NOT READY
ADPF: AdpfApplyConfiguration: (enter)

ADPF: AdpfApplyConfiguration: (enter) 1

ADPF: AdpfApplyConfiguration: (enter) initialize calibration database access

ADPF: AdpfApplyConfiguration: (enter) initialize Adpf context with values from calibration database

ADPF: AdpfApplyConfiguration: (enter) initialize CamerIc driver dpf-config

requesting 2 MMAP buffersRKISP1: failed to apply sensor params for 5 Input/output error.
AWB: (message code 02): AwbMeanSum near zero!

RKISP1: failed to ioctl VIDIOC_QBUF for 22 Invalid argument.
RKISP1: failed to ioctl VIDIOC_QBUF for 22 Invalid argument.
RKISP1: failed to ioctl VIDIOC_QBUF for 22 Invalid argument.
RKISP1: failed to ioctl VIDIOC_QBUF for 22 Invalid argument.
AWB: AWB (message code 04): fLikeHoodSum near zero

RKISP1: failed to ioctl VIDIOC_QBUF for 22 Invalid argument.
AWB: AWB (message code 04): fLikeHoodSum near zero
And then this RKISP1 error repeats until you ctrl+c gstreamer.

Image sample. That bottom cup is pure white by the way.

Any help?

Dunno there is a script in overlay-debug/usr/local/bin/test_camera-rkisp1.sh

Which have been updated in https://github.com/rockchip-linux/rk-rootfs-build

Prob needs https://github.com/radxa/rk-rootfs-build but the Rockchip master just misses the Raxda Wifi/BT firmware patch.

I am not that great with Git as its prob real easy to pull the up to date rockchip and apply the firmware patch.
I would just pull that repo and copy and paste the patch… :slight_smile: