[FAQ] PROCESSOR-SDK-AM64X: Not able to open I2C drivers for MCU I2C

Part Number: PROCESSOR-SDK-AM64X

Tool/software:

I am using the MCU_I2C instance from M4F core on AM64x device. I am not able to initialize the MCU_I2C instance and it always fails to open.

I am using SDK v10.0. Please guide us with steps to fix the same.

  • The I2C driver seems to be broken after the release of SDK v10.0 to SDK v11.0.

    The I2C_lld_isBaseAddrValid() API is returning failure status because the MCU_I2C addresses are not checked. Please replace the I2C_lld_isBaseAddrValid function code with below provided code. The I2C_lld_isBaseAddrValid is located at ${MCU+SDK}/source/drivers/soc/am64x_am243x/soc.h file.

    static inline int32_t I2C_lld_isBaseAddrValid(uint32_t baseAddr)
    {
        /* Set status to invalid Param */
        int32_t status = (int32_t)(-3);
    
        if (    (baseAddr == CSL_I2C0_CFG_BASE) ||  \
                (baseAddr == CSL_I2C1_CFG_BASE) ||  \
                (baseAddr == CSL_I2C2_CFG_BASE) ||  \
                (baseAddr == CSL_I2C3_CFG_BASE) ||  \
                (baseAddr == (uint32_t)AddrTranslateP_getLocalAddr(CSL_MCU_I2C0_CFG_BASE)) ||  \
                (baseAddr == (uint32_t)AddrTranslateP_getLocalAddr(CSL_MCU_I2C1_CFG_BASE)) )
        {
            /* Set status to success */
            status = 0;
        }
    
        return status;
    }

    Also include the AddrTranslateP.h file in the soc.h file.

    Also replace the code in I2C_open function as described in below image. 

    in I2C_open function found at ${MCU+SDK}/source/drivers/i2c/v0/i2c_v0.c file.

    After doing the above mentioned changes please rebuild the libraries and rebuild the example project.
    gmake -s libs PROFILE={release|debug} clean
    gmake -s libs PROFILE={release|debug}

    You will now be able to run the example.