Jump to content

nano pi m4 camera module


bishoybasily

Recommended Posts

hello everyone,

i just received a new nano pi m4 4G with it's 13M camera module, the problem is that when i try to list the connected camera ls -lrth /dev/video* it shows only the usb cameras, does anyone knows how to get it working on armbian "Linux nanopim4 4.4.172-rk3399 #22 SMP Tue Jan 29 07:00:38 CET 2019 aarch64 aarch64 aarch64 GNU/Linux"

 

thanks in advance

Edited by bishoybasily
Link to comment
Share on other sites

Only FriendyArm dist(Desktop, Core) from 201812 support 13/4MPix cameras for now.

 

in armbian(with 4.4 kernel) you need:

 - build and install a kernel with ov13xx driver(it's disabled now, also it missed a camera config) and rockchip ISP driver enabled;

 - install rkisp gstreamer driver to get accelerated access to Rk3399 ISP(Image Signal Processor - where CSI cameras connected, );

 - maybe few more things;

 

new 4.20 kernel(you can install it from armbian-config) create a /dev/video0 - it's not correct device for camera.

 

in next few days I will make some test, so will share some info here :)

Link to comment
Share on other sites

On 2/5/2019 at 7:46 AM, ayaromenok said:

in armbian(with 4.4 kernel) you need:

 - build and install a kernel with ov13xx driver(it's disabled now, also it missed a camera config) and rockchip ISP driver enabled; 

which will likely fail.. :ph34r:

 

https://github.com/rockchip-linux/kernel/issues/125

https://github.com/rockchip-linux/kernel/issues/72

https://github.com/rockchip-linux/kernel/issues/98#issuecomment-396422765

 

I tried last weekend a quick one to get the ISP1 driver working on 4.4 for rk3399 and it looks quite similar to rk3288, seems that the ISP driver still messes with our kernelconfig..

 

be prepared.. ;)

Link to comment
Share on other sites

Hello everyone !

 

Would anyone have any updates on that ? 

I am looking to use my Nano Pi M4 with the OV4689 camera, and I want to bring a lot drivers improvements to get to 120-180FPS as the RK3399 and OV4689 are supposed to handle. 

I just started with the RK3399, and I saw that Armbian just added the drivers for this camera recently, but is unclear why Rockchip seems to want us to go through their own version of GStreamer. To my understanding their gstreamer seems to be an interface to access more low level features like the ISP of the RK, I guess to grab/process frames faster maybe ? Originally I was planning on using V4L2 and IOCTL commands to interact directly with the driver, but I am not even sure I will be able to do that, or if it would be more efficient to go through Gstreamer.
So if any of you are used to the Rockchip ecosystem, I'd be great if you could just guide me to avoid doing the wrong choices and get started on that driver quickly ! :)

 

To sum up in a few questions :

- Can I access the camera through V4L2 / IOCTL without Gstreamer ?

- Will it be less efficient to do so ? 

- Has anyone successfully installed their Gstreamer on Armbian 4.4 kernel ? (I always end up with issues).

 

Cheers !

EDIT: 
I actually find most answers here (http://opensource.rock-chips.com/wiki_Rockchip-isp1), now I guess I have to understand why the camera module gets "probbed successfully" but then fails to initialise at boot

[    1.645902] rk-ov4689.ov_camera_module_write_config(180) ERR: no active sensor configuration
[    1.645906] rk-ov4689.ov_camera_module_write_config(231) ERR: failed with error -14
[    1.646377] rk-ov4689.pltfrm_camera_module_read_reg(1035) ERR: i2c read from offset 0x0000300a failed with error -6
[    1.646596] rk-ov4689.pltfrm_camera_module_read_reg(1035) ERR: i2c read from offset 0x0000300b failed with error -6
[    1.646601] rk-ov4689.ov4689_check_camera_id(860) ERR: register read failed, camera module powered off?
[    1.646606] rk-ov4689.ov4689_check_camera_id(878) ERR: failed with error (-6)
[    1.646622] rk-ov4689.ov_camera_module_attach(254) ERR: failed with error -6
[    1.646632] cif_isp10_img_src_v4l2_i2c_subdev_to_img_src(59) ERR: failed with error -6
[    1.646635] cif_isp10_img_src_to_img_src(70) ERR: to_img_src failed!
[    1.646638] cif_isp10_img_src_to_img_src(78) ERR: failed with error -14
[    1.646642] cif_isp10_img_srcs_init(1101) ERR: failed with error -14
[    1.646645] cif_isp10_create(5980) ERR: cif_isp10_img_srcs_init failed
[    1.646648] cif_isp10_create(6017) ERR: failed with error -14

 

 

Link to comment
Share on other sites

welcome to the rabbit hole.. :thumbup::ph34r::lol:

 

 

19 hours ago, JulesThuillier said:

- Has anyone successfully installed their Gstreamer on Armbian 4.4 kernel ? (I always end up with issues).

months back yes.. At least for the Tinker with RK3288.. but with never pushed this kernelconfig to armbian...

 

https://github.com/armbian/build/commit/c26f02b65e6ac1c697b48d7677d1f178017f3994

 

for whatever reasons it mostly ends in a non booting kernel (e.g. bring back CONFIG_OF_OVERLAY and the kernel crashed again... :lol:).

 

19 hours ago, JulesThuillier said:

EDIT: 
I actually find most answers here (http://opensource.rock-chips.com/wiki_Rockchip-isp1), now I guess I have to understand why the camera module gets "probbed successfully" but then fails to initialise at boot


[    1.645902] rk-ov4689.ov_camera_module_write_config(180) ERR: no active sensor configuration
[    1.645906] rk-ov4689.ov_camera_module_write_config(231) ERR: failed with error -14
[    1.646377] rk-ov4689.pltfrm_camera_module_read_reg(1035) ERR: i2c read from offset 0x0000300a failed with error -6
[    1.646596] rk-ov4689.pltfrm_camera_module_read_reg(1035) ERR: i2c read from offset 0x0000300b failed with error -6
[    1.646601] rk-ov4689.ov4689_check_camera_id(860) ERR: register read failed, camera module powered off?
[    1.646606] rk-ov4689.ov4689_check_camera_id(878) ERR: failed with error (-6)
[    1.646622] rk-ov4689.ov_camera_module_attach(254) ERR: failed with error -6
[    1.646632] cif_isp10_img_src_v4l2_i2c_subdev_to_img_src(59) ERR: failed with error -6
[    1.646635] cif_isp10_img_src_to_img_src(70) ERR: to_img_src failed!
[    1.646638] cif_isp10_img_src_to_img_src(78) ERR: failed with error -14
[    1.646642] cif_isp10_img_srcs_init(1101) ERR: failed with error -14
[    1.646645] cif_isp10_create(5980) ERR: cif_isp10_img_srcs_init failed
[    1.646648] cif_isp10_create(6017) ERR: failed with error -14

 

 

that's all related to RK's old ISP driver.. ISP10!=ISP1 ... I thing isp10 is no longer maintained by RK (at least not in public)

 

cause the ISP1 will definitively end in an non-booting kernel with our config (tested it a few weeks ago for the RockPi cause it actually has a nice CSI on it). It seems that Rockchips interest in finding a solution is minor as soon as you use a kernel-config which differs from their config:

On 2/8/2019 at 7:46 PM, chwe said:

 

somewhere in my PM's there's a bootlog where the camera was successfully probed and everything worked 'fine' until they messed up something else which ended in a lost of interest to fix it. Maybe it's a trivial one inside their ISP1 code.. Who knows.. But Rockchips 4.4 kernel was annoying back then (constantly breaking things) and the drawbacks were to high to bring up the camera and break dt overlays with it (which is actually needed to support different camera modules on one board... and a bunch of stuff @martinayotte loves :P) .

 

Edit:

 

found it:

[    1.877458] iommu: Adding device ff910000.isp to group 0
...
[    2.757933] imx219 2-0010: Reading register 100 from 10 failed
[    2.782911] imx219 2-0010: Model ID 0x0219, Lot ID 0x5c6b63, Chip ID 0x01c2

 

it's the same driver as for the RK3399.. so basically it could be possible with a custom kernelconfig..

Link to comment
Share on other sites

Thanks for the help @chwe !

 

I have been trying all day to configure the kernel options using armbian (linux-rk3399-default.config file), to get rockchip_isp1 instead of isp10 :

# CONFIG_VIDEO_RK_CIF_ISP10 is not set
CONFIG_VIDEO_ROCKCHIP_CIF=y
CONFIG_VIDEO_ROCKCHIP_ISP1=y

I tried disabling the old one to enable the most recent (I still haven't understood what ROCKCHIP_CIF stands for...), but I couldn't get it to load. It never appears in the kernel log. It does work on FriendlyElec however... But I'd rather use Armbian as it runs faster.

 

One thing I don't understand is should I set the camera configuration in the .dts file or this is for the previous driver (isp10) ?

If I set the camera in the .dts file it will be a v4l2-i2c-subdev device type and use another driver. I think the v4l2-i2c-subdev is the newer system but I might be wrong, and I am not sure if it changes anything to the ISP control driver.

 

I'll keep you updated of my results here :)

 

Link to comment
Share on other sites

13 hours ago, JulesThuillier said:

I tried disabling the old one to enable the most recent (I still haven't understood what ROCKCHIP_CIF stands for...), but I couldn't get it to load. It never appears in the kernel log. It does work on FriendlyElec however... But I'd rather use Armbian as it runs faster.

how?

 

 

Link to comment
Share on other sites

2 hours ago, chwe said:

how?

 

 

 

Just been disabling it in the config file (linux-rk3399-default.config) while building with armbian script.

But enabling "CONFIG_VIDEO_ROCKCHIP_ISP1" didn't got it to load apparently... I am going to be looking for extra log.

 

By the way they are some interesting informations here : https://github.com/ayaromenok/test/issues/9

And the Nano Pi M4 just got supported on linux kernel 5.1 : https://github.com/torvalds/linux/commit/6ad63dec9c2c80710896edd1996e56c54a230870

 

Link to comment
Share on other sites

On 3/9/2019 at 12:38 AM, JulesThuillier said:

Back to the testing !

thanks to returning me to this thread :)

 

original FriendlyElec distro use gstreamer-camera  instead of   gstreamer-plugins/extra - which I expect - thats a trick :) 

( from github.com/rockchip-linux/ repos)

 

never get more than 20 minutes with camera\OpenCV with FriendlyElec distro, but with Armbian already 1.5+ hour and looks like no so big memory leaks.

continue testing :)

upd: 1.7h with opencv/canny - it's a not bad result, but not exactly what I need ;)

RKISP continue to drops warning/errors due to FIFO overflow.

Link to comment
Share on other sites

2 hours ago, ayaromenok said:

 

How did you managed to build it ? I am trying on the board with Armbian distro but always end with the following message, even thouhg the libraries are there they seem to be incompatible.

/usr/bin/ld: skipping incompatible ../ext/rkisp/lib/libcam_engine_cifisp.so when searching for -lcam_engine_cifisp
/usr/bin/ld: cannot find -lcam_engine_cifisp
/usr/bin/ld: skipping incompatible ../ext/rkisp/lib/libcam_ia.so when searching for -lcam_ia
/usr/bin/ld: cannot find -lcam_ia

 

I run the following command :

sudo ./config_build.sh # I had to change the gcc g++ toolchain path in the file and set LIB64 to FALSE first.
sudo make

 

Link to comment
Share on other sites

18 hours ago, JulesThuillier said:

I had to change the gcc g++ toolchain path in the file and set LIB64 to FALSE first.

gcc\g++ - correct. don't need to do anything with IS_LIB64 - since it's only selection for if. maybe need to set --prefix for autogen.sh to something like /usr/local instead of local dir.

 

libcam_engine_cifisp.so/libcam_ia.so is normal ELF 64-bit LSB objects, ARM aarch64 (you can check it with file utility)

 

PS: camera already working 12+ hours with gstreamer/opencv. with warnings\errors in dmesg, but without memory leaks :)

PPS: just in case - 64bit SO in attachment

libcam_engine_cifisp.so

libcam_ia.so

Link to comment
Share on other sites

Thanks ! 

Actually I just shouldn't have disabled LIB64, just change g++/gcc :)

 

How did you installed it then ? I have the "ERROR: pipeline could not be constructed: no element "rkisp"." error when trying to start gst-launch-1.0.

 

You can't believe how happy I was to read that :

Quote

PS: camera already working 12+ hours with gstreamer/opencv. with warnings\errors in dmesg, but without memory leaks 

 

GREAT JOB !!!!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines