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.

TDA2P-ABZ: I2C4 not getting detected in Vision SDK

Part Number: TDA2P-ABZ

Hi All,

I am using PROCESSOR_SDK_VISION_03_07_00_00 with Linux on A15. I Have disabled i2c4 from the file dra76-evm-infoadas.dts by using the following:

#define DISABLE_COMPLETE(label) &label { status = "disabled"; ti,no-idle; ti,no-reset-on-init; }

DISABLE_COMPLETE(i2c4);

The pin mux I have done from uboot in mux_data.h

{GPMC_A0, (M7 | PIN_INPUT_PULLUP )}, /* gpmc_a0.i2c4.scl */
{GPMC_A1, (M7 | PIN_INPUT_PULLUP)}, /* gpmc_a1.i2c4.sda */

I know that I2C4 comes from the following pins:

i2c4_scl comes out on:

M1 --> gpmc_a0
D17 --> mcasp1_fsr
B25 --> mcasp4_fsx
v5 --> mmc1_sdwp

We are using M1 (gpmc_a0 and gpmc_a1) for I2C.

            I am not able to detect I2C4 on VSDK. I have done pinmuxing in VSDK too in the file bsp_boardTda2xx.c.

It looks as if i2c4 is disabled in VSDK . Can anyone please let me know how to enable I2C4 (BSP_DEVICE_I2C_INST_ID_3) in VSDK.

Thanks,

Deepika

  • Hi,

    You have to enable BSP_DEVICE_I2C_INST_ID_3 inside gBoardTda2xxI2cInstData[] under ~\ti_components\drivers\pdk\packages\ti\drv\vps\src\boards\src\bsp_boardTda2xx.c.

    You also need to make sure I2C4 module clock is enabled.

    Regards,
    Stanley

  • Hi Stanley,

    Can you please tell me from where we can enable the I2C4 clock. From TDA2PX TRM I2C4 clock is already enabled.

    Thanks,

    Deepika

  • Typically, it should be enabled by Linux already. 

    You can double check this by reading the below register. It should be 0x2.

  • Thanks Stanley.

    Right now my I2C is enabled from linux. 

    After running the i2cdetect on bus 4 I am getting a controller time out. Although devices are getting detected which means in muxing is correct. Can you please tell me why am I getting this controller time out.

    root@dra7xx-evm:/opt/vision_sdk# i2cdetect -r -y 3
    0 1 2 3 4 5 6 7 8 9 a b c d e f
    00: -- [ 57.905082] omap_i2c 4807a000.i2c: controller timed out
    -- -- [ 60.985037] omap_i2c 4807a000.i2c: controller timed out
    -- -- [ 64.064991] omap_i2c 4807a000.i2c: controller timed out
    -- -- [ 67.144989] omap_i2c 4807a000.i2c: controller timed out
    -- -- [ 70.225000] omap_i2c 4807a000.i2c: controller timed out
    -- -- [ 73.305100] omap_i2c 4807a000.i2c: controller timed out
    -- --
    10: [ 76.385018] omap_i2c 4807a000.i2c: controller timed out
    -- -- [ 79.464980] omap_i2c 4807a000.i2c: controller timed out
    -- -- [ 82.544996] omap_i2c 4807a000.i2c: controller timed out
    -- -- [ 85.624995] omap_i2c 4807a000.i2c: controller timed out
    -- -- [ 88.705111] omap_i2c 4807a000.i2c: controller timed out
    -- -- [ 91.785015] omap_i2c 4807a000.i2c: controller timed out
    -- -- [ 94.864833] omap_i2c 4807a000.i2c: controller timed out
    -- -- [ 97.944847] omap_i2c 4807a000.i2c: controller timed out
    -- --
    20: [ 101.024838] omap_i2c 4807a000.i2c: controller timed out
    -- -- [ 104.104839] omap_i2c 4807a000.i2c: controller timed out
    -- -- [ 107.174835] omap_i2c 4807a000.i2c: controller timed out
    -- -- [ 110.264835] omap_i2c 4807a000.i2c: controller timed out
    -- 27 -- [ 113.344850] omap_i2c 4807a000.i2c: controller timed out
    -- -- [ 116.424844] omap_i2c 4807a000.i2c: controller timed out
    -- -- [ 119.504840] omap_i2c 4807a000.i2c: controller timed out
    -- -- [ 122.574832] omap_i2c 4807a000.i2c: controller timed out

    Regards,

    Deepika

  • I2c4 is disabled from Linux so Linux can't access i2c4. i2c4 is reserved for M4 to use.

    #define DISABLE_COMPLETE(label) &label { status = "disabled"; ti,no-idle; ti,no-reset-on-init; }

    DISABLE_COMPLETE(i2c4);

  • Hi Stanley,

    I have enabled it from device tree right now to check the devices present.

    Thanks,

    Deepika

  • Ok. Please note that, for M4 to use it, it has to be disabled from Linux. Otherwise, the i2c interrupt will be routed to A15 as well.

  • Hi Stanley,

    Yes I had disabled it from device tree before adding it in vision SDK. 

    I will disable it again from Linux and add it in VSDK  and let you know.

    Thanks

    Deepika

  • Hi Stanley,

    On your suggestion I added the support in bsp_boardTda2xx.c.

    The device address is getting detected. But while writing the device i am getting  error:

    status = Bsp_deviceRead8(BSP_DEVICE_I2C_INST_ID_3,0x40,&i2cAddr,&regValue,1U);
    Vps_printf("****STATUS %x %x***%d\n",i2cAddr,regValue,status);

    The return value is coming as -19.

    From the file ti_components/drivers/pdk_01_10_03_07/packages/ti/drv/vps/include/common/bsp_types.h  i cannot identify the error code as its not mentioned in this file.

    Thanks,

    Deepika

  • Hi Deepika,

    I can't find any error code defined as -19.

    Can you put some prints to find out what function returns this error code?

    Or, do you have JTAG to step thru the code?

    Regards,
    Stanley

  • Hi Stanley,

    Sorry, JTAG I don't have. 

    Can you please tell me where to put prints.

    I have put it inside Bsp_deviceI2cProbeAll() . For I2C5 I can see logs various devices 

     I2C4: Passed for address 0x48 !

     I2C4: Passed for address 0x40 !

     I2C4: Passed for address 0x36 !

    But for I2C4 I cannot find any logs like the above although the device is getting probed.

    retVal1 = Bsp_deviceI2cProbeDevice(BSP_DEVICE_I2C_INST_ID_3,0x40

    The return value is coming as 0.

    Can you please suggest your inputs.

    Thanks

    Deepika 

  • Hi Deepika,

    Probe is not enabled for all instances by default.

    Only I2C5 is being probed on TDA2P by default because TDA2P EVM uses I2C5 for some devices.

    If you want to change that to I2C4, you can do that by changing it in gBoardTda2xxI2cData{}.

    Or, you can call Bsp_deviceI2cProbeAll(BSP_DEVICE_I2C_INST_ID_3).

    Regards,
    Stanley

  • Hi Stanley,

    I called the Bsp_deviceI2cProbeAll(BSP_DEVICE_I2C_INST_ID_3)  but its not showing any address.

    However Bsp_deviceI2cProbeDevice(BSP_DEVICE_I2C_INST_ID_3,0x40)  call is successful.

    I have already added BSP_DEVICE_I2C_INST_ID_3  in the  gBoardTda2xxI2cData{} in the file bsp_boardTda2xx.c

    Regards,

    Deepika

  • Are you running this on your custom board or TDA2P EVM?

  • Hi Stanley,

    I am running it on custom board.

    Thanks,

    Deepika

  • Hi 

    Any inputs from your side. I am still stuck.

    Thanks,

    Deepika

  • Hi,

    If Bsp_deviceI2cProbeDevice() works, why do you have to do ProbeAll()?

    Are you able to read/write the device via I2C4?

    If not, have you tried lowering the I2C bus speed to 100Khz?

    Regards,
    Stanley