This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

how to Interface tca6414 to beagleboard white

Other Parts Discussed in Thread: TCA6416, TCA6408A, TCA6416A

Dear all,

Am trying to integrate tca6416 i/o expander and i want to control LEDs through tca6414 i/os, am using 3.8 kernel and i have enabled tca6416 with gpio support as

device driver->GPIO support->

<*>   PCA953x, PCA955x, PCA957x, TCA64xx, and MAX7310 I/O ports                 
  │ │            [*]     Interrupt controller support for PCA953x   

and

device driver-> input device support -> keyboards

   <*>   TCA6416/TCA6408A Keypad Support

and i2cdetect works fine it seems

root@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: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --              

when i try to dump am getting these things

i2cdump 1 0x34
No size specified (using byte-data access)
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-1, address 0x34, mode byte
Continue? [Y/n] y
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
10: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
20: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
30: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
40: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
50: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
60: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
70: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
80: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
90: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
a0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
b0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
c0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
d0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
e0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
f0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX

can you provide me the solution what am missing here....

  • Am I understanding correctly, that you are able to receive an acknowledgment from TCA6416 over I2C but are not able to read from the registers in the TCA6416?

    I would also like to mention that the TCA6416 is not recommended for new designs TCA6416A is its replacement.

     

    Adam

  • Hai Adam ,

     Am not getting response from TCA6416, when i try to read device id

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

     It is not detecting any devices in i2c1.

  • Are there other I2C devices on the bus?  Are you able to communicate with them?  Do you have a schematic of your board with the master and slave devices on the I2C bus, how they TCA6416 is powered, etc.

     

    Adam  

  • Hi,

    I am having the same issue....

    Did you solve it ?

    Thanks,

    Ran

  • Is it required just to add it in kernel (and the i2cdetect issue should be ignore) ?
  • Hello Ran,

    Some devices may not respond to thei2cdetect command because most times, the i2c detect merely writes a read request to the bus.

    The TCA6416 will not respond/ACK to a read request without first being given the register to read from with a write request.

    If you can supply a write command to the TCA6416, then perform an i2cdetect, you should be able to see the TCA6416 show up on the bus.
  • Hi Jonathatan!

    Thank you very much for the response.

    I was not aware that i2cdetect have such flows and can "miss" some devices.

     I was lucky enough to get along with this issue, when though it seemed to me like a hw issue, I added the device driver and configuration, and now I can communicate with it.

    But I also learnt that we should not be too configdent with  i2cdetect results....

    If I understand you correctly, then a good practise when i2cdetect does not return "life signal" from a device, might be to try using i2cset and i2cget , and see if they return "life signal".

    Thanks,

    Ran

  • Hello Ran,

    That is correct. The I2C Detect uses a quicker/less reliable way to detect slaves. This approach is generally acceptable for most sensors since you typically do not write to any registers.

    Using an I2CSet and I2CGet will be more accurate for devices which have large number of registers, since most of these devices will not ACK on a read request until you have given them a register to read from (with a write command).

  • Thank you very much!
  • Hai Ran,
    I was having hardware issue, that's why i was not getting the slave in i2c detect. This is just to help you, if you still not able to find the slave

    copy this to arch/arm/boot/dts/am335x-bone-common.dtsi


    i2c2_pins: pinmux_i2c2_pins {
    pinctrl-single,pins = <
    0x178 0x73 /* uart1_ctsn.i2c2_sda, SLEWCTRL_SLOW | INPUT_PULLUP | MODE3 */
    0x17c 0x73 /* uart1_rtsn.i2c2_scl, SLEWCTRL_SLOW | INPUT_PULLUP | MODE3 */
    >;
    };


    &i2c2 {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&i2c2_pins>;
    clock-frequency = <100000>;

    tca6416: tca6416@20 {
    compatible = "ti,tca6416";
    gpio-controller; // for gpio expander
    reg = <0x20>;
    };

    Enable driver

    < * > PCA953x, PCA955x, TCA64xx, and MAX7310 I/O port

    once compiled, port it to you board, connect tca6416 to you board

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

    you will be getting "UU in 20"


    #cat /sys/kernel/debug/gpio
    GPIOs 0-31, gpio:
    gpio-6 (mmc_cd ) in lo
    gpio-12 (beaglebone:green:usr) out lo

    GPIOs 32-63, gpio:
    gpio-52 (eMMC_RSTn ) out lo
    gpio-53 (beaglebone:green:usr) out lo
    gpio-54 (beaglebone:green:usr) out lo
    gpio-55 (beaglebone:green:usr) out hi
    gpio-56 (beaglebone:green:usr) out lo
    gpio-59 (McASP Clock Enable P) out hi

    GPIOs 64-95, gpio:

    GPIOs 96-127, gpio:

    GPIOs 240-255, i2c/1-0020, tca6416, can sleep: