Radxa cm3 sodimm and raspberry camera v2.1

Yo! \(^_^)/

  1. We bought a radxa cm3 sodimm(with rk3566)v1.3 20220927 and plugged it into our board(before that, we used this board for raspberry pi cm3+)
  2. Installed the bootloader(from here https://dl.radxa.com/rock3/images/loader/rock-3a/rk356x_spl_loader_ddr1056_v1.10.111.bin) and the image (from here https://mega.nz/file/hnwjCboL#GSVM3UqpyRCYUQgODHCcOF1A0JieN2qEQ9pu-TNwa6M), and it works!
  3. After that I wanted to check if the camera is working, and do it with fswebcam utility and i did not find any video device to pass it as an argument '(-_-) (camera was connected to mipi-csi0).
  4. In /boot/dtbs/4.19.193-215-rockchip-g2657e70400fc/rockchip/overlay/ i found radxa-cm3s-io-csi1-rpi-camera-v2.dtbo, rk3568-i2c2-m1.dtbo(it is i2c for camera) and with instruction (from here https://wiki.radxa.com/Device-tree-overlays) trying to load overlays. To no avail((

What could i have done wrong?

I think the overlay named “radxa-cm3s-io-csi0-rpi-camera-v2.dtbo”.
The camera can be previewed through cheese tool. But the quality of the picture is not ready yet, we are trying to debug a few days later.

Yes)

As far as i understand ‘cheese’ tool doesn’t have a cli interface((

I’ve made some progress with my problem:

  1. In order to enbale RPi camera v2 need to pull up GPIO3_D4 (Power Enable pin of rpi camera). I did it. How to change device tree for automatically pulling up this gpio? Because, as i understand, gpio have to pulled up before rpi camera initialization starts. Anybody know when it starts initalizing? :grinning:
  2. I added radxa-cm3s-io-csi1-rpi-camera-v2.dtbo to /boot/extlinux/extlinux.conf in field fdtoverlays and after reboot in /dev appears video0 - video8.
  3. I installed the fswebcam utility and tried to take a test photo:
fswebcam test.png

and get output with error:

--- Opening /dev/video0...
Trying source module v4l2...
/dev/video0 opened.
No input was specified, using the first.
Error selecting input 0
VIDIOC_S_INPUT: Inappropriate ioctl for device
  1. I tried to take a photo with streamer utility:
streamer -o ff.jpeg

and got an error:

libv4l2: error dequeuing buf: Invalid argument
ioctl: VIDIOC_DQBUF(index=0;type=VIDEO_CAPTURE;bytesused=0;flags=0x0 [];field=ANY;;timecode.type=0;timecode.flags=0;timecode.frames=0;timecode.seconds=0;timecode.minutes=0;timecode.hours=0;timecode.userbits="";sequence=0;memory=MMAP): Invalid argument

dmesg after streamer:

[  593.064400] rkisp-vir0: nonsupport pixelformat:\x00\x00\x00\x00
[  593.067069] rockchip-csi2-dphy1: No link between dphy and sensor
[  593.067112] rkisp-vir0: update sensor info failed -19

I need help :upside_down_face:

I decompile radxa-cm3s-io-csi1-rpi-camera-v2.dtbo:

dtc -I dtb -O dts radxa-cm3s-io-csi0-rpi-camera-v2.dtbo -o radxa-cm3s-io-csi0-rpi-camera-v2.dts 

and figure out that ‘Power enable’ pin of RPi Camera was wrong specified.

Need just replace /fragment@1/__overlay__/imx219@10:pwdn-gpios to:

pwdn-gpios = <0xffffffff 0x1c 0x00>;

Compile back to dtbo:

dtc -O dtb -o radxa-cm3s-io-csi0-rpi-camera-v2.dtbo radxa-cm3s-io-csi0-rpi-camera-v2.dts

replace it in /boot/dtbs/4.19.193-215-rockchip-g2657e70400fc/rockchip/overlay, and reboot.

After it, if you check initialized gpios:

sudo cat /sys/kernel/debug/gpio

you will see that appear

gpiochip3: GPIOs 96-127, parent: platform/fe760000.gpio, gpio3:
 gpio-124 (                    |pwdn                ) out lo  

It’s a ‘Power enable’ pin !!!

To check the camera, I tried the fswebcam utility and got hit on the head))

fswebcam -d /dev/video0 test.jpeg

--- Opening /dev/video0...
Trying source module v4l2...
/dev/video0 opened.
No input was specified, using the first.
Error selecting input 0
VIDIOC_S_INPUT: Inappropriate ioctl for device

Install streamer utility:

sudo apt install streamer

aaaand

streamer -o 1.jpeg

files / video: JPEG (JFIF) / audio: none
Using mplane plugin for capture 
ioctl: VIDIOC_S_FMT(type=VIDEO_CAPTURE;fmt.pix.width=320;fmt.pix.height=240;fmt.pix.pixelformat=0x00000000 [....];fmt.pix.field=ANY;fmt.pix.bytesperline=0;fmt.pix.sizeimage=0;fmt.pix.colorspace=unknown;fmt.pix.priv=4276996862): Invalid argument

drumroll …

And i get 1.jpeg in my home directory !!!
But after downloading, I found that the quality is very poor ((1

Next was gstreamer

gst-launch-1.0 v4l2src num-buffers=1 ! filesink location=/home/rock/2.jpg

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0:00:00.235610609
Setting pipeline to NULL ...
Freeing pipeline ...

And get

This is not the full resolution image, when I try to upload the full jpeg(1920x1080), I get an error.

It’s much better, but in panchrome. Need to set up a pipline of gstreamer, i think.

https://github.com/radxa-build/radxa-cm3-sodimm-io/releases/download/test-build-1/radxa-cm3-sodimm-io_debian_bullseye-test_xfce_t1.img.xz

maybe you can use this testing-image for testing imx219 camera.