I2C写入错误,i2c_master_send返回-121

时间:2018-08-02 06:04:24

标签: beagleboneblack i2c touchscreen

  

[15995.562117] tsc2013 1-0048:tsc2013_i2c_write_register:I2C写错误,i2c_master_send返回-121

是什么原因造成的?

  • bbb img是:bone-debian-9.4-lxqt-armhf-2018-06-17-4gb.img
  • 从站地址为:i2c-1中的0x48

__

debian@beaglebone:/sys/bus/i2c/devices$ ls -l
total 0
lrwxrwxrwx 1 root root 0 Aug  2 05:51 0-0024 -> ../../../devices/platform/ocp/44e0b000.i2c/i2c-0/0-0024
lrwxrwxrwx 1 root root 0 Aug  2 05:51 0-0050 -> ../../../devices/platform/ocp/44e0b000.i2c/i2c-0/0-0050
lrwxrwxrwx 1 root root 0 Aug  2 05:51 1-0048 -> ../../../devices/platform/ocp/4802a000.i2c/i2c-1/1-0048
lrwxrwxrwx 1 root root 0 Aug  2 05:51 2-0054 -> ../../../devices/platform/ocp/4819c000.i2c/i2c-2/2-0054
lrwxrwxrwx 1 root root 0 Aug  2 05:51 2-0055 -> ../../../devices/platform/ocp/4819c000.i2c/i2c-2/2-0055
lrwxrwxrwx 1 root root 0 Aug  2 05:51 2-0056 -> ../../../devices/platform/ocp/4819c000.i2c/i2c-2/2-0056
lrwxrwxrwx 1 root root 0 Aug  2 05:51 2-0057 -> ../../../devices/platform/ocp/4819c000.i2c/i2c-2/2-0057
lrwxrwxrwx 1 root root 0 Aug  2 05:51 i2c-0 -> ../../../devices/platform/ocp/44e0b000.i2c/i2c-0
lrwxrwxrwx 1 root root 0 Aug  2 05:51 i2c-1 -> ../../../devices/platform/ocp/4802a000.i2c/i2c-1
lrwxrwxrwx 1 root root 0 Aug  2 05:51 i2c-2 -> ../../../devices/platform/ocp/4819c000.i2c/i2c-2

debian@beaglebone:~$ uname -r
4.14.49-ti-r54

debian@beaglebone:~$ sudo insmod tsc2013.ko
[15995.562117] tsc2013 1-0048: tsc2013_i2c_write_register : I2C write error, i2c_master_send returned -121
[15995.586612] tsc2013 1-0048: tsc2013_i2c_write_register : I2C write error, i2c_master_send returned -121
[15995.604143] tsc2013 1-0048: tsc2013_i2c_write_register : I2C write error, i2c_master_send returned -121
[15995.617237] tsc2013 1-0048: tsc2013_i2c_write_byte : I2C write error, i2c_master_send returned -121


debian@beaglebone:~$ dmesg
[ 5071.263231] -->tsc2013_init
[ 5071.263247] tsc2013_init-->i2c_add_driver
[ 5071.263525] -->tsc2013_probe
[ 5071.263559] tsc2013_probe-->tsc2013_hw_init
[ 5071.263565] -->tsc2013_hw_init
[ 5071.263583] after gpio_request
[ 5071.263589] after gpio_direction_input
[ 5071.263687] after gpio_to_irq
[ 5071.263786] tsc2013_probe-->tsc2013_sw_init
[ 5071.263791] -->tsc2013_reset
[ 5071.287503] tsc2013 1-0048: tsc2013_i2c_write_register : I2C write error, i2c_master_send returned -121
[ 5071.300364] tsc2013_i2c_write_register : CFG[62] = 0xa38c
[ 5071.300577] tsc2013 1-0048: tsc2013_i2c_write_register : I2C write error, i2c_master_send returned -121
[ 5071.314459] tsc2013_i2c_write_register : CFG[6a] = 0x0
[ 5071.314701] tsc2013 1-0048: tsc2013_i2c_write_register : I2C write error, i2c_master_send returned -121
[ 5071.328085] tsc2013_i2c_write_register : CFG[72] = 0x381c
[ 5071.328311] tsc2013 1-0048: tsc2013_i2c_write_byte : I2C write error, i2c_master_send returned -121
[ 5071.347228] input: tsc2013 as /devices/virtual/input/input3

debian@beaglebone:~$ ls /dev/input/
by-path  event0  event1  event2  event3

debian@beaglebone:~$ ls /dev/input/by-path/ -l
total 0
lrwxrwxrwx 1 root root 9 Aug  1 09:10 platform-44e0b000.i2c-platform-tps65217-pwrbutton-event -> ../event1
lrwxrwxrwx 1 root root 9 Aug  1 09:10 platform-gpio_keys-event -> ../event2
lrwxrwxrwx 1 root root 9 Aug  1 09:10 platform-TI-am335x-tsc-event -> ../event0

debian@beaglebone:~$ i2cdetect -y -r 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

i2c@4802a000 {
            compatible = "ti,omap4-i2c";
            #address-cells = <0x1>;
            #size-cells = <0x0>;
            ti,hwmods = "i2c2";
            reg = <0x4802a000 0x1000>;
            interrupts = <0x47>;
            //status = "disabled";
            status = "okay";
            phandle = <0xa9>;


            tsc2013@48 {
                compatible = "tsc2013";
                reg = <0x48>;
                //#address-cells = <0x1>;
                //#size-cells = <0x1>;
                //phandle = <0xab>;
            };
        };

debian@beaglebone:/sys/bus/i2c/drivers/tsc2013$ ls -l
total 0
lrwxrwxrwx 1 root root    0 Aug  2 05:22 1-0048 -> ../../../../devices/platform/ocp/4802a000.i2c/i2c-1/1-0048
--w------- 1 root root 4096 Aug  2 05:22 bind
lrwxrwxrwx 1 root root    0 Aug  2 05:22 module -> ../../../../module/tsc2013
--w------- 1 root root 4096 Aug  2 02:51 uevent
--w------- 1 root root 4096 Aug  2 05:22 unbind


debian@beaglebone:/sys/bus/i2c/devices/1-0048$ ls -l
total 0
lrwxrwxrwx 1 root root    0 Aug  2 05:23 driver -> ../../../../../../bus/i2c/drivers/tsc2013
-r--r--r-- 1 root root 4096 Aug  2 05:23 modalias
-r--r--r-- 1 root root 4096 Aug  2 05:23 name
lrwxrwxrwx 1 root root    0 Aug  2 05:23 of_node -> ../../../../../../firmware/devicetree/base/ocp/i2c@4802a000/tsc2013@48
drwxr-xr-x 2 root root    0 Aug  2 05:23 power
lrwxrwxrwx 1 root root    0 Jan  1  2000 subsystem -> ../../../../../../bus/i2c
-rw-r--r-- 1 root root 4096 Jan  1  2000 uevent

1 个答案:

答案 0 :(得分:0)

UU不是从站的地址。 UU表示内存中的空间已保留,您无法访问它。在此I2C检测示例中,i2c设备的地址为1d

enter image description here

要使设备可检测,必须正确连接SDA和SCL,并且必须启用i2c端口。使用sudo i2cdetect -l查看哪些i2c端口处于活动状态。您还应该在i2cdetect命令之前使用sudo

Please format all your code/terminal output to look like this in the future

希望有帮助