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.

beagle board (AM335x processor) I2C module communication with i2c port expander (TCA6416)

Other Parts Discussed in Thread: TCA6416, AM3517

hello all,

i'm a beginner, i using beaglebone Rev A3 (AM 335x proxessor)  with arago image, how do i using the onboard I2C-1 module communicate with i2c port expander (TCA6416) ? how to memory map I2C registers ,configuring the I2C registers, send and read data by using c programming in ubuntu ?

Thanks in advance.

Choon

  • Hi,

    Add

    {i2c1_init,     DEV_ON_BASEBOARD, PROFILE_NONE},

    In

    arch/arm/mach-omap2/board-am335xevm.c

    /* Beaglebone Rev A3 and after */
    static struct evm_dev_cfg beaglebone_dev_cfg[] = {

    and give the am335x_i2c_boardinfo1 properly. and you may want to check the pinmuxing also in

    static struct pinmux_config i2c1_pin_mux[] = {

    And from user level you can use i2c-tools or ayou can write a simple program for writing and reading the registers.






  • Hi,

    Thanks for reply.

    i've read some document, i2c speed mode have 100kps, 400kps. Do i need to select the speed mode? if yes, what should i do in coding?

    Thanks.

  • Please Go through this document. you can get some hints

    http://www.jumpnowtek.com/index.php?option=com_content&view=article&id=69&Itemid=78

  • Hi,

    after done what you had ask me to do, the i2c-2 character device is created. now i can use the i2c-tools sucessfully,

    example: i2cset 2 0x20 0x02 0xFF with no error come out. i use a led as a indicator. i probe the SCL1 and SDA1 can get the signal low and high. but seem like the data did not reach the output port of i2c port expander and the led not on.

    in arch/arm/mach-omap2/board-am335xevm.c

    i change

    omap_register_i2c_bus(2, 100, NULL, 0);

    to

    omap_register_i2c_bus(2, 400, NULL, 0);

    because the TCA6416 i2c port expander required 400kHz.

    What i've miss?

  • No experience with your HW. Looking at the TCA6416 datasheet, this device defaults to all pins as inputs. Have you configured the pins as outputs? You could try the following as a test. First line should configure all pins as outputs. Subsequent lines should set the pins to 0, 1 then 0. Make sure that all of your pins are NOT tied high or low. Don't want a short to ground or VCC.

    i2cset 2 0x20 0x06 0x00 0x00
    i2cset 2 0x20 0x02 0x00 0x00
    i2cset 2 0x20 0x02 0xFF 0xFF
    i2cset 2 0x20 0x02 0x00 0x00

    Note that the AM3517 Crane board has code for the TCA6416. See board-am3517evm.c. Access to the TCA6416 is not through the i2c interface directly. The TCS6416 appears as more GPIOs via sysfs. Driver code in gpio-pca953x.c. More elegant, simpler to use yet more complex to configure.

    EDIT:. Oops. Forgot negation on output pins comment.