关于iic设备树的写法

你好,请问下,我的外部IIC芯片接在i2c-1总线上面,我在这个 /public/hardware/nvidia/platform/t19x/jakku/kernel-dts/common目录下的 tegra194-p3668-common.dtsi文件中添加i2c-1的节点,内容如下(我用 i2cdetect -l查询,是接在c240000地址上的):
i2c@c240000{
IC2-1@40 {
compatible = “NVIDIA,xxxx”; 注册 = <0x40>;

#address 细胞 = <1>;
#size 个单元格 = <0>;
};
};
目前驱动和设备时可以匹配的,但是不知道怎么配置这个引脚是复用引脚还是普通IO引脚,我用Jetson_Xavier_NX_Pinmux_Configuration配置引脚后,生成的设备树没有IIC的节点,我想问的是我的iic设备的节点要添加到哪个文件中,还是自己新建一个.dts文件,还是用Jetson_Xavier_NX_Pinmux_Configuration生成的.dtsi文件,以及我怎么写这个iic设备节点的内容,上述的写法是否正确?

Hello,

This topic may be best served in the Jetson forums.
I have moved it over for you.

Best regards,
Tom

hello 3242096136,

here’s developer guide for Pinmux Changes.
may I know what your actual pin connections? if your carrier board schematic differs from that of the reference carrier board in Jetson Xavier NX Developer Kit. you must change the pinmux configuration applied by the software.
please see-also reference driver to register your i2c device.

我使用了Pinmux_Config配置表,是excel文档,点击这个文档的“Generate DT File”可以生成3个.dtsi文件,但里面没有IIC设备树的配置,这pinmux不是用excel来生成设备树文件吗? 我就想知道我的IIC芯片接在i2c1总线上的,怎么写这个iic设备树?

hello 3242096136,

pinmux spreadsheet is used to create the board configuration, it’s the cfg file for default pin settings. those settings may be alter by device tree, or driver pin control operations.

please check the public release sources,
for example, $public_sources/Linux_for_Tegra/source/public/hardware/nvidia/soc/t19x/kernel-dts/tegra194-soc/tegra194-soc-i2c.dtsi

did you meant you’ve device connected to gen1_i2c: i2c@3160000?
you should update the device tree. please add your device property within the scope of i2c@3160000.
note, you should double check you’ve assign regulator settings correctly. otherwise you might see i2c communication failure.

目前我是把设备节点的属性添加到tegra194-soc-i2c.dtsi文件中的,但我把设备节点的属性添加后,编译不过;其次,我的IIC芯片是接在英伟达核心板的I2C-1上的,对应内部的I2C-9芯片引脚,但i2c-9有两个,是通过ID区分的,怎么区分?

hello 3242096136,

what’s the built error? had you review the schematic to connect your device correctly?
anyways, please check reference device tree sources to implement your driver.

我的外围器件是IIC设备,是接在英伟达模块的I2C-1上,但是这个I2C-1是接在芯片内部的I2C-9上面的,那么这个IIC设备的设备树怎么写? 我之前是按照内核里面的devecetree/bindings文档去编写的,设备和驱动是可以配对的,但是数据写不进IIC设备,我怀疑是IIC的设备树节点写错了或者是iic设备挂载的IIC总线的地址搞错引起的,所以我请教是这个设备树节点具体内容该怎么写,写在哪个文件里面,能否给个正确的示例给我?

hello 3242096136,

please check reference device tree as following…
$public_sources/Linux_for_Tegra/source/public/hardware/nvidia/platform/t19x/jakku/kernel-dts/

what’s the error?
please sharing kernel error logs if you really need to root cause the issue.

我现在主要怀疑是IIC总线的地址是否搞错没有,我是接在如模块的I2C-1上的,但是是芯片内部的I2C-9,但I2C-9上没有地址,如图:


1@4)RYC0BC27)N@$Z52E7TR

hello 3242096136,

please refer to NVIDIA Jetson Xavier NX GPIO Header Pinout - JetsonHacks
did you connect your device with pin-3/pin-5 on Jetson Xavier NX J12 expansion header?

please refer to Jetson Xavier NX Product Design Guide for the [Figure 12-1. I2C Connections].
it’s actually using signal DP_AUX_CH3_P and DP_AUX_CH3_N.
so, it is… signal (I2C1) <—> TRM (I2C9) <—> DTS/ Dev (i2c-8, i2c@31e0000).

我现在使用的是I2C-8,地址为31e0000,但是在应用层读写的时候,出现如下错误提示,这是什么原因引起的:

{8KM3J%DU4CYXFK)`)W()B
X6~%1Z{CEU22K{3G6JBEZXJ

hello 3242096136,

may I have your answer please.
Question>> did you connect your device with pin-3/pin-5 on Jetson Xavier NX J12 expansion header?

是的,iic设备是连接到3脚和5脚

hello 3242096136,

i2c no ack messages usually due to regulator settings, please check you’ve given correct power supply to your i2c device.

你好,IIC设备供电是正常的,在驱动中,我创建了一个设备节点pca9555,但这个芯片是挂接在i2c-8上面的,应用程序打开open文件时,我是用pca9555这个节点,还是用i2c-8这个节点,如下图:
4S(PH~13~%@NZ$(N53KA9E0
当在应用层,打开i2c-8节点,则读写数据出现使用了空指针,但查询程序,没有使用空指针:


当在应用层,打开pca9555这个节点,则读写数据出现如下错误提示:
}O1O2(E6%BM%TNXUWP~1

我想问的是应用程序打开设备文件时,到底用哪个设备节点,是用pca9555还是I2C-8,又为啥出现上述截图那样的错误提示?

hello 3242096136,

please you trace the code to understand why there’s NULL access in pca9555_write_regs()

你好,我使用的是i2c-dev.c和i2c-core.c里面的驱动,按道理是不会出现空指针的问题,但是执行读写的时候,就是出现空执行的问题,而且这个问题好像有时候不会出现,有时候就出现。

[quote=“3242096136, post:13, topic:238203, full:true”]

你好,我有个同样的问题,就是摄像头芯片的IIC接在英伟达模块的213脚和215脚(CAM_I2C_SCL,CAM_I2C_SDA),这两个脚对应的TRM(?),在设备树中描述的对应DTS/Dev(?)是IC?,以及基地址是多少?


下图是规格书上的IIC基地址:

you may check pinmux spreadsheets for the pin mappings.