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.

Compiler: TCA6418E: GPIO output high or low

Other Parts Discussed in Thread: TCA6418E

Tool/software: TI C/C++ Compiler

HI Ti team 

My project need to control LED and here is the setting . Please kindly help me to review.

Project information:

I2C bus : 0

LEDSH0      ==> GPIO 0 (TCA6418E)

LED_SHL1  ==> GPIO 1 (TCA6418E)

ps : #./i2cset -y <bus> <device> <register> <value>

My Setting is here

LED_SHL0
==> 1
i2cset -y 0 0x68 0x23 0x80
i2cset -y 0 0x68 0x17 0x80

==> 0
i2cset -y 0 0x68 0x23 0x80
i2cset -y 0 0x68 0x17 0x00

================================
LED_SHL1
==> 1
i2cset -y 0 0x68 0x23 0x40
i2cset -y 0 0x68 0x17 0x40

==> 1
i2cset -y 0 0x68 0x23 0x40
i2cset -y 0 0x68 0x17 0x00

Can you help me to check this setting ?

thank you

table 3: LED is output so the address is 0x68

  • Hi Tseng,

    Typically with LEDs you would drive the line low to turn them on which I see you doing with your ==>0 scheme.

    To turn LEDs off, instead of setting the output HIGH, you should probably set the pin to be an INPUT instead. This is because, the VoH of the device and the LED's Vcc can differ. If they are the same, it wouldn't matter but usually people choose higher Vcc on Leds and choose to use an open drain configuration to drive them (instead of push pull like you are trying to do.)

    LED_SHL0
    ==> 1
    i2cset -y 0 0x68 0x23 0x00  //this would turn the GPIO HI-Z and turn off the LED
    i2cset -y 0 0x68 0x17 0x80


    Please also note that the device has an internal pull down resistor enabled when powered on every power up. You may want to disable this. (Register 0x2C-0x2E)

    Thanks,

    -Bobby

  • Hi Bobby
    thank your mail but I thing that I shall clear my question again.

    HI Ti team

    My project need to control LED High(ON) and Low(OFF)  and here is the setting . Please kindly help me to review.

    Project information:

    I2C bus : 0

    device : 0x68

    LEDSH0 (My Project's LED name)     ==> GPIO 0 (mapping to TCA6418E)

    ps : #./i2cset -y <bus> <device> <register> <value>

    My Setting is here:

    LED_SHL0   (My Project's LED name)  ==> GPIO 0 (mapping to TCA6418E)
    ==> High(ON)

    i2cset -y 0 0x68 0x2C 0x80   [pulldown disable ]
    i2cset -y 0 0x68 0x23 0x80   [output]
    i2cset -y 0 0x68 0x17 0x80   [dateout]

    ==> Low(OFF)
    i2cset -y 0 0x68 0x23 0x00  //  [input]   this would turn the GPIO HI-Z and turn off the LED

    Please help me to review my setting ... thank you very much

    ps : This is my first time to use this solution ..thank you

  • Tseng Hung said:

    Hi Bobby
    thank your mail but I thing that I shall clear my question again.

    HI Ti team

    My project need to control LED High(ON) and Low(OFF)  and here is the setting . Please kindly help me to review.

    Project information:

    I2C bus : 0

    device : 0x68

    LEDSH0 (My Project's LED name)     ==> GPIO 0 (mapping to TCA6418E)

    ps : #./i2cset -y <bus> <device> <register> <value>

    My Setting is here:

    LED_SHL0   (My Project's LED name)  ==> GPIO 0 (mapping to TCA6418E)
    ==> High(ON)

    i2cset -y 0 0x68 0x2C 0x80   [pulldown disable ]
    i2cset -y 0 0x68 0x23 0x80   [output]
    i2cset -y 0 0x68 0x17 0x80   [dateout] //this turns it off since it sets the output HIGH, the last Byte to be 0x00h: i2cset -y 0 0x68 0x17 0x00

    ==> Low(OFF)
    i2cset -y 0 0x68 0x23 0x00  //  [input]   this would turn the GPIO HI-Z and turn off the LED

    Please help me to review my setting ... thank you very much

    ps : This is my first time to use this solution ..thank you

    Your ==> High(ON) needs to be modified if you want the LED on. I would also swap the step2 and step 3 but what you have technically would work if you make the change I commented.

    Thanks,

    -Bobby

  • Hi Bobby
    thank your mail 
    Here is the correct setting .....I think that it will be worded OK.
    thank you

    LED(ON)
    i2cset -y 0 0x68 0x2C 0x80   [pulldown disable ]
    i2cset -y 0 0x68 0x23 0x80   [output]
    i2cset -y 0 0x68 0x17 0x00   [dateout]

    LED(OFF)
    i2cset -y 0 0x68 0x23 0x00  //  [input]   this would turn the GPIO HI-Z and turn off the LED

  • Hi Tseng,

    This looks correct.

    My only minor edit would be here:

    LED(ON)
    i2cset -y 0 0x68 0x2C 0x80   [pulldown disable ]

    //Set the output state first
    i2cset -y 0 0x68 0x17 0x00   [dateout]

    //configure the pin to be an output now
    i2cset -y 0 0x68 0x23 0x80   [output]

    Even if you don't make the minor change, this would still work.

    -Bobby

  • thank you very much