Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IMX296 not detected on Jetson Nano 4GB #124

Open
AAleka opened this issue Nov 28, 2024 · 1 comment
Open

IMX296 not detected on Jetson Nano 4GB #124

AAleka opened this issue Nov 28, 2024 · 1 comment

Comments

@AAleka
Copy link

AAleka commented Nov 28, 2024

I used your repo to get drivers for IMX296 camera on my Jetson Nano with AverMedia EN715 board. I could successfully flash the device but when I run dmesg | grep 'i2c' I get the following output:

[    0.450619] iommu: Adding device 546c0000.i2c to group 21
[    0.452022] tegra-pmc 7000e400.pmc: i2c-thermtrip node not found, emergency thermal reset disabled.
[    0.506682] iommu: Adding device 7000c000.i2c to group 25
[    0.506995] iommu: Adding device 7000c400.i2c to group 26
[    0.507243] iommu: Adding device 7000c500.i2c to group 27
[    0.507495] iommu: Adding device 7000c700.i2c to group 28
[    0.507746] iommu: Adding device 7000d000.i2c to group 29
[    0.507992] iommu: Adding device 7000d100.i2c to group 30
[    1.305648] i2c /dev entries driver
[    1.307245] i2c i2c-6: Added multiplexed i2c bus 7
[    1.307661] i2c i2c-6: Added multiplexed i2c bus 8
[    1.307666] i2c-mux-gpio cam_i2cmux: 2 port mux on Tegra I2C adapter adapter
[    1.322168] tegra-vii2c 546c0000.i2c: no acknowledge from address 0x10
[    1.338132] tegra-vii2c 546c0000.i2c: no acknowledge from address 0x10
[    1.350165] tegra-vii2c 546c0000.i2c: no acknowledge from address 0x10
[    1.362146] tegra-vii2c 546c0000.i2c: no acknowledge from address 0x10
[    1.374138] tegra-vii2c 546c0000.i2c: no acknowledge from address 0x10
[    1.386134] tegra-vii2c 546c0000.i2c: no acknowledge from address 0x10
[    1.398150] tegra-vii2c 546c0000.i2c: no acknowledge from address 0x10
[    1.410133] tegra-vii2c 546c0000.i2c: no acknowledge from address 0x10
[    1.422134] tegra-vii2c 546c0000.i2c: no acknowledge from address 0x10
[    1.434155] tegra-vii2c 546c0000.i2c: no acknowledge from address 0x10
...
[    6.114113] tegra-vii2c 546c0000.i2c: no acknowledge from address 0x10
[    6.126121] tegra-vii2c 546c0000.i2c: no acknowledge from address 0x10
[    6.138119] tegra-vii2c 546c0000.i2c: no acknowledge from address 0x10

Here is my configuration:

/*
 * Copyright (c) 2020-2023, Vision Components GmbH.  All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <dt-bindings/media/camera.h>
#include <dt-bindings/platform/t210/t210.h>

// ------------------------------------------------------------------------------------------------
//  Driver Configuration for NVIDIA Jetson Nano 4GB/2GB on NVIDIA Jetson Nano Developer Kit
// ------------------------------------------------------------------------------------------------
#define VC_MIPI_CAM_0       1   // 1: Enabled, 0: Disabled  (serial_a => CSI Port 0 => VI Stream 0)
#define VC_MIPI_CAM_1       1   // 1: Enabled, 0: Disabled  (serial_e => CSI Port 4 => VI Stream 4)
// ------------------------------------------------------------------------------------------------
//  Supported number of lanes
// -----+------------------------------------------------------------------------------------------
//  1   | OV7251, IMX296, IMX297
//  2   | OV9281, IMX264, IMX265
//  2,4 | IMX178, IMX183, IMX226, IMX250, IMX252, IMX273, IMX290, IMX327, IMX335, IMX392, 
//      | IMX412, IMX415, IMX462, IMX565, IMX566, IMX567, IMX568, IMX900
// -----+------------------------------------------------------------------------------------------
#define VC_MIPI_LANES       1   // 1, 2 Lanes
// ------------------------------------------------------------------------------------------------
//   Sensor Manufacturer
// -----+------------------------------------------------------------------------------------------
//   1  | Sony Sensor (IMX)
//   2  | Omni Vision Sensor (OV)
// -----+------------------------------------------------------------------------------------------
#define VC_MIPI_MANUFACTURER 1
// ------------------------------------------------------------------------------------------------
//  GStreamer Support
// ------------------------------------------------------------------------------------------------
//  If you want to use GStreamer with nvarguscamerasrc you have to adjust this settings in the 
//  device tree below. The sections which have to be modified are marked by a comment. 
//  To find the correct parameter values please follow the instruction in the main README.md of 
//  this repository https://github.com/VC-MIPI-modules/vc_mipi_nvidia#gstreamer-support
// ------------------------------------------------------------------------------------------------

#define VC_MIPI_METADATA_H  "0"

#if VC_MIPI_LANES == 1
    #define BUS_WIDTH 1
    #define NUM_LANES "1" 
    #define NUM_CSI_LANES 2
#endif
#if VC_MIPI_LANES == 2
    #define BUS_WIDTH 2
    #define NUM_LANES "2" 
    #define NUM_CSI_LANES 4
#endif

#if VC_MIPI_CAM_0 == 1 && VC_MIPI_CAM_1 == 1
    #define VC_MIPI_CAMERAS 2
#else
    #define VC_MIPI_CAMERAS 1
#endif

/ {
    host1x {
        vc_vi_base: vi {
            num-channels = <VC_MIPI_CAMERAS>;
            ports {
                #address-cells = <1>;
                #size-cells = <0>;
#if VC_MIPI_CAM_0 == 1
                vc_vi_port0: port@0 {
                    reg = <0>;
                    vc_vi_in0: endpoint {
                        port-index = <0>;
                        bus-width = <BUS_WIDTH>;
                        remote-endpoint = <&vc_csi_out0>;
                    };
                };
#endif
#if VC_MIPI_CAM_1 == 1
                vc_vi_port1: port@1 {
                    reg = <1>;
                    vc_vi_in1: endpoint {
                        port-index = <4>;
                        bus-width = <BUS_WIDTH>;
                        remote-endpoint = <&vc_csi_out1>;
                    };
                };
#endif
            };
        };

        vc_csi_base: nvcsi {
            num-channels = <VC_MIPI_CAMERAS>;
            #address-cells = <1>;
            #size-cells = <0>;
#if VC_MIPI_CAM_0 == 1
            vc_csi_chan0: channel@0 {
                reg = <0>;
                ports {
                    #address-cells = <1>;
                    #size-cells = <0>;
                    vc_csi_chan0_port0: port@0 {
                        reg = <0>;
                        vc_csi_in0: endpoint@0 {
                            port-index = <0>;
                            bus-width = <BUS_WIDTH>;
                            remote-endpoint = <&vc_mipi_out0>;
                        };
                    };
                    vc_csi_chan0_port1: port@1 {
                        reg = <1>;
                        vc_csi_out0: endpoint@1 {
                            remote-endpoint = <&vc_vi_in0>;
                        };
                    };
                };
            };
#endif
#if VC_MIPI_CAM_1 == 1
            vc_csi_chan1: channel@1 {
                reg = <1>;
                ports {
                    #address-cells = <1>;
                    #size-cells = <0>;
                    vc_csi_chan1_port0: port@0 {
                        reg = <0>;
                        vc_csi_in1: endpoint@2 {
                            port-index = <4>;
                            bus-width = <BUS_WIDTH>;
                            remote-endpoint = <&vc_mipi_out1>;
                        };
                    };
                    vc_csi_chan1_port1: port@1 {
                        reg = <1>;
                        vc_csi_out1: endpoint@3 {
                            remote-endpoint = <&vc_vi_in1>;
                        };
                    };
                };
            };
#endif
        };
    };

    cam_i2cmux {
#if VC_MIPI_CAM_0 == 1
        i2c@0 {
#if VC_MIPI_MANUFACTURER == 1
            vc_mipi_cam0: vc_mipi@1a {
                reg                     = <0x1a>;
#else
            vc_mipi_cam0: vc_mipi@60 {
                reg                     = <0x60>;
#endif
                compatible              = "nvidia,vc_mipi";
                devnode                 = "video0";
                use_sensor_mode_id      = "false";
                sensor_model            = "vc_mipi";

                num_lanes               = NUM_LANES;
                trigger_mode            = "0";
                io_mode                 = "0";

                // ----------------------------------------------------
                // If you want to use GStreamer with nvarguscamerasrc
                // you have to adjust this settings
                physical_w              = "4.968";
                physical_h              = "3.726";
                // ----------------------------------------------------

                // This node is needed by the Tegra framework.
                // You don't have to change any settings if just want to use the V4L API.
                mode0 {
                    num_lanes                = NUM_LANES;
                    tegra_sinterface         = "serial_a";
                    embedded_metadata_height = VC_MIPI_METADATA_H;
                    readout_orientation      = "0";

                    // ----------------------------------------------------
                    // If you want to use GStreamer with nvarguscamerasrc
                    // you have to adjust this settings. 
                    active_l                 = "0";
                    active_t                 = "0";
                    active_w                 = "1440";
                    active_h                 = "1080";
                    pixel_t                  = "bayer_rggb";

                    min_gain_val             = "0";         // mdB
                    max_gain_val             = "48000";     // mdB
                    step_gain_val            = "100";       // mdB
                    default_gain             = "0";         // mdB

                    min_exp_time             = "1";         // us
                    max_exp_time             = "1000000";   // us
                    step_exp_time            = "1";         // us
                    default_exp_time         = "10000";     // us

                    // For applications like argus_camera, there should
                    // be a minimal frame rate greater than zero!
                    min_framerate            = "1000";      // mHz
                    max_framerate            = "60300";     // mHz
                    step_framerate           = "100";       // mHz
                    default_framerate        = "60300";     // mHz
                    // ----------------------------------------------------

                    gain_factor              = "1000";
                    exposure_factor          = "1000000";
                    framerate_factor         = "1000";
                    inherent_gain            = "1";
                    min_hdr_ratio            = "1";
                    max_hdr_ratio            = "1";

                    line_length              = "0";
                    phy_mode                 = "DPHY";
                    discontinuous_clk        = "no";
                    mclk_khz                 = "24000";
                    pix_clk_hz               = "800000000";
                    mclk_multiplier          = "9.33";
                    cil_settletime           = "0";
                    dpcm_enable              = "false";
                };

                ports {
                    #address-cells = <1>;
                    #size-cells = <0>;
                    port@0 {
                        reg = <0>;
                        vc_mipi_out0: endpoint {
                            port-index = <0>;
                            bus-width = <BUS_WIDTH>;
                            remote-endpoint = <&vc_csi_in0>;
                        };
                    };
                };
            };
        };
#endif
#if VC_MIPI_CAM_1 == 1
        i2c@1 {
#if VC_MIPI_MANUFACTURER == 1
            vc_mipi_cam1: vc_mipi@1a {
                reg                     = <0x1a>;
#else
            vc_mipi_cam1: vc_mipi@60 {
                reg                     = <0x60>;
#endif
                compatible              = "nvidia,vc_mipi";
                devnode                 = "video1";
                use_sensor_mode_id      = "false";
                sensor_model            = "vc_mipi";

                num_lanes               = NUM_LANES;
                trigger_mode            = "0";
                io_mode                 = "0";

                // ----------------------------------------------------
                // If you want to use GStreamer with nvarguscamerasrc
                // you have to adjust this settings
                physical_w              = "4.968";
                physical_h              = "3.726";
                // ----------------------------------------------------

                // This node is needed by the Tegra framework.
                // You don't have to change any settings if just want to use the V4L API.
                mode0 {
                    num_lanes                = NUM_LANES;
                    tegra_sinterface         = "serial_e";
                    embedded_metadata_height = VC_MIPI_METADATA_H;
                    readout_orientation      = "0";

                    // ----------------------------------------------------
                    // If you want to use GStreamer with nvarguscamerasrc
                    // you have to adjust this settings. 
                    active_l                 = "0";
                    active_t                 = "0";
                    active_w                 = "1440";
                    active_h                 = "1080";
                    pixel_t                  = "bayer_rggb";

                    min_gain_val             = "0";         // mdB
                    max_gain_val             = "48000";     // mdB
                    step_gain_val            = "100";       // mdB
                    default_gain             = "0";         // mdB

                    min_exp_time             = "1";         // us
                    max_exp_time             = "1000000";   // us
                    step_exp_time            = "1";         // us
                    default_exp_time         = "10000";     // us

                    // For applications like argus_camera, there should
                    // be a minimal frame rate greater than zero!
                    min_framerate            = "1000";      // mHz
                    max_framerate            = "60300";     // mHz
                    step_framerate           = "100";       // mHz
                    default_framerate        = "60300";     // mHz
                    // ----------------------------------------------------

                    gain_factor              = "1000";
                    exposure_factor          = "1000000";
                    framerate_factor         = "1000";
                    inherent_gain            = "1";
                    min_hdr_ratio            = "1";
                    max_hdr_ratio            = "1";

                    line_length              = "0";
                    phy_mode                 = "DPHY";
                    discontinuous_clk        = "no";
                    mclk_khz                 = "24000";
                    pix_clk_hz               = "800000000";
                    mclk_multiplier          = "9.33";
                    cil_settletime           = "0";
                    dpcm_enable              = "false";
                };

                ports {
                    #address-cells = <1>;
                    #size-cells = <0>;
                    port@0 {
                        reg = <0>;
                        vc_mipi_out1: endpoint {
                            port-index = <4>;
                            bus-width = <BUS_WIDTH>;
                            remote-endpoint = <&vc_csi_in1>;
                        };
                    };
                };
            };
        };
#endif
    };

    lens@vc_mipi {
        min_focus_distance  = "0.0";
        hyper_focal         = "0.0";
        focal_length        = "6.0";
        f_number            = "2.0";
        aperture            = "0.0";
    };
};

/ {
    tcp: tegra-camera-platform {
        compatible = "nvidia, tegra-camera-platform";

        num_csi_lanes = <NUM_CSI_LANES>;
        max_lane_speed = <1500000>;
        min_bits_per_pixel = <10>;
        vi_peak_byte_per_pixel = <2>;
        vi_bw_margin_pct = <25>;
        max_pixel_rate = <240000>;
        isp_peak_byte_per_pixel = <5>;
        isp_bw_margin_pct = <25>;

        modules {
#if VC_MIPI_CAM_0 == 1
            cam_module0: module0 {
                status = "okay";
                badge = "porg_front_vc_mipi";
                position = "front";
                orientation = "1";
                cam_module0_drivernode0: drivernode0 {
                    status = "okay";
                    pcl_id = "v4l2_sensor";
#if VC_MIPI_MANUFACTURER == 1
                    devname = "vc_mipi 7-001a";
                    proc-device-tree = "/proc/device-tree/cam_i2cmux/i2c@0/vc_mipi@1a";
#else
                    devname = "vc_mipi 7-0060";
                    proc-device-tree = "/proc/device-tree/cam_i2cmux/i2c@0/vc_mipi@60";
#endif
                };
                cam_module0_drivernode1: drivernode1 {
                    status = "okay";
                    pcl_id = "v4l2_lens";
                    proc-device-tree = "/proc/device-tree/lens@vc_mipi/";
                };
            };
#endif
#if VC_MIPI_CAM_1 == 1
            cam_module1: module1 {
                status = "okay";
                badge = "porg_rear_vc_mipi";
                position = "rear";
                orientation = "1";
                cam_module1_drivernode0: drivernode0 {
                    status = "okay";
                    pcl_id = "v4l2_sensor";
#if VC_MIPI_MANUFACTURER == 1
                    devname = "vc_mipi 8-001a";
                    proc-device-tree = "/proc/device-tree/cam_i2cmux/i2c@1/vc_mipi@1a";
#else
                    devname = "vc_mipi 8-0060";
                    proc-device-tree = "/proc/device-tree/cam_i2cmux/i2c@1/vc_mipi@60";
#endif
                };
                cam_module1_drivernode1: drivernode1 {
                    status = "okay";
                    pcl_id = "v4l2_lens";
                    proc-device-tree = "/proc/device-tree/lens@vc_mipi/";
                };
            };
#endif
        };
    };
};

#define CAM1_PWDN     TEGRA_GPIO(S, 7)
#define CAM2_PWDN     TEGRA_GPIO(T, 0)
#define CAM_I2C_MUX   TEGRA_GPIO(I, 0)

/ {
    cam_i2cmux {
        status = "okay";
        compatible = "i2c-mux-gpio";
        #address-cells = <1>;
        #size-cells = <0>;
        mux-gpios = <&gpio CAM_I2C_MUX GPIO_ACTIVE_HIGH>;
        i2c-parent = <&i2c7>;
#if VC_MIPI_CAM_0 == 1
        i2c@0 {
            status = "okay";
            reg = <0>;
            #address-cells = <1>;
            #size-cells = <0>;
#if VC_MIPI_MANUFACTURER == 1
            vc_mipi@1a {
#else
            vc_mipi@60 {
#endif
                status = "okay";
                reset-gpios = <&gpio CAM1_PWDN GPIO_ACTIVE_HIGH>;
            };
        };
#endif
#if VC_MIPI_CAM_1 == 1
        i2c@1 {
            status = "okay";
            reg = <1>;
            #address-cells = <1>;
            #size-cells = <0>;
#if VC_MIPI_MANUFACTURER == 1
            vc_mipi@1a {
#else
            vc_mipi@60 {
#endif
                status = "okay";
                reset-gpios = <&gpio CAM2_PWDN GPIO_ACTIVE_HIGH>;
            };
        };
#endif
    };

    gpio@6000d000 {
        camera-control-output-low {
            gpio-hog;
            output-low;
            gpios = <CAM1_PWDN 0 CAM2_PWDN 0>;
            label = "cam1-pwdn", "cam2-pwdn";
        };
    };
};
@bazo80
Copy link
Collaborator

bazo80 commented Dec 9, 2024

Hello @AAleka ,

that means you have compiled in the vc mipi driver into the kernel of your AverMedia EN715 board?
And you are now struggeling with the device-tree include.
If you decompile the original device-tree binary tegra210-p3448-0002-p3449-0000-b00.dtb with

dtc -I dtb -O dts tegra210-p3448-0002-p3449-0000-b00.dtb -o tegra210-p3448-0002-p3449-0000-b00.dts

you will see, that there is used a tca9546 multiplexer. And so you have to adjust these entries accordingly.

best regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants