I2C4 添加设备 读写失败
参考wiki 在I2C4 上添加了个设备,dts 配置如下,i2c_add_driver返回值也是0,;开机后,用i2cdetect -y 4,检测出0x36位置显示"UU";但是执行读写操作时,返回-6,(No such device or address );求大神
&i2c4 {
status = "okay";
dlpc34@36 {
compatible = "dlpc34";
//gpio-sw = <&gpio7 GPIO_D3 GPIO_ACTIVE_LOW>;
reg = <0x36>;
};
};
代码:
static const struct i2c_device_id dlpc34_id[] = {
{ "dlpc34", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, dlpc34_id);
static const struct of_device_id dlpc34_of_match[] = {
{ .compatible = "dlpc34" },
{}
};
static struct i2c_driver dlpc34_driver = {
.driver = {
.name = "dlpc34",
.owner = THIS_MODULE,
.of_match_table = of_match_ptr(dlpc34_of_match),
},
.probe = dlpc34_probe,
.remove = dlpc34_remove,
.id_table = dlpc34_id,
};
module_i2c_driver(dlpc34_driver);
另外,检测SCL SDA是有信号的,芯片资料,是低速设备,我scl_rate设置的50*1000;
I 2 C interface ports support 100-kHz baud rate. By definition, I 2 C transactions operate at the
speed of the slowest device on the bus, thus there is no requirement to match the speed grade of all devices in
the system. 结贴,原因:芯片读操作和标准的有差异!文档没看仔细;按照标准linux读写出现错误!
页:
[1]