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.

AM335x: How to add I2C2 initialization in U-boot

Other Parts Discussed in Thread: AM3357

I want to add I2C2 to uboot and  test the i2C2 in uboot level. how to add i2c mux configuration in uboot.

  • What processor are you using, and which SDK version?
  • processor:am3357
    sdk:8.0

    i want to add i2c2 in uboot mux configuration how to
  • Hi,

    You should:

    - add static struct module_pin_mux i2c2_pin_mux[] in board/ti/am335x/mux.c

    - in boar/ti/am335x/mux.c  add:

      void enable_i2c2_pin_mux(void)

     {

              configure_module_pin_mux(i2c2_pin_mux);

      }

    - call configure_module_pin_mux(i2c2_pin_mux) again in board/ti/am335x/mux.c

    - in const struct dpll_params *get_dpll_ddr_params(void) in board/ti/am335x/board.c add:  

       enable_i2c2_pin_mux();

       i2c_init(<i2c2 speed>, <i2c2 slave>);   

    In include/configs/ti_armv7_common.h, add i2c2 slave & i2c2 speed (used above):   

     #define CONFIG_SYS_OMAP24_I2C_SPEED 100000
     #define CONFIG_SYS_OMAP24_I2C_SLAVE1 2

    This should enable your i2c2 controller. 

    Best Regards, 
    Yordan

  • Dear Yordon,

    thanks for u r reply,,,,,,,,,,

    i have struck with another error after booting my custom board i entered the usb command like   "lsusb" it showing the below error..........

    "unable to initialize libusb: -99"

    i am attaching my log information.........

    my_log.c

  • Hi, I don't understand how this function tell that we need to init the bus 2:

    i2c_init(<i2c2 speed>, <i2c2 slave>);   

     

     In this function it get the bus number with i2c_get_bus_num() but to define a bus number, you have to call before i2c_set_bus_num(unsigned int bus).

     

    what is slaveAddr ? the address of a device ?

     

     I'm trying to use I2C2 instead of I2C0 ... but it doesn't work.

    I've put some trace in the function i2c_get_adapter and it's always index 0. So I'm assuming that it's I2C0 that it is used.