OV5640 camera module with A64

24 views
Skip to first unread message

Faruk KILAVUZ

unread,
Dec 7, 2020, 10:34:19 AM12/7/20
to linux...@googlegroups.com
Hello
I am working on OV5640 with Allwinner A64  chip. I followed the steps at https://linux-sunxi.org/CSI. I used kernel 5.10-rc6 and I compiled buildroot. I tried to explain what I do step by step. 

1- I activated this packages on kernel configuration;
VIDEO_DEV = y
MEDIA_CONTROLLER = y
VIDEO_V4L2_SUBDEV_API = y
V4L_PLATFORM_DRIVERS = y
VIDEO_SUN6I_CSI = m
VIDEO_OV5640 = m

Also I enabled media-ctl and v4l2-ctl package on busybox.


2- I added i2c-csi and &csi node. Nodes are same as those used in pinetab.

i2c-csi {
                compatible = "i2c-gpio";
                sda-gpios = <&pio 4 13 GPIO_ACTIVE_HIGH>; /* PE13 */
                scl-gpios = <&pio 4 12 GPIO_ACTIVE_HIGH>; /* PE12 */
                i2c-gpio,delay-us = <5>;
                #address-cells = <1>;
                #size-cells = <0>;

                /* Rear camera */
                ov5640: camera@3c {
                        compatible = "ovti,ov5640";
                        reg = <0x3c>;
                        pinctrl-names = "default";
                        pinctrl-0 = <&csi_mclk_pin>;
                        clocks = <&ccu CLK_CSI_MCLK>;
                        clock-names = "xclk";

                        AVDD-supply = <&reg_dldo3>;
                        DOVDD-supply = <&reg_aldo1>;
                        DVDD-supply = <&reg_eldo3>;
                        reset-gpios = <&pio 4 14 GPIO_ACTIVE_LOW>; /* PE14 */
                        powerdown-gpios = <&pio 4 15 GPIO_ACTIVE_HIGH>; /* PE15 */

                        port {
                                ov5640_ep: endpoint {
                                        remote-endpoint = <&csi_ep>;
                                        bus-width = <8>;
                                        hsync-active = <1>; /* Active high */
                                        vsync-active = <0>; /* Active low */
                                        data-active = <1>;  /* Active high */
                                        pclk-sample = <1>;  /* Rising */
                                };
                        };
                };
        };

and

&csi {

        status = "okay";

        port {
                csi_ep: endpoint {
                        remote-endpoint = <&ov5640_ep>;
                        bus-width = <8>;
                        hsync-active = <1>; /* Active high */
                        vsync-active = <0>; /* Active low */
                        data-active = <1>;  /* Active high */
                        pclk-sample = <1>;  /* Rising */
                };
        };
};

3- lsmod results:

Module                  Size  Used by    Not tainted
sr9700                 20480  0
dm9601                 20480  0
usbnet                 40960  2 sr9700,dm9601
snd_soc_simple_card    24576  0
sun50i_codec_analog    32768  0
snd_soc_simple_card_utils    24576  1 snd_soc_simple_card
sun8i_codec            32768  0
sun8i_adda_pr_regmap    16384  1 sun50i_codec_analog
sun4i_i2s              24576  0
snd_soc_core          159744  5 snd_soc_simple_card,sun50i_codec_analog,snd_soc_simple_card_utils,sun8i_codec,sun4i_i2s
axp20x_adc             20480  0
snd_pcm_dmaengine      20480  1 snd_soc_core
axp20x_usb_power       16384  0
axp20x_ac_power        16384  0
axp20x_battery         16384  0
pinctrl_axp209         16384  2
industrialio           65536  4 axp20x_adc,axp20x_usb_power,axp20x_ac_power,axp20x_battery
snd_pcm               106496  4 sun8i_codec,sun4i_i2s,snd_soc_core,snd_pcm_dmaengine
i2c_mv64xxx            24576  0
sun6i_csi              36864  0
snd_timer              40960  1 snd_pcm
lima                   57344  0
snd                    65536  3 snd_soc_core,snd_pcm,snd_timer
gpu_sched              28672  1 lima
soundcore              16384  1 snd
pwm_sun4i              20480  1
sun8i_ce               28672  0
crypto_engine          20480  1 sun8i_ce
sun4i_drm              20480  1
sun8i_mixer            40960  0
ov5640                 28672  0
v4l2_fwnode            24576  2 sun6i_csi,ov5640
panel_lvds             16384  0
sun4i_frontend         16384  1 sun4i_drm
pwm_bl                 20480  0
sun4i_tcon             36864  1 sun4i_drm
sun8i_tcon_top         20480  2 sun4i_drm,sun4i_tcon
cpufreq_dt             20480  0

4- media-ctl --print-topology result:

Media controller API version 5.10.0

Media device information
------------------------
driver          cedrus
model           cedrus
serial         
bus info        platform:cedrus
hw revision     0x0
driver version  5.10.0

Device topology
- entity 1: cedrus-source (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video0
    pad0: Source
        -> "cedrus-proc":0 [ENABLED,IMMUTABLE]

- entity 3: cedrus-proc (2 pads, 2 links)
            type Node subtype Unknown flags 0
    pad0: Sink
        <- "cedrus-source":0 [ENABLED,IMMUTABLE]
    pad1: Source
        -> "cedrus-sink":0 [ENABLED,IMMUTABLE]

- entity 6: cedrus-sink (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video0
    pad0: Sink
        <- "cedrus-proc":1 [ENABLED,IMMUTABLE]


But according to linux-sunxi.com/CSI page, driver name should be sun6i_csi. Even if I disable the cedrus package on kernel and recompile, the result is always the same.

As a result I did not get any images with the camera. How can I operate the camera. Do you have any suggestions on this matter?


Thanks your timing.
Best Regards

Faruk KILAVUZ

Chen-Yu Tsai

unread,
Dec 7, 2020, 10:44:00 AM12/7/20
to faruk....@genemek.com, linux...@googlegroups.com
media-ctl takes a '-d device' argument that you can use to specify another
media controller. Looks like on your system /dev/media0 is cedrus, so
/dev/media1 (if it exists, which it should) would be CSI.

> But according to linux-sunxi.com/CSI page, driver name should be sun6i_csi. Even if I disable the cedrus package on kernel and recompile, the result is always the same.

Now how could that be? If you disabled cedrus then media-ctl would not
report cedrus,
unless of course you did not actually remove the module file and it got loaded
despite you disabling it in the kernel config.

ChenYu

> As a result I did not get any images with the camera. How can I operate the camera. Do you have any suggestions on this matter?
>
>
> Thanks your timing.
> Best Regards
>
> Faruk KILAVUZ
>
> --
> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi...@googlegroups.com.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/linux-sunxi/e3ce9be6d0044f17a7585a31ac8156d5%40genemek.com.

Faruk KILAVUZ

unread,
Dec 7, 2020, 2:04:04 PM12/7/20
to Chen-Yu Tsai, linux...@googlegroups.com
 UUnfortunately /dev/media1 does not exist. This steps is not enough enable to CSI ?

But according to linux-sunxi.com/CSI page, driver name should be sun6i_csi. Even if I disable the cedrus package on kernel and recompile, the result is always the same.
Now how could that be? If you disabled cedrus then media-ctl would not
report cedrus,
unless of course you did not actually remove the module file and it got loaded
despite you disabling it in the kernel config.

ChenYu

As a result I did not get any images with the camera. How can I operate the camera. Do you have any suggestions on this matter?


Thanks your timing.
Best Regards

Faruk KILAVUZ

--
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/linux-sunxi/e3ce9be6d0044f17a7585a31ac8156d5%40genemek.com.


Faruk KILAVUZ

Chen-Yu Tsai

unread,
Dec 7, 2020, 8:32:41 PM12/7/20
to faruk....@genemek.com, Chen-Yu Tsai, linux...@googlegroups.com
I have no idea what you are missing. You should check your kernel logs
and see if everything is probed correctly.

> But according to linux-sunxi.com/CSI page, driver name should be sun6i_csi. Even if I disable the cedrus package on kernel and recompile, the result is always the same.
>
> Now how could that be? If you disabled cedrus then media-ctl would not
> report cedrus,
> unless of course you did not actually remove the module file and it got loaded
> despite you disabling it in the kernel config.
>
> ChenYu
>
> As a result I did not get any images with the camera. How can I operate the camera. Do you have any suggestions on this matter?
>
>
> Thanks your timing.
> Best Regards
>
> Faruk KILAVUZ
>
> --
> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi...@googlegroups.com.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/linux-sunxi/e3ce9be6d0044f17a7585a31ac8156d5%40genemek.com.
>
>
> Faruk KILAVUZ
>
> --
> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi...@googlegroups.com.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/linux-sunxi/504af08b6cb84ff39869c30d050002c5%40genemek.com.
Reply all
Reply to author
Forward
0 new messages