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.

Linux/AM5749:pcf8574

Other Parts Discussed in Thread: PCF8574, PCF8575

Hello support,

I use am5749(custom board) ti-processor-sdk-linux-rt-am57xx-evm-06.03.00.106 and ti-processor-sdk-linux-am57xx-evm-06.03.00.106.

The problem is when the board is started my pcf8574 device pull up all 8 pins.Like I understood from datasheet it is normal but...actually it is not right.

I mean I use it for a control 8 relays and when the board is started but linux is not loaded the state of all the relay is 1. It is can damage something....

The main question is: Is it possible to reconfigure pcf8574 very fast, from u-boot or spl?

I need to send 0x00 to the address of my pcf8574.

BR,

Oleg

  • Oleg,

    If i search on the u-boot directory there is no driver support for pcf8574. pcf8575 which is a 16 Line IP has support.
    That said if the intent is to check the status of lines you can refer:

    board/freescale/mpc8315erdb/mpc8315erdb.c

    static u8 read_board_info(void)
    {
            u8 val8;
            i2c_set_bus_num(0);
    
            if (i2c_read(CONFIG_SYS_I2C_PCF8574A_ADDR, 0, 0, &val8, 1) == 0)
                    return val8;
            else
                    return 0;
    }
    
    i2c_set_bus_num(0); Here you set the bus number on which you have the pcf module.

    if (i2c_read(CONFIG_SYS_I2C_PCF8574A_ADDR, 0, 0, &val8, 1) == 0)

    CONFIG_SYS_I2C_PCF8574A_ADDR is 0x27 on your board right?


    Can you add that function under board/ti/am57xx/board.c in the u-boot folder and see if you can read the values using i2c_read like how the above is done?

    There is no driver support for this even in the latest u-boot. So the above might be the way forward.

    Best Regards,
    Keerthy

    Best Regards,
    Keerthy

     
  • Hi Keerthy,

    Very good Example THX.

    But...I need a write not read...I know the state (after power on it is 0xFF). Like you understood that is mean all 8 ports in state 1.

    And something else...I am not sure about U-boot. I mean it is too late...It should be somewhere earlier then u-boot I think....

    But any way I can't compile it. Where is located function prototype read_board_info(); ??? Which header?

    Look at the console:

    board/ti/am57xx/built-in.o: In function `read_board_info':
    /media/scaletto/Secondary/u-boot-2019.01+gitAUTOINC+333c3e72d3-g333c3e72d3/board/ti/am57xx/board.c:866: undefined reference to `i2c_set_bus_num'
    /media/scaletto/Secondary/u-boot-2019.01+gitAUTOINC+333c3e72d3-g333c3e72d3/board/ti/am57xx/board.c:868: undefined reference to `i2c_read'
    Makefile:1501: recipe for target 'u-boot' failed
    make: *** [u-boot] Error 1

    BR,

    Oleg