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.

led blinking

Other Parts Discussed in Thread: PCF8575

hi

I am presently working on 816x/389x spectral digital board from ti . I want to blink the led through sysfs enteries  but i am unable to do it. i went through the schematic diagram and i found that the led are interface to P4,P5,P6 AND P7 PIN of PCF8575 I/O EXpander. The PCF8575 is intern interface with the MSP430 through i2c.

My doubt is whether i have to program the MSP430 for blinking the led or not . if the MSP430 is required to program than Please suggest me the way to do so

please help me out

  • vineet kumar,

    You can blink the LED using the the i2c commands. The LEDs are connected using the PCF8575 I/O Expander. The I2C address of the IO Expander is 0x20 on the TI81XX EVM.

    Please try the following command to test the LEDs

    # i2cset 1 0x20 0x0 0xff     

    Please check the schematic for more detailed connection details

    Regards,

    -Deepu Raj-          | Verify the Answer | if this post solved your issue 

  • Hi Deepu Raj

    i2cset 1 0x20 0x0 0xff

    would u please tell me more about this instruction and also where do i find all the related instruction so that i can check all the peripheral present on board.

  • vineet kumar,

    The above command is used for writing a value to a particular I2C client address. The parameter details can be find by entering the "i2cset" command.

    Example

    # i2cset
    Usage: i2cset [-f] [-y] [-m MASK] I2CBUS CHIP-ADDRESS DATA-ADDRESS [VALUE] [MODE]
      I2CBUS is an integer or an I2C bus name
      ADDRESS is an integer (0x03 - 0x77)
      MODE is one of:
        c (byte, no value)
        b (byte data, default)
        w (word data)
        Append p for SMBus PEC

    The "examples" folder  present under the PSP release  source code can be used for testing different modules.

    -Deepu Raj-
    ------------------------------------------------------------------------------------------------------
    Please click the Verify Answer button on this post if it answers the question.
    ------------------------------------------------------------------------------------------------------

  • Hi Deepu Raj

    i have tried the above instruction and it is working fine for me . thanks for that . while executing instruction i can make out that we are doing or writing on /dev/i2c-1 file.

    so i thought of opening this file through an user space application and program the led for blinking after regular interval. i am able to open the file without any error but I am

    stuck in the next step i.e how to write to the pcf8575 through the application .

    Please help me out

  • Vineeth Kumar,

    You can use the linux user sapce i2c api for archiving the same.

    Please find the bellow sample code snippet  for the same

    #include<stdio.h>
    #include <fcntl.h>
    #include "i2c-dev.h"

    #define ADDRESS 0x20
    #define I2C_DEV "/dev/i2c-1"

    int main(){

            int fd;
            fd = open( I2C_DEV, O_RDWR );

            if( ioctl( fd, I2C_SLAVE, ADDRESS ) < 0 )
            {
                    fprintf( stderr, "Failed to set slave address: %m\n" );
                    return 2;
            }

            /* Try some i2c write */
            if(i2c_smbus_write_word_data(fd,0x0,0xff) < 0 )
                    fprintf( stderr, "Failed to write to I2C device: %m\n" );

            printf(" I2C wite complere \n");

            return 0;
    }

    -Deepu Raj-
    ------------------------------------------------------------------------------------------------------
    Please click the Verify Answer button on this post if it answers the question.
    ------------------------------------------------------------------------------------------------------