Page 1 of 1
MCAM400 : AEC/AGC
Posted: Wed Dec 16, 2020 10:16 pm
by GoblE
Hi,
I use the MCAM400 with a nanoPi M4 (image rk3399-sd-friendlydesktop-bionic-4.4-arm64-20201027).
Image is very dark when there is not much light so I think there is no AEC or AGC.
Do you know how I can enable it if there is ? Or do you know how I can access to registers to set gain by myself ?
Thanks for your help.
Re: MCAM400 : AEC/AGC
Posted: Wed Jan 13, 2021 2:41 am
by @lex
[quote="GoblE"]Hi,
I use the MCAM400 with a nanoPi M4 (image rk3399-sd-friendlydesktop-bionic-4.4-arm64-20201027).
Image is very dark when there is not much light so I think there is no AEC or AGC.
Do you know how I can enable it if there is ? Or do you know how I can access to registers to set gain by myself ?
Thanks for your help.[/quote]
I have been experimenting with the cameras on NanoPi M4.
The new rkisp engine has a demo application where you can pass the GAIN and EXPOSURE although I was not able to find how to use it with success. Auto mode works. You can take a look at the code and figure out how to do it with the current engine in FE images.
Re: MCAM400 : AEC/AGC
Posted: Mon Feb 08, 2021 9:36 pm
by GoblE
@lex wrote:
I have been experimenting with the cameras on NanoPi M4.
The new rkisp engine has a demo application where you can pass the GAIN and EXPOSURE although I was not able to find how to use it with success. Auto mode works. You can take a look at the code and figure out how to do it with the current engine in FE images.
Thank you very much for your feedback, I'll see If I can use this. If I find a way I'll put solution here

Re: MCAM400 : AEC/AGC
Posted: Sat Feb 13, 2021 9:35 am
by GoblE
@lex wrote:
The new rkisp engine has a demo application where you can pass the GAIN and EXPOSURE although I was not able to find how to use it with success.
Unfortunately, I didn't find this rkisp demo. Do you know where can I find it ? (I searched on github and friendly wiki but I didn't find

)
@lex wrote:
Auto mode works.
I changed the lens to have more angle and with current image (rk3399-sd-friendlydesktop-bionic-4.4-arm64-20201226.img.zip), camera output is very dark (photo in attachment).
Re: MCAM400 : AEC/AGC
Posted: Wed Feb 17, 2021 11:32 pm
by @lex
Here you find it:
https://github.com/rockchip-linux/camer ... p_demo.cppChanging the lens will not help. You need the 3A and set Exposure / Gain somehow. 3A is a closed source, Maybe contacting Rockchip or FE would help.
Libcamera has evolved and there are some tricks to get a descent Image but far from what you get in 4.4. If you master how to pass the correct EXPOSURE / GAIN in the rkisp demo engine, please post here.
You may find these interesting:
https://github.com/avafinger/nanopi-m4- ... a-mainlineThere are a few tricks you may find useful.
Re: MCAM400 : AEC/AGC
Posted: Sat Mar 06, 2021 5:31 pm
by ayaromenok
Due to bug in RkISP(fixed in April 2019) manual Exposure can't be set - so no manual mode. In fact - it's affect all linux images with kernel 4.4. And it's fixed in 4.19/FriendlyCore - so try to use it
Re: MCAM400 : AEC/AGC
Posted: Sun Mar 07, 2021 2:25 am
by @lex
I can't find any reference to this supposed fix in their kernel. Can you provide a link to that fix?
I have tested with kernel 4.19.161 and could not get it to work.
How did you test it and what parameters?
Re: MCAM400 : AEC/AGC
Posted: Sun Mar 21, 2021 3:02 pm
by ayaromenok
@lex wrote:
I can't find any reference to this supposed fix in their kernel. Can you provide a link to that fix?
I have tested with kernel 4.19.161 and could not get it to work.
How did you test it and what parameters?
It's fixed in RkISP driver repo, not a Kernel itself
https://github.com/rockchip-linux/camera_engine_rkisp/commit/0d549652bccf21b2710f595c93ac119df5147ddeand few fixes before - try to find with keyword "expos" and/or "gain" (sometime they use wrong spelling of work "exposure" )
I use RkISP demo, which use driver directly
https://github.com/rockchip-linux/camer ... rkisp_demoupd: it's a 4.19.111 kernel in FriendlyElec distro -
https://github.com/friendlyarm/kernel-r ... i4-v4.19.y
Re: MCAM400 : AEC/AGC
Posted: Sun Mar 21, 2021 4:11 pm
by @lex
[quote="ayaromenok"][quote="@lex"]I can't find any reference to this supposed fix in their kernel. Can you provide a link to that fix?
I have tested with kernel 4.19.161 and could not get it to work.
How did you test it and what parameters?[/quote]
It's fixed in RkISP driver repo, not a Kernel itself [url]https://github.com/rockchip-linux/camera_engine_rkisp/commit/0d549652bccf21b2710f595c93ac119df5147dde[/url]
and few fixes before - try to find with keyword "expos" and/or "gain" (sometime they use wrong spelling of work "exposure" )
I use RkISP demo, which use driver directly
https://github.com/rockchip-linux/camer ... rkisp_demoupd: it's a 4.19.111 kernel in FriendlyElec distro -
https://github.com/friendlyarm/kernel-r ... i4-v4.19.y[/quote]
You missed my answer in the previous post.
I am using the latest rkisp (the same link you posted) with kernel 4.19.161 and it does not work.
Can you please, provide the parameters you tested to improve the image and some images with the auto mode on and with your parameters to compare with?
If the fix is in the rkisp "driver" it should work since I have the latest code.
Re: MCAM400 : AEC/AGC
Posted: Mon Mar 22, 2021 10:52 am
by ayaromenok
@lex wrote:
You missed my answer in the previous post.
I am using the latest rkisp (the same link you posted) with kernel 4.19.161 and it does not work.
Can you please, provide the parameters you tested to improve the image and some images with the auto mode on and with your parameters to compare with?
If the fix is in the rkisp "driver" it should work since I have the latest code.
I didin't miss your answer - plz, use 4.19.111 to be sure, that it works(or make sure, that's nothing broken between 111 and 161 version in RkISP(kernel part) and OV4689 driver(it's 2 places in repo)).
I will upload images later today or tomorrow
Re: MCAM400 : AEC/AGC
Posted: Mon Apr 19, 2021 3:11 am
by ayaromenok
@lex wrote:
Can you please, provide the parameters you tested to improve the image and some images with the auto mode on and with your parameters to compare with?
Sorry for really delayed answer - just manage to get to hardware - please find follow examples:
- auto(gstreamer)
- manual: exposure 0.01sec, gain(analogue) 8
- manual: exposure 0.01sec, gain(analogue) 16
- manual: exposure 0.029sec, gain(analogue) 8
Looks like I can'ts add link to images from google drive - so link to folder with them - parameters coded in file name
https://drive.google.com/drive/folders/ ... CUS-jLJs0BUbuntu Focal build from 202103xx(I had same result starting from 202012xx with same kernel versions)
uname-a Linux cam5 4.19.111 #162 SMP PREEMPT Fri Mar 19 17:14:48 CST 2021 aarch64 aarch64 aarch64 GNU/Linux
Re: MCAM400 : AEC/AGC
Posted: Mon Apr 19, 2021 12:29 pm
by @lex
Right, still dark and a lot of noise. Anyway, we know now the FE distro works but I was expecting to have a bit more exposure.
Can you print your command line and the output of the command? For the record. There are two MCAM400 cameras (w/IR and without), which one do you have?
Re: MCAM400 : AEC/AGC
Posted: Wed Apr 21, 2021 12:27 pm
by ayaromenok
@lex wrote:
Right, still dark and a lot of noise.
Sorry, forget to mention - picture was taking early in the morning - around a time of sunrise in the city or even early

command line should something like
Code: Select all
rkisp_demo --device=/dev/video0 --width=2688 --height=1520 --iqfile=/etc/iqfile/ov4689....xml --count=10 --expo=0.029 --gain=8 --output=image.yuv
than convert from NV12 to JPEG.
V4L2 also works(and use different values for expo/gain), but without AWB (i.e. "green" image)
Re: MCAM400 : AEC/AGC
Posted: Wed Apr 21, 2021 3:28 pm
by @lex
Thanks, i am able to pass the correct params with kernel 4.19.161 and have a bright image, really bright

.
Just need a better denoise filter, just as the FE 4.4 has.
./rkisp_demo --device /dev/video0 --count 15 --width 2688 --height 1520 --format YU12 --gain 2 --expo 0.031 --output test_gain2_ov4689_2688x1520.yu12
Unfortunately, I can't make the camera with IR cut works with 4.19.161 and the mainline kernel.
That's why I asked you which camera you tested with. the Camera w/IR cut filter worked fine with FE 4.4, maybe I have damaged the sensor removing and inserting it many times.
I get this error:
[ 72.944191] rkisp1: MIPI mis error: 0x0000000e
Re: MCAM400 : AEC/AGC
Posted: Thu Apr 22, 2021 12:27 pm
by ayaromenok
@lex wrote:
Unfortunately, I can't make the camera with IR cut works with 4.19.161 and the mainline kernel.
That's why I asked you which camera you tested with. the Camera w/IR cut filter worked fine with FE 4.4, maybe I have damaged the sensor removing and inserting it many times.
I get this error:
[ 72.944191] rkisp1: MIPI mis error: 0x0000000e
Looks like I have a camera with IR cut (normal colors, price 12.99$).
Maybe your IR-cut camera is really damaged - IR filter affect colors result, but have very little effect on brightness (10% from F2.2 vs F2.0 for this camera).
Re: MCAM400 : AEC/AGC
Posted: Tue Jul 20, 2021 8:31 pm
by @lex
Just for the record, i just received a new sensor and found out the error reported here is due to a short on the last track of the FPC, luckily the sensor was not damaged. Changing the FPC was the fix.
[ 72.944191] rkisp1: MIPI mis error: 0x0000000e[/quote]