首页 > 技术知识 > 正文

1. 前言

使用LI-JXAV-MIPI-ADPT 4CAM和 AGX XAVIER 调试相机; 使用I2C工具无法检测相机I2C地址,测量电压缺少2.8V电压

连接图如下:

xavier平台imx334 I2C问题调试

2. 查询硬件说明文档

Xavier上的2.8V是由GPIO36控制的,可以在DLC的P2822原理图中看到

/sys/kernel/debug/tegra_pinctrl_reg | grep gpio36 未被开启

检查Xavier适配指南以更改pinmux电子表格并将此引脚启用为gpio。

3. 查看内核log

GPIO36 is TEGRA194_MAIN_GPIO(N, 0)

gpio@2200000 { camera-control-output-low { gpio-hog; output-low; gpios = <CAM0_RST_L 0 CAM0_PWDN_L 0 TEGRA194_MAIN_GPIO(N, 0) GPIO_ACTIVE_HIGH>; label = “cam0-rst”, “cam0-pwdn”, “cam0-pw”; }; };

在 /sys/kernel/debug/gpio可以看到 avdd-cam-2v8被设置成如下:

gpiochip0: GPIOs 288-511, parent: platform/2200000.gpio, tegra-gpio: … gpio-392 ( |avdd-cam-2v8 ) out lo

dmesg | grep GPIO

[ 0.828390] GPIO line 490 (pcie-reg-enable) hogged as output/high [ 0.828426] GPIO line 289 (pcie-reg-enable) hogged as output/high [ 0.828483] GPIO line 339 (wifi-enable) hogged as output/high [ 0.828517] GPIO line 347 (camera-control-output-low) hogged as output/low [ 0.828549] GPIO line 350 (camera-control-output-low) hogged as output/low [ 0.828605] GPIO line 392 (camera-control-output-low) hogged as output/low

dmesg | grep avdd-cam-2v8

[ 0.848106] avdd-cam-2v8: 2800 mV [ 5.825028] avdd-cam-2v8: disabling

发现这里又关闭了

4. 添加2.8V配置

添加 vana-supply = <&p2822_avdd_cam_2v8>;

pio@2200000 { camera-control-output-low { gpio-hog; output-low; gpios = <CAM0_RST_L 0 CAM0_PWDN_L 0>; label = “cam0-rst”, “cam0-pwdn”; }; }; i2c@3180000 { tca9546@70 { compatible = “nxp,pca9546”; reg = <0x70>; #address-cells = <1>; #size-cells = <0>; skip_mux_detect = “yes”; vcc-supply = <&p2822_vdd_1v8_cvb>; vcc_lp = “vcc”; force_bus_start = <CAMERA_I2C_MUX_BUS(0)>; i2c@0 { reg = <0>; i2c-mux,deselect-on-exit; #address-cells = <1>; #size-cells = <0>; imx334_a@34 { clocks = <&bpmp_clks TEGRA194_CLK_EXTPERIPH1>, <&bpmp_clks TEGRA194_CLK_EXTPERIPH1>; clock-names = “extperiph1”, “pllp_grtba”; mclk = “extperiph1”; reset-gpios = <&tegra_main_gpio CAM0_RST_L GPIO_ACTIVE_HIGH>; vana-supply = <&p2822_avdd_cam_2v8>; vif-supply = <&p2822_vdd_1v8_cvb>; }; }; }; };
<

这里需要了解什么是调节器。

一个调节器可能包含一个GPIO。 以这里为例,avdd-cam-2v8可能包含TEGRA194_MAIN_GPIO(N, 0)。调节器可以交给其他司机来控制。如“vana-supply”、“vif-supply”以稳压器为输入。

交付给驱动程序后,由该软件驱动程序控制。如果该驱动程序没有被使用,可能会看到调节器被“禁用”,正如日志显示的那样。这将导致一个额外的问题,如果已经分配了一个调节器/gpio给一个特定的驱动程序,那么不应该再把它放在gpio控制器中。

例如,如果将gpio分配给usb控制器,usb驱动程序可能需要通过调节器框架切换它。但是,在gpio控制器中,也可以强制gpio设置为低或高。这将引起矛盾。当然,系统只会选择一方来防止这样的错误。因此,gpio控制器中的设置可能不会生效。

5. 调试imx334驱动

进入/kernel/nvidia/drivers/media/i2c/ 编译imx334驱动

生成video0正常

media-ctl -p -d /dev/media0

Media controller API version 0.1.0 Media device information ———————— driver tegra194-vi5 model NVIDIA Tegra Video Input Device serial bus info hw revision 0x3 driver version 0.0.0 Device topology – entity 1: imx334 30-001a (1 pad, 1 link) type V4L2 subdev subtype Sensor flags 0 device node name /dev/v4l-subdev0 pad0: Source [fmt:SRGGB12_1X12/3864×2180 field:none colorspace:srgb] -> “15a00000.nvcsi–1”:0 [ENABLED] – entity 3: 15a00000.nvcsi–1 (2 pads, 2 links) type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev1 pad0: Sink <- “imx334 30-001a”:0 [ENABLED] pad1: Source -> “vi-output, imx334 30-001a”:0 [ENABLED] – entity 6: vi-output, imx334 30-001a (1 pad, 1 link) type Node subtype V4L flags 0 device node name /dev/video0 pad0: Sink <- “15a00000.nvcsi–1”:1 [ENABLED]
<

v4l2-ctl –all -d /dev/video0

Driver Info (not using libv4l2): Driver name : tegra-video Card type : vi-output, imx334 30-001a Bus info : platform:15c10000.vi:0 Driver version: 4.9.140 Capabilities : 0x84200001 Video Capture Streaming Extended Pix Format Device Capabilities Device Caps : 0x04200001 Video Capture Streaming Extended Pix Format Priority: 2 Video input : 0 (Camera 0: ok) Format Video Capture: Width/Height : 3864/2180 Pixel Format : RG12 Field : None Bytes per Line : 7728 Size Image : 16847040 Colorspace : sRGB Transfer Function : Default (maps to sRGB) YCbCr/HSV Encoding: Default (maps to ITU-R 601) Quantization : Default (maps to Full Range) Flags : Camera Controls group_hold 0x009a2003 (bool) : default=0 value=0 flags=execute-on-write sensor_mode 0x009a2008 (int64) : min=0 max=0 step=0 default=0 value=0 flags=slider gain 0x009a2009 (int64) : min=0 max=0 step=0 default=0 value=1 flags=slider exposure 0x009a200a (int64) : min=0 max=0 step=0 default=0 value=7 flags=slider frame_rate 0x009a200b (int64) : min=0 max=0 step=0 default=0 value=3 flags=slider sensor_configuration 0x009a2032 (u32) : min=0 max=0 step=0 default=0 flags=read-only, volatile, has-payload sensor_mode_i2c_packet 0x009a2033 (u32) : min=0 max=0 step=0 default=0 flags=read-only, volatile, has-payload sensor_control_i2c_packet 0x009a2034 (u32) : min=0 max=0 step=0 default=0 flags=read-only, volatile, has-payload bypass_mode 0x009a2064 (intmenu): min=0 max=1 default=0 value=0 override_enable 0x009a2065 (intmenu): min=0 max=1 default=0 value=0 height_align 0x009a2066 (int) : min=1 max=16 step=1 default=1 value=1 size_align 0x009a2067 (intmenu): min=0 max=2 default=0 value=0 write_isp_format 0x009a2068 (int) : min=1 max=1 step=1 default=1 value=1 sensor_signal_properties 0x009a2069 (u32) : min=0 max=0 step=0 default=0 flags=read-only, has-payload sensor_image_properties 0x009a206a (u32) : min=0 max=0 step=0 default=0 flags=read-only, has-payload sensor_control_properties 0x009a206b (u32) : min=0 max=0 step=0 default=0 flags=read-only, has-payload sensor_dv_timings 0x009a206c (u32) : min=0 max=0 step=0 default=0 flags=read-only, has-payload low_latency_mode 0x009a206d (bool) : default=0 value=0 preferred_stride 0x009a206e (int) : min=0 max=65535 step=1 default=0 value=0 sensor_modes 0x009a2082 (int) : min=0 max=30 step=1 default=30 value=1 flags=read-only
<

i2c: xavier平台imx334 I2C问题调试1

采集cmd

v4l2-ctl -d /dev/video0 –set-fmt-video=width=3864,height=2180,pixelformat=RG12 –set-ctrl bypass_mode=0 –stream-mmap –stream-count=1 –stream-to=frame.raw

log :

[ 1152.833553] imx334: power_on avdd error: 0 [ 1152.833563] imx334: power_on iovdd error: 0 [ 1153.133713] imx334: power_on switch_on: 1 [ 1235.519264] tegra-i2c 3180000.i2c: no acknowledge from address 0x3 [ 1235.519706] tegra-i2c 3180000.i2c: no acknowledge from address 0x4 [ 1235.520121] tegra-i2c 3180000.i2c: no acknowledge from address 0x5 [ 1235.520490] tegra-i2c 3180000.i2c: no acknowledge from address 0x6 [ 1235.520817] tegra-i2c 3180000.i2c: no acknowledge from address 0x7 [ 1235.521144] tegra-i2c 3180000.i2c: no acknowledge from address 0x8 [ 1235.521471] tegra-i2c 3180000.i2c: no acknowledge from address 0x9 [ 1235.521799] tegra-i2c 3180000.i2c: no acknowledge from address 0xa [ 1235.522137] tegra-i2c 3180000.i2c: no acknowledge from address 0xb [ 1235.522558] tegra-i2c 3180000.i2c: no acknowledge from address 0xc [ 1235.522974] tegra-i2c 3180000.i2c: no acknowledge from address 0xd [ 1235.523503] tegra-i2c 3180000.i2c: no acknowledge from address 0xe [ 1235.523920] tegra-i2c 3180000.i2c: no acknowledge from address 0xf [ 1235.524305] tegra-i2c 3180000.i2c: no acknowledge from address 0x10 [ 1235.524625] tegra-i2c 3180000.i2c: no acknowledge from address 0x11 [ 1235.524951] tegra-i2c 3180000.i2c: no acknowledge from address 0x12 [ 1235.527845] tegra-i2c 3180000.i2c: no acknowledge from address 0x13 [ 1235.534065] tegra-i2c 3180000.i2c: no acknowledge from address 0x14 [ 1235.540616] tegra-i2c 3180000.i2c: no acknowledge from address 0x15 [ 1235.546449] tegra-i2c 3180000.i2c: no acknowledge from address 0x16 [ 1235.552623] tegra-i2c 3180000.i2c: no acknowledge from address 0x17 [ 1235.558591] tegra-i2c 3180000.i2c: no acknowledge from address 0x18 [ 1235.565120] tegra-i2c 3180000.i2c: no acknowledge from address 0x19 [ 1235.571125] tegra-i2c 3180000.i2c: no acknowledge from address 0x1b [ 1235.577438] tegra-i2c 3180000.i2c: no acknowledge from address 0x1c [ 1235.583515] tegra-i2c 3180000.i2c: no acknowledge from address 0x1d [ 1235.589777] tegra-i2c 3180000.i2c: no acknowledge from address 0x1e [ 1235.596183] tegra-i2c 3180000.i2c: no acknowledge from address 0x1f [ 1235.602531] tegra-i2c 3180000.i2c: no acknowledge from address 0x20 [ 1235.608674] tegra-i2c 3180000.i2c: no acknowledge from address 0x21 [ 1235.615273] tegra-i2c 3180000.i2c: no acknowledge from address 0x22 [ 1235.621555] tegra-i2c 3180000.i2c: no acknowledge from address 0x23 [ 1235.627679] tegra-i2c 3180000.i2c: no acknowledge from address 0x24 [ 1235.634140] tegra-i2c 3180000.i2c: no acknowledge from address 0x25 [ 1235.640475] tegra-i2c 3180000.i2c: no acknowledge from address 0x26 [ 1235.646504] tegra-i2c 3180000.i2c: no acknowledge from address 0x27 [ 1235.653092] tegra-i2c 3180000.i2c: no acknowledge from address 0x28 [ 1235.659478] tegra-i2c 3180000.i2c: no acknowledge from address 0x29 [ 1235.665745] tegra-i2c 3180000.i2c: no acknowledge from address 0x2a [ 1235.671760] tegra-i2c 3180000.i2c: no acknowledge from address 0x2b [ 1235.678343] tegra-i2c 3180000.i2c: no acknowledge from address 0x2c [ 1235.684265] tegra-i2c 3180000.i2c: no acknowledge from address 0x2d [ 1235.690596] tegra-i2c 3180000.i2c: no acknowledge from address 0x2e [ 1235.697219] tegra-i2c 3180000.i2c: no acknowledge from address 0x2f [ 1235.703543] tegra-i2c 3180000.i2c: no acknowledge from address 0x30 [ 1235.709714] tegra-i2c 3180000.i2c: no acknowledge from address 0x31 [ 1235.715799] tegra-i2c 3180000.i2c: no acknowledge from address 0x32 [ 1235.722323] tegra-i2c 3180000.i2c: no acknowledge from address 0x33 [ 1235.728699] tegra-i2c 3180000.i2c: no acknowledge from address 0x34 [ 1235.735030] tegra-i2c 3180000.i2c: no acknowledge from address 0x35 [ 1235.741234] tegra-i2c 3180000.i2c: no acknowledge from address 0x36 [ 1235.747527] tegra-i2c 3180000.i2c: no acknowledge from address 0x37 [ 1235.753870] tegra-i2c 3180000.i2c: no acknowledge from address 0x38 [ 1235.759923] tegra-i2c 3180000.i2c: no acknowledge from address 0x39 [ 1235.766654] tegra-i2c 3180000.i2c: no acknowledge from address 0x3a [ 1235.772482] tegra-i2c 3180000.i2c: no acknowledge from address 0x3b [ 1235.779041] tegra-i2c 3180000.i2c: no acknowledge from address 0x3c [ 1235.785167] tegra-i2c 3180000.i2c: no acknowledge from address 0x3d [ 1235.791541] tegra-i2c 3180000.i2c: no acknowledge from address 0x3e [ 1235.797930] tegra-i2c 3180000.i2c: no acknowledge from address 0x3f [ 1235.804020] tegra-i2c 3180000.i2c: no acknowledge from address 0x40 [ 1235.810371] tegra-i2c 3180000.i2c: no acknowledge from address 0x41 [ 1235.816707] tegra-i2c 3180000.i2c: no acknowledge from address 0x42 [ 1235.823377] tegra-i2c 3180000.i2c: no acknowledge from address 0x43 [ 1235.829413] tegra-i2c 3180000.i2c: no acknowledge from address 0x44 [ 1235.835572] tegra-i2c 3180000.i2c: no acknowledge from address 0x45 [ 1235.841885] tegra-i2c 3180000.i2c: no acknowledge from address 0x46 [ 1235.848391] tegra-i2c 3180000.i2c: no acknowledge from address 0x47 [ 1235.854626] tegra-i2c 3180000.i2c: no acknowledge from address 0x48 [ 1235.861045] tegra-i2c 3180000.i2c: no acknowledge from address 0x49 [ 1235.867099] tegra-i2c 3180000.i2c: no acknowledge from address 0x4a [ 1235.873533] tegra-i2c 3180000.i2c: no acknowledge from address 0x4b [ 1235.879573] tegra-i2c 3180000.i2c: no acknowledge from address 0x4c [ 1235.885889] tegra-i2c 3180000.i2c: no acknowledge from address 0x4d [ 1235.892534] tegra-i2c 3180000.i2c: no acknowledge from address 0x4e [ 1235.898582] tegra-i2c 3180000.i2c: no acknowledge from address 0x4f [ 1235.904781] tegra-i2c 3180000.i2c: no acknowledge from address 0x50 [ 1235.911375] tegra-i2c 3180000.i2c: no acknowledge from address 0x51 [ 1235.917719] tegra-i2c 3180000.i2c: no acknowledge from address 0x52 [ 1235.923828] tegra-i2c 3180000.i2c: no acknowledge from address 0x53 [ 1235.930132] tegra-i2c 3180000.i2c: no acknowledge from address 0x55 [ 1235.936649] tegra-i2c 3180000.i2c: no acknowledge from address 0x56 [ 1235.942688] tegra-i2c 3180000.i2c: no acknowledge from address 0x57 [ 1235.948890] tegra-i2c 3180000.i2c: no acknowledge from address 0x58 [ 1235.955209] tegra-i2c 3180000.i2c: no acknowledge from address 0x59 [ 1235.961525] tegra-i2c 3180000.i2c: no acknowledge from address 0x5a [ 1235.968031] tegra-i2c 3180000.i2c: no acknowledge from address 0x5b [ 1235.974400] tegra-i2c 3180000.i2c: no acknowledge from address 0x5c [ 1235.980685] tegra-i2c 3180000.i2c: no acknowledge from address 0x5d [ 1235.986966] tegra-i2c 3180000.i2c: no acknowledge from address 0x5e [ 1235.993347] tegra-i2c 3180000.i2c: no acknowledge from address 0x5f [ 1235.999705] tegra-i2c 3180000.i2c: no acknowledge from address 0x60 [ 1236.005849] tegra-i2c 3180000.i2c: no acknowledge from address 0x61 [ 1236.012152] tegra-i2c 3180000.i2c: no acknowledge from address 0x62 [ 1236.018439] tegra-i2c 3180000.i2c: no acknowledge from address 0x63 [ 1236.024615] tegra-i2c 3180000.i2c: no acknowledge from address 0x64 [ 1236.030842] tegra-i2c 3180000.i2c: no acknowledge from address 0x65 [ 1236.037344] tegra-i2c 3180000.i2c: no acknowledge from address 0x66 [ 1236.043634] tegra-i2c 3180000.i2c: no acknowledge from address 0x67 [ 1236.049961] tegra-i2c 3180000.i2c: no acknowledge from address 0x68 [ 1236.056025] tegra-i2c 3180000.i2c: no acknowledge from address 0x69 [ 1236.062364] tegra-i2c 3180000.i2c: no acknowledge from address 0x6a [ 1236.068567] tegra-i2c 3180000.i2c: no acknowledge from address 0x6b [ 1236.075142] tegra-i2c 3180000.i2c: no acknowledge from address 0x6c [ 1236.081214] tegra-i2c 3180000.i2c: no acknowledge from address 0x6d [ 1236.087834] tegra-i2c 3180000.i2c: no acknowledge from address 0x6e [ 1236.093798] tegra-i2c 3180000.i2c: no acknowledge from address 0x6f [ 1236.100380] tegra-i2c 3180000.i2c: no acknowledge from address 0x71 [ 1236.106408] tegra-i2c 3180000.i2c: no acknowledge from address 0x72 [ 1236.112678] tegra-i2c 3180000.i2c: no acknowledge from address 0x73 [ 1236.119013] tegra-i2c 3180000.i2c: no acknowledge from address 0x74 [ 1236.125285] tegra-i2c 3180000.i2c: no acknowledge from address 0x75 [ 1236.131823] tegra-i2c 3180000.i2c: no acknowledge from address 0x76 [ 1236.138130] tegra-i2c 3180000.i2c: no acknowledge from address 0x77 [ 1297.464965] imx334: power_on avdd error: 0 [ 1297.464974] imx334: power_on iovdd error: 0 [ 1297.765131] imx334: power_on switch_on: 1 [ 1297.789293] tegra-i2c 3180000.i2c: no acknowledge from address 0x1a [ 1297.789623] regmap_util_write_table_8:regmap_util_write_table:-121 [ 1297.789723] imx334 30-001a: Error writing mode [ 1297.799900] [RCE] vi5_hwinit: firmware CL2018101701 protocol version 2.2 [ 1300.311769] tegra194-vi5 15c10000.vi: no reply from camera processor [ 1300.311974] tegra194-vi5 15c10000.vi: uncorr_err: request timed out after 2500 ms [ 1300.312117] tegra194-vi5 15c10000.vi: err_rec: attempting to reset the capture channel [ 1300.314634] tegra194-vi5 15c10000.vi: err_rec: successfully reset the capture channel [ 1300.319352] ————[ cut here ]———— [ 1300.319493] WARNING: CPU: 0 PID: 7835 at /media/nouuata/06e46bb1-8a26-420b-a612-9f042982d7cd/work_drive/jetson_agx_xavier/jetpack/public_sources_4.4.1/Linux_for_Tegra/source/public/kernel_src/kernel/kernel-4.9/drivers/media/v4l2-core/videobuf2-core.c:1370 vb2_start_streaming+0xd4/0x158 [ 1300.319905] Modules linked in: bnep fuse zram overlay spidev userspace_alert nvgpu bluedroid_pm ip_tables x_tables [ 1300.319988] CPU: 0 PID: 7835 Comm: v4l2-ctl Tainted: G W 4.9.140-tegra #11 [ 1300.319993] Hardware name: Jetson-AGX (DT) [ 1300.319999] task: ffffffc7ce9bc600 task.stack: ffffffc7b609c000 [ 1300.320006] PC is at vb2_start_streaming+0xd4/0x158 [ 1300.320012] LR is at vb2_start_streaming+0x6c/0x158 [ 1300.320018] pc : [<ffffff8008b35ee4>] lr : [<ffffff8008b35e7c>] pstate: 20400045 [ 1300.320023] sp : ffffffc7b609fb30 [ 1300.320030] x29: ffffffc7b609fb30 x28: 0000000000000000 [ 1300.320043] x27: ffffffc7d6235000 x26: 0000000000000001 [ 1300.320055] x25: ffffff8009fff080 x24: 0000000000000012 [ 1300.320067] x23: 0000000000000000 x22: ffffffc7b609fd10 [ 1300.320079] x21: ffffffc7d706c768 x20: ffffffc7d706c780 [ 1300.320091] x19: 00000000ffffff87 x18: 0000007f97161a70 [ 1300.320103] x17: 0000007f970d3f50 x16: ffffff80082756f8 [ 1300.320115] x15: 0000000000000000 x14: 0000000000007c00 [ 1300.320127] x13: 00000000000000b4 x12: 071c71c71c71c71c [ 1300.320139] x11: 000000000000000b x10: 0000000000000a10 [ 1300.320151] x9 : ffffffc7b609f3a0 x8 : ffffffc7ce9bd070 [ 1300.320163] x7 : fefefeff646c606d x6 : 00000000133a5e75 [ 1300.320176] x5 : 0000000000000000 x4 : 0000000000000001 [ 1300.320187] x3 : 0000000000000000 x2 : 0000000000010000 [ 1300.320199] x1 : 0000000000000000 x0 : ffffffc7a5dbb1b8
<

仍然获取不到2.8V电压

6. 查询dts配置 & 修改调节器

tegra194-camera-imx334-a00.dtsi

{ host1x { vi@15c10000 { num-channels = <1>; ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; imx334_vi_in0: endpoint { port-index = <0>; bus-width = <4>; remote-endpoint = <&imx334_csi_out0>; }; }; }; }; nvcsi@15a00000 { num-channels = <1>; #address-cells = <1>; #size-cells = <0>; channel@0 { reg = <0>; ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; imx334_csi_in0: endpoint@0 { port-index = <0>; bus-width = <4>; remote-endpoint = <&imx334_imx334_out0>; }; }; port@1 { reg = <1>; imx334_csi_out0: endpoint@1 { remote-endpoint = <&imx334_vi_in0>; }; }; }; }; }; }; i2c@3180000 { tca9546@70 { i2c@0 { imx334_a@1a { compatible = “nvidia,imx334”; /* I2C device address */ reg = <0x1a>; /* V4L2 device node location */ devnode = “video0”; /* Physical dimensions of sensor */ physical_w = “3.674”; physical_h = “2.738”; sensor_model = “imx334”; /* Define any required hw resources needed by driver */ /* ie. clocks, io pins, power sources */ avdd-reg = “vana”; iovdd-reg = “vif”; /* Defines number of frames to be dropped by driver internally after applying */ /* sensor crop settings. Some sensors send corrupt frames after applying */ /* crop co-ordinates */ /*post_crop_frame_drop = “0”;*/ /* if true, delay gain setting by one frame to be in sync with exposure */ delayed_gain = “true”; has-eeprom; //fuse_id_start_addr = <91>; mode0 { mclk_khz = “24000”; num_lanes = “4”; tegra_sinterface = “serial_a”; phy_mode = “DPHY”; discontinuous_clk = “yes”; dpcm_enable = “false”; cil_settletime = “0”; active_w = “3864”; active_h = “2180”; mode_type = “bayer”; pixel_phase = “rggb”; csi_pixel_bit_depth = “12”; readout_orientation = “0”; line_length = “5500”; inherent_gain = “1”; mclk_multiplier = “30”; pix_clk_hz = “742240215”; gain_factor = “1”; min_gain_val = “1”; max_gain_val = “30”; step_gain_val = “1”; default_gain = “1”; min_hdr_ratio = “1”; max_hdr_ratio = “64”; framerate_factor = “1”; min_framerate = “3”; max_framerate = “60”; step_framerate = “1”; default_framerate= “60”; exposure_factor = “1”; min_exp_time = “7”; max_exp_time = “166725”; step_exp_time = “1”; default_exp_time = “16”; embedded_metadata_height = “1”; dynamic_pixel_bit_depth = “12”; pixel_t = “bayer_rggb”; }; ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; imx334_imx334_out0: endpoint { port-index = <0>; bus-width = <4>; remote-endpoint = <&imx334_csi_in0>; }; }; }; }; }; }; }; lens_imx344@A6V26 { min_focus_distance = “0.0”; hyper_focal = “0.0”; focal_length = “5.00”; f_number = “2.0”; aperture = “2.2”; }; }; / { tegra-camera-platform { compatible = “nvidia, tegra-camera-platform”; num_csi_lanes = <4>; max_lane_speed = <1500000>; min_bits_per_pixel = <10>; vi_peak_byte_per_pixel = <2>; vi_bw_margin_pct = <25>; max_pixel_rate = <750000>; isp_peak_byte_per_pixel = <5>; isp_bw_margin_pct = <25>; /** * The general guideline for naming badge_info contains 3 parts, and is as follows, * The first part is the camera_board_id for the module; if the module is in a FFD * platform, then use the platform name for this part. * The second part contains the position of the module, ex. “rear” or “front”. * The third part contains the last 6 characters of a part number which is found * in the modules specsheet from the vender. */ modules { module0 { badge = “imx334_bottom_imx334”; position = “bottom”; orientation = “0”; drivernode0 { /* Declare PCL support driver (classically known as guid) */ pcl_id = “v4l2_sensor”; /* Driver v4l2 device name */ devname = “imx334 30-001a”; /* Declare the device-tree hierarchy to driver instance */ proc-device-tree = “/proc/device-tree/i2c@3180000/tca9546@70/i2c@0/imx334_a@1a”; }; drivernode1 { /* Declare PCL support driver (classically known as guid) */ pcl_id = “v4l2_lens”; proc-device-tree = “/proc/device-tree/lens_imx344@A6V26/”; }; }; }; }; };
<

tegra194-p2822-0000-camera-imx334-a00.dtsi

#include <t19x-common-modules/tegra194-camera-imx334-a00.dtsi> #include “dt-bindings/clock/tegra194-clock.h” #define CAM0_RST_L TEGRA194_MAIN_GPIO(H, 3) //59 port #define CAM0_PWDN TEGRA194_MAIN_GPIO(H, 6) //62 #define CAM1_RST_L TEGRA194_MAIN_GPIO(T, 6) //120 #define CAM1_PWDN TEGRA194_MAIN_GPIO(T, 5) //119 #define CAMERA_I2C_MUX_BUS(x) (0x1E + x) /* camera control gpio definitions */ / { gpio@2200000 { camera-control-output-low { gpio-hog; output-low; gpios = <CAM0_RST_L 0 CAM0_PWDN 0>; label = “cam0-rst”, “cam0-pwdn”; }; }; i2c@3180000 { tca9546@70 { compatible = “nxp,pca9546”; reg = <0x70>; #address-cells = <1>; #size-cells = <0>; skip_mux_detect = “yes”; vif-supply = <&p2822_vdd_1v8_cvb>; vana-supply = <&p2822_avdd_cam_2v8>; vcc-supply = <&p2822_vdd_1v8_cvb>; vcc_lp = “vcc”; force_bus_start = <CAMERA_I2C_MUX_BUS(0)>; i2c@0 { reg = <0>; i2c-mux,deselect-on-exit; #address-cells = <1>; #size-cells = <0>; imx334_a@1a { //def-addr = <0x1a>; /* Define any required hw resources needed by driver */ /* ie. clocks, io pins, power sources */ clocks = <&bpmp_clks TEGRA194_CLK_EXTPERIPH1>, <&bpmp_clks TEGRA194_CLK_EXTPERIPH1>; clock-names = “extperiph1”, “pllp_grtba”; mclk = “extperiph1”; reset-gpios = <&tegra_main_gpio CAM0_RST_L GPIO_ACTIVE_HIGH>; vana-supply = <&p2822_avdd_cam_2v8>; vif-supply = <&p2822_vdd_1v8_cvb>; }; }; }; }; };
<

检查传感器的具体硬件设置 通常有调节器,2v8, 1v8和1v2用于传感器模块上的电源。 例如, 可以查看“avdd-cam-2v8”调节器的设备树,

p2822_avdd_cam_2v8: regulator@107 { compatible = “regulator-fixed”; reg = <107>; regulator-name = “avdd-cam-2v8”; regulator-min-microvolt = <2800000>; regulator-max-microvolt = <2800000>; gpio = <&tegra_main_gpio TEGRA194_MAIN_GPIO(N, 0) 0>; enable-active-high; };

需要指定正确的调节器设置以解决i2c无应答故障

通过调试正确的调节器,可以正常获取2.8V电压了 但是现在访问imx334 I2C还是异常

[ 2.383102] imx334: board_setup pw on err: 0 [ 2.383107] imx334: board_setup err: 0 [ 2.383165] imx334: set_gain [ 2.383169] imx334: get_gain_reg [ 2.383173] imx334: write_reg [ 2.383757] tegra-i2c 3180000.i2c: no acknowledge from address 0x1b [ 2.383948] imx334 30-001b: imx334_write_reg: i2c write failed, 0x30e9 = 0 [ 2.384153] imx334 30-001b: imx334_set_gain: gain control error [ 2.384270] imx334 30-001b: Error -121 in control hdl setup [ 2.384398] imx334 30-001b: Failed to init ctrls imx334 [ 2.384501] imx334: tegracam_v4l2subdev_register err: -121 [ 2.384507] imx334 30-001b: tegra camera subdev registration failed [ 2.384846] imx334: probe of 30-001b failed with error -121 7. 查看sensor datasheet

确认以下几个地方

xavier平台imx334 I2C问题调试2

xavier平台imx334 I2C问题调试3

xavier平台imx334 I2C问题调试4

添加如下时序配置

/* dig 1.2v */ if (pdata->regulators.dvdd) err |= camera_common_regulator_get(dev, &pw->dvdd, pdata->regulators.dvdd); /* IO 1.8v */ if (pdata->regulators.iovdd) err |= camera_common_regulator_get(dev, &pw->iovdd, pdata->regulators.iovdd); /* analog 2.8v */ if (pdata->regulators.avdd) err |= camera_common_regulator_get(dev, &pw->avdd, pdata->regulators.avdd);

目前imx334的I2C可以正常访问

猜你喜欢