J784S4XEVM: I2C in vision_apps

Part Number: J784S4XEVM

Tool/software:

Hello TI,

After writing simple bare metal app for reading temperature sensor values over I2C (csl example), I tried using the same code in vision app but I get error "core aborted" on I2C_open function call.

I'm calling I2C_open from our custom app which is similar to app_c7x_kernel app except that we use our custom kernel for r5f on MCU2_0.
We are using Linux + RTOS SDK version v10 on J784S4 EVM board.

vx_status VX_CALLBACK app_r5f_target_kernel_bringup_create(tivx_target_kernel_instance kernel, tivx_obj_desc_t *param_obj_desc[], uint16_t num_params, void *priv_arg)
{
    printf("\n%s -13- %d\n", __FUNCTION__, __LINE__);

    I2C_Params i2c_params;
    I2C_Params_init(&i2c_params);
    i2c_params.bitRate = I2C_400kHz; /* 400KHz */

    // Open the I2C instance (instance 0)
    if (i2c_handle == NULL)
    {
        i2c_handle = I2C_open(BOARD_TEMP_SENSOR_I2C_INSTANCE, &i2c_params);
        printf("\n%s %d i2c_handle = %p\n", __FUNCTION__, __LINE__, i2c_handle);
    }
    
    return VX_SUCCESS;
}


What am I missing here?

Best Regards,

Milos

  • Hi Milos,

    Here are a few queries to understand your issue:

    - Can you tell us what line in I2C_Open is getting into "core aborted"? 
    - What core are you using to run your I2C code? Is it on R5F - Main MCU2_0?
    - Which instance of I2C is used? Have you "turned on" the clock and the specific I2C instance?

    Thanks.

  • Hi Praveen,

    - I traced the code execution to the beginning of I2C_open_v1 function, but didn't go further because it seemed that I'm doing something basic wrong and that the problem likely isn't in I2C API itself but in the way I use it.

    - Yes, I'm using Main MCU2_0 core.

    - I'm trying to use BOARD_TEMP_SENSOR_I2C_INSTANCE (instance 0). From what I saw in other vision app (app_dss_soc.c), there I2C_open is called without any prior clock enable procedure.

  • I traced the code execution to the beginning of I2C_open_v1 function, but didn't go further because it seemed that I'm doing something basic wrong and that the problem likely isn't in I2C API itself but in the way I use it.

    Suggest checking at what point you see the crash so we can help you further. Please ensure you have enabled the clock and the I2C device before you call I2C_open. Also, ensure that Linux running on A72 does not use this I2C instance since it may conflict with mcu2_0 usage of this. 

    - I'm trying to use BOARD_TEMP_SENSOR_I2C_INSTANCE (instance 0). From what I saw in other vision app (app_dss_soc.c), there I2C_open is called without any prior clock enable procedure.

    Can you tell us what code is being referred to here? 

    Thanks.