Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to properly set up ov2718 camera module?
#1
Hey everyone!

I tested Lindenis with imx317 module and it works good, but we're currently trying to make it work with "ov2718" and it doesn't work.
I compiled ov2718_mipi.c driver, it correctly loads into kernel and even able to read/write to camera's i2c address but when I run 'ldcam -c -d 0 -o out'  it freezes with the following dmesg errors:

Code:
[  114.995285] [ov2718_mipi]PWR_ON!
[  115.079343] [ov2718_mipi]sensor_detect read value is 0x27
[  115.086025] [ov2718_mipi]sensor_detect read value is 0x70
[  115.101275] [VIN_ERR]buffer count is invalid, set to 3
[  115.120535] [ov2718_mipi]sensor_s_stream on = 1, 1920*1080 3008
[  116.178767] [ov2718_mipi]s_fmt set width = 1920, height = 1080
[  116.279632] [VIN_ERR]isp0 frame error
[  118.140426] [ov2718_mipi]sensor_s_stream on = 0, 1920*1080 3008
[  118.147839] [ov2718_mipi]PWR_OFF!


Here's the [sensor0] section from sys_config.fex file that I corrected to suit my camera:

Code:
[vind0/sensor0]
sensor0_used          = 1
sensor0_mname         = "ov2718_mipi"
sensor0_twi_cci_spi   = 0
sensor0_twi_cci_id    = 2
sensor0_twi_addr      = 0x6c
sensor0_mclk_id       = 2
sensor0_pos           = "front"
sensor0_isp_used      = 1
sensor0_fmt           = 1
sensor0_vflip         = 0
sensor0_hflip         = 0
sensor0_iovdd         = "iovdd-csi"
sensor0_iovdd_vol     = 1800000
sensor0_avdd          = ""
sensor0_avdd_vol      = 1800000
sensor0_dvdd          = "dvdd-csi-1"
sensor0_dvdd_vol      = 1200000
sensor0_power_en      =
sensor0_reset         = port:PI3<1><0><1><0>
sensor0_pwdn          = port:PI10<1><0><1><0>
sensor0_sm_hs         = port:PI5<1><0><1><0>
sensor0_sm_vs         = port:PI6<1><0><1><0>

Can someone help me with getting this camera to work?
According to Allwinner V5 manual it is supported.
Reply
#2
how do you start imx317_mipi ?? my imx317 don't work (both sensors)

set up: #define KERN_DEBUG KERN_SOH "7" /* debug-level messages */
and compare dmesg log for imx317 with ov2718

... logs output in v4l_print_fmtdesc(..) and v4l_print_format(..) functions

do you have ov2718 datasheet?

compare sensor_win_sizes structure for ov2718 and imx317 driver file

.mbus_code = MEDIA_BUS_FMT_SRGGB12_1X12 (imx317)
vs
.mbus_code = MEDIA_BUS_FMT_SBGGR12_1X12 (ov2718)

!! (SRGGB12 != SBGGR12) Smile

also:

info->combo_mode = CMB_TERMINAL_RES | CMB_PHYA_OFFSET3 | MIPI_NORMAL_MODE; (ov2718 sens)
vs
info->combo_mode = CMB_TERMINAL_RES | CMB_PHYA_OFFSET2 | MIPI_NORMAL_MODE; (imx317 sens)
Reply
#3
Thanks for response!
Yeah, I have ov2718 manual. I don't see errors about pixelformat (MEDIA_BUS_FMT_SBGGR12_1X12) so I guess error is not here? I tried setting "BG12" format in ldcam.c but it doesn't make any difference.

Although, what does CMB_PHYA_OFFSET3 mean? Are we sure ov2718 driver sets it correctly?

I am currently out of ideas... Seems that something's up in MIPI configuration, because i2c works.
If you have any more suggestions, I will gladly try it.

(10-23-2019, 08:50 AM)ssdmt Wrote: how do you start  imx317_mipi ??  my imx317 don't work (both sensors)

Well they work out of the box. Did you try to boot your Lindenis board using the official image: http://wiki.lindeni.org/index.php/Linbia...he_SD_card ?
After boot, compile ldcam and try to take a photo by running ./ldcam -c -d 0 -o out
Reply
#4
1) show modules.conf & mpp.conf file from: PROJECT_DIR/out/eagle/lindeni-v5/debian/target/etc/modules-load.d/
2) show modules.order file and list of the all files in directory: PROJECT_DIR/out/eagle/lindeni-v5/debian/target/lib/modules/4.4.55+/


P.s: "Did you try to boot your Lindenis board using the official image: http://wiki.lindeni.org/index.php/Linbia...he_SD_card ?"

I use emmc official image.
Reply
#5
(10-24-2019, 09:25 AM)DWD Wrote: Thanks for response!
Yeah, I have ov2718 manual. I don't see errors about pixelformat (MEDIA_BUS_FMT_SBGGR12_1X12) so I guess error is not here? I tried setting "BG12" format in ldcam.c but it doesn't make any difference.

Although, what does CMB_PHYA_OFFSET3 mean? Are we sure ov2718 driver sets it correctly?

I am currently out of ideas... Seems that something's up in MIPI configuration, because i2c works.
If you have any more suggestions, I will gladly try it.

(10-23-2019, 08:50 AM)ssdmt Wrote: how do you start  imx317_mipi ??  my imx317 don't work (both sensors)

Well they work out of the box. Did you try to boot your Lindenis board using the official image: http://wiki.lindeni.org/index.php/Linbia...he_SD_card ?
After boot, compile ldcam and try to take a photo by running ./ldcam -c -d 0 -o out

Maybe you can try sochips image as they are supporting it as well.

http://www.sochip.com.cn/v5/index.php?ti...ce_support
Reply
#6
(10-24-2019, 06:31 PM)ssdmt Wrote: 1)   show modules.conf & mpp.conf file from:   PROJECT_DIR/out/eagle/lindeni-v5/debian/target/etc/modules-load.d/
2)   show  modules.order  file and  list of the all files in directory:  PROJECT_DIR/out/eagle/lindeni-v5/debian/target/lib/modules/4.4.55+/


P.s:  "Did you try to boot your Lindenis board using the official image: http://wiki.lindeni.org/index.php/Linbia...he_SD_card ?"

I use emmc official image.

modules.conf:
Code:
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

mpp.conf:
Code:
videobuf2-dma-contig
vin_io
#imx317_mipi
ov2718_mipi
vin_v4l2
sunxi_aio
As you can see, I manually commented out imx module and inserted ov.

modules.order:

Code:
kernel/crypto/echainiv.ko
kernel/crypto/drbg.ko
kernel/crypto/jitterentropy_rng.ko
kernel/drivers/gpio/gpio-sunxi.ko
kernel/drivers/net/wireless/bcmdhd/bcmdhd.ko
kernel/drivers/net/wireless/rtl8723bs/8723bs.ko
kernel/drivers/net/usb/asix.ko
kernel/drivers/net/usb/ax88179_178a.ko
kernel/drivers/net/usb/cdc_ether.ko
kernel/drivers/net/usb/net1080.ko
kernel/drivers/net/usb/cdc_subset.ko
kernel/drivers/net/usb/zaurus.ko
kernel/drivers/net/usb/usbnet.ko
kernel/drivers/net/usb/cdc_ncm.ko
kernel/drivers/usb/mon/usbmon.ko
kernel/drivers/input/touchscreen/gt5688/gt5688.ko
kernel/drivers/input/touchscreen/s23501t0-g/s23501t0-g.ko
kernel/drivers/input/touchscreen/ft6x/ft6x-ts.ko
kernel/drivers/input/touchscreen/gt9xx/gt9xx_ts.ko
kernel/drivers/media/v4l2-core/videobuf2-dma-contig.ko
kernel/drivers/media/rc/sunxi-ir-rx.ko
kernel/drivers/media/platform/sunxi-eve/sunxi_eve.ko
kernel/drivers/media/platform/sunxi-cve/sunxi_cve.ko
kernel/drivers/media/platform/sunxi-ise/sunxi_ise.ko
kernel/drivers/media/platform/sunxi-aio/sunxi_aio.ko
kernel/drivers/media/platform/sunxi-vin/modules/sensor/imx317_mipi.ko
kernel/drivers/media/platform/sunxi-vin/modules/sensor/ov2718_mipi.ko
kernel/drivers/media/platform/sunxi-vin/modules/actuator/actuator.ko
kernel/drivers/media/platform/sunxi-vin/modules/actuator/ad5820_act.ko
kernel/drivers/media/platform/sunxi-vin/modules/actuator/dw9714_act.ko
kernel/drivers/media/platform/sunxi-vin/modules/actuator/ov8825_act.ko
kernel/drivers/media/platform/sunxi-vin/modules/actuator/an41908a_act.ko
kernel/drivers/media/platform/sunxi-vin/vin_io.ko
kernel/drivers/media/platform/sunxi-vin/vin_v4l2.ko
kernel/drivers/media/usb/uvc/uvcvideo.ko
kernel/drivers/media/usb/gspca/gspca_main.ko
kernel/drivers/md/dm-crypt.ko
kernel/drivers/iio/buffer/industrialio-triggered-buffer.ko
kernel/drivers/iio/buffer/kfifo_buf.ko
kernel/drivers/iio/imu/inv_mpu6050/inv-mpu6050.ko

List of all files in kernel directory (ls -R /lib/modules/4.4.55+/):

Code:
/lib/modules/4.4.55+/:
build   modules.alias      modules.builtin      modules.dep      modules.devname  modules.softdep  modules.symbols.bin
kernel  modules.alias.bin  modules.builtin.bin  modules.dep.bin  modules.order    modules.symbols  source

/lib/modules/4.4.55+/kernel:
crypto  drivers

/lib/modules/4.4.55+/kernel/crypto:
drbg.ko  echainiv.ko  jitterentropy_rng.ko

/lib/modules/4.4.55+/kernel/drivers:
gpio  iio  input  md  media  net  usb

/lib/modules/4.4.55+/kernel/drivers/gpio:
gpio-sunxi.ko

/lib/modules/4.4.55+/kernel/drivers/iio:
buffer  imu

/lib/modules/4.4.55+/kernel/drivers/iio/buffer:
industrialio-triggered-buffer.ko  kfifo_buf.ko

/lib/modules/4.4.55+/kernel/drivers/iio/imu:
inv_mpu6050

/lib/modules/4.4.55+/kernel/drivers/iio/imu/inv_mpu6050:
inv-mpu6050.ko

/lib/modules/4.4.55+/kernel/drivers/input:
touchscreen

/lib/modules/4.4.55+/kernel/drivers/input/touchscreen:
ft6x  gt5688  gt9xx  s23501t0-g

/lib/modules/4.4.55+/kernel/drivers/input/touchscreen/ft6x:
ft6x-ts.ko

/lib/modules/4.4.55+/kernel/drivers/input/touchscreen/gt5688:
gt5688.ko

/lib/modules/4.4.55+/kernel/drivers/input/touchscreen/gt9xx:
gt9xx_ts.ko

/lib/modules/4.4.55+/kernel/drivers/input/touchscreen/s23501t0-g:
s23501t0-g.ko

/lib/modules/4.4.55+/kernel/drivers/md:
dm-crypt.ko

/lib/modules/4.4.55+/kernel/drivers/media:
platform  rc  usb  v4l2-core

/lib/modules/4.4.55+/kernel/drivers/media/platform:
sunxi-aio  sunxi-cve  sunxi-eve  sunxi-ise  sunxi-vin

/lib/modules/4.4.55+/kernel/drivers/media/platform/sunxi-aio:
sunxi_aio.ko

/lib/modules/4.4.55+/kernel/drivers/media/platform/sunxi-cve:
sunxi_cve.ko

/lib/modules/4.4.55+/kernel/drivers/media/platform/sunxi-eve:
sunxi_eve.ko

/lib/modules/4.4.55+/kernel/drivers/media/platform/sunxi-ise:
sunxi_ise.ko

/lib/modules/4.4.55+/kernel/drivers/media/platform/sunxi-vin:
modules  vin_io.ko  vin_v4l2.ko

/lib/modules/4.4.55+/kernel/drivers/media/platform/sunxi-vin/modules:
actuator  sensor

/lib/modules/4.4.55+/kernel/drivers/media/platform/sunxi-vin/modules/actuator:
actuator.ko  ad5820_act.ko  an41908a_act.ko  dw9714_act.ko  ov8825_act.ko

/lib/modules/4.4.55+/kernel/drivers/media/platform/sunxi-vin/modules/sensor:
imx317_mipi.ko  ov2718_mipi.ko

/lib/modules/4.4.55+/kernel/drivers/media/rc:
sunxi-ir-rx.ko

/lib/modules/4.4.55+/kernel/drivers/media/usb:
gspca  uvc

/lib/modules/4.4.55+/kernel/drivers/media/usb/gspca:
gspca_main.ko

/lib/modules/4.4.55+/kernel/drivers/media/usb/uvc:
uvcvideo.ko

/lib/modules/4.4.55+/kernel/drivers/media/v4l2-core:
videobuf2-dma-contig.ko

/lib/modules/4.4.55+/kernel/drivers/net:
usb  wireless

/lib/modules/4.4.55+/kernel/drivers/net/usb:
asix.ko  ax88179_178a.ko  cdc_ether.ko  cdc_ncm.ko  cdc_subset.ko  net1080.ko  usbnet.ko  zaurus.ko

/lib/modules/4.4.55+/kernel/drivers/net/wireless:
bcmdhd  rtl8723bs

/lib/modules/4.4.55+/kernel/drivers/net/wireless/bcmdhd:
bcmdhd.ko

/lib/modules/4.4.55+/kernel/drivers/net/wireless/rtl8723bs:
8723bs.ko

/lib/modules/4.4.55+/kernel/drivers/usb:
mon

/lib/modules/4.4.55+/kernel/drivers/usb/mon:
usbmon.ko

Yesterday, I was reading the source file of ov2718_mipi.c more carefully and noticed that a lot of registers it attempts to write to does not exist in the ov2718 manual!
So now I am skeptical about the quality of the driver and maybe register set for 1080p mode is wrong. I will investigate about it more and return if I get any results.

P.S. There's a suggestion for you to use Sochip's image - I would advise you against it.
The reason is that sochip uses different kind of RAM (if I remember correctly) and therefore different voltage. You may damage your Lindenis if you don't correct the sys_config.fex in Sochip's image first.
Reply
#7
Photo 
'I was reading the source file of ov2718_mipi.c more carefully and noticed that a lot of registers it attempts to write to does not exist in the ov2718 manual!"

my ov2718 datasheet has version 2.03, july 2001 year ))) 18 year old!  and datasheet describe 2720 sensor! not 2718 ))

What the pixel rate are you setup? (which registers used for this?) table rate for ov2718 - https://yadi.sk/d/rithIqzt6W_Rqw
What the input clock frequency (for ov2718) are you setup in clk-sun8iw12.c file or sys_config.fex?
Reply
#8
(10-25-2019, 11:54 AM)ssdmt Wrote: my ov2718 datasheet has version 2.03, july 2001 year ))) 18 year old!  and datasheet describe 2720 sensor! not 2718 ))
Wait, are you suggesting that driver in Lindenis kernel named ov2718_mipi.c is actually a driver for ov2710 sensor?

(10-25-2019, 11:54 AM)ssdmt Wrote: What the pixel rate are you setup? (which registers used for this?) table rate for ov2718
First, the table you linked is for ov2720 sensor.
About pixel rate and registers, I am currently researching this topic... I honestly thought that driver would work out of the box, because you know, the name "ov2718_mipi" suggests it should work with ov2718 camera Smile I will provide more info on this later.

(10-25-2019, 11:54 AM)ssdmt Wrote: What the input clock frequency (for ov2718) are you setup in clk-sun8iw12.c file or sys_config.fex?
This is interesting, can you elaborate on it a bit more? Where in fex should I specify the input clock? I found this section:
Code:
[clock]
pll4            = 300
pll6            = 600
pll8            = 360
pll9            = 297
pll10           = 264
Is this it? I didn't specify anything in clk-sun8iw12.c.

The improper clock/frequency setup might be the case.
Thanks, you gave me some ideas where to look. I'll check ov2718 manual and will be back when I get additional information.
Reply
#9
there is still a moment: sys_config.fex file contains the following line
vind0_clk = 384000000

vind0 - this is the video input module, and in src kernel files we can see following lines:
of_property_read_u32(np, "vind0_clk", &core_clk);
vind->clk[VIN_TOP_CLK].frequency = core_clk;

where VIN_TOP_CLK is the clock of module CSIS module(hardware)! WHY 384MHz ??!! )))
in kernel code, in vin.c file we can see isp_clk = 297MHz .. WHY!!??? (may be it from pll9)

2-nd: we have in imx317_mipi.c file following: pixel clock = 720Mhz! mipi bitrate = 576MHz!

why 384MHz, if thepixel clock is 720MHz or the mipi bitrate is 576MHz ))))
Reply
#10
"Although, what does CMB_PHYA_OFFSET3 mean?"

answer:
the function sunxi_mipi_subdev_s_stream(..)  has the following function calls:

   
Code:
mipi->cmb_mode = res->res_combo_mode & 0xf;
   mipi->terminal_resistance = res->res_combo_mode & CMB_TERMINAL_RES;
   mipi->pyha_offset = (res->res_combo_mode & 0x70) >> 4;
   
   if (enable) {
     combo_rx_init(sd);
     bsp_mipi_csi_dphy_init(mipi->id);
     bsp_mipi_csi_set_para(mipi->id, &mipi->csi2_cfg);
     bsp_mipi_csi_set_fmt(mipi->id, mipi->csi2_cfg.total_rx_ch, &mipi->csi2_fmt);

     /*for dphy clock async*/
     bsp_mipi_csi_dphy_disable(mipi->id);
     bsp_mipi_csi_dphy_enable(mipi->id);
     bsp_mipi_csi_protocol_enable(mipi->id);
  } else ....


mipi->pyha_offset   it is the CMB_PHYA_OFFSET3 argument!  and it is passed to the function combo_rx_init(sd);  and then to the func. cmb_rx_phya_offset(mipi->id, mipi->pyha_offset);

void cmb_rx_phya_offset(unsigned int sel, unsigned int offset)
{
vin_reg_clr_set(cmb_rx_base_addr[sel] + CMB_PHYA_CTR_REG_OFF,
CMB_PHYA_OFFSET_SEL_MASK, offset << CMB_PHYA_OFFSET_SEL); /*mipi 3, lvds 0*/
}

But V5 manual does not contain descriptions of mipi registers (((

may be Lindenis will help us ??? ))
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)