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/DRA829V: I2C Initialization sequence

Part Number: DRA829V

Tool/software: TI C/C++ Compiler

Hi,

we referring the code snippet of psdk_rtos_auto_j7_06_02_00_21 to access the i2c data.

do we need to follow any other sequence to access the I2C devices.?

we need to access the WKUP_I2C0 - Do we need to do any PIN configuration for this.?

Is there any register configuration is there to access the I2C lines ?

Code Snippet:

   uint16_t   index;

   I2C_Params i2cParams;

   I2C_HwAttrs i2cConfig;

#if ((defined(SOC_J721E)) && (defined (__aarch64__)))

    /* Enabling MCU I2C */

    enableI2C(CSL_MCU_I2C0_CFG_BASE);

#endif

    for(index = 0; index < I2C_HWIP_MAX_CNT; index++)

    {

        I2C_socGetInitCfg(index, &i2cConfig);

        i2cConfig.enableIntr = false;

        I2C_socSetInitCfg(index, &i2cConfig);

    }

    /* Initializes the I2C */

    I2C_init();

    /* Initializes the I2C Parameters */

    I2C_Params_init(&i2cParams);

#if ((defined(SOC_AM65XX)) || (defined(SOC_J721E)))

    i2cParams.bitRate = I2C_400kHz;

#endif

    /* Configures the I2C instance with the passed parameters*/

    handle = I2C_open(I2C_INSTANCE, &i2cParams);

    if(handle == NULL)

    {

       AppUtils_Printf(APP_UTILS_PRINT_MSG_NORMAL,"\n I2C Open failed!\n");

    }

 

  • Hi,

    For WKUP_I2C0 pins, they are the default mux option after reset so you don't have to explicitly set them in pad config registers.

    The above sequence looks good.

    Regards,
    Stanley

  • Hi Stanley,

    Thanks for your response,

    We need some more information about I2C Instance,

    For Example,

    In MCU Domain I2C, 3 devices are connected, PMIC,IO Expander, IMU Chip,

    How the instance will vary based one slave devices?

    we started using below API to access I2C Devices, is that fine to use ?

    Board_getI2CHandle(BOARD_SOC_DOMAIN_WKUP,
    BOARD_I2C_PMIC_INSTANCE);

    Board_getI2CHandle()

    Board_i2c8BitRegRd()

  • Hi Muthu,

    If there is any further discussion needed, let's continue in private forum.

    Regards,
    Stanley