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.

LAUNCHXL-CC1312R1: I2C_Transfer( ) function call cause system halt

Part Number: LAUNCHXL-CC1312R1
Other Parts Discussed in Thread: CC1312R

Hello,

- CCS version : 10.1.0.00010

- SDK : SimpleLink CC13X2 SDK 4.20.00.35

- Example Source : CC1312R LaunchPad / TI 15.4-Stack / sensor

Whole source code attached in this post.

When I call I2C_Transfer( ), whole system halted with "Main_assertHandler:assertReason = 4"

which observed by Debug session.

sensor_CC1312R1_LAUNCHXL_tirtos_ccs.zip

Most of code changes are done to Main.c

Could you check my code and explain why this is happening?

Regards,

Jay

 

  • Jay,

    in ti_drivers_config.h you set the I2C max bitrate to 100kHz

    /* max speed unspecified, defaulting to 100 Kbps */
    #define CONFIG_I2C_GYRO_MAXSPEED   (100U) /* Kbps */
    #define CONFIG_I2C_GYRO_MAXBITRATE ((I2C_BitRate)I2C_100kHz)

    but in main.c you set the i2cParams.bitrate to 400kHz

        I2C_init();
        I2C_Params_init(&i2cParams);
        i2cParams.bitRate = I2C_400kHz;
        i2cParams.transferMode = I2C_MODE_BLOCKING;
    

    Can you try to align the I2C bit rate and try again?

    Regards,

    Daniel

  • Hellio Daniel,

    I2C_init();
    I2C_Params_init(&i2cParams);
    i2cParams.bitRate = I2C_100kHz;
    i2cParams.transferMode = I2C_MODE_BLOCKING;

    Modify Main.c but result is same.

    Regards,

    Jay

  • Jay,

    Sorry I missed this the first time I looked at your code. The issue is you are calling the i2c_transfer() functions before you call bios_start().

    All TI Driver functions need to be called after you call bios_start() since they rely on hwi, swi, and systick. You are getting hwi asserts because you haven't enabled hardware interrupts yet.

    Regards,

    Daniel

  • Hello, Daniel

    Thanks a lot. I had moved my I2C codes to custom made task and system now seems working.

    - I2C initialize : successful.

    - I2C transfer(TX) : I still got I2C transaction failed message but anyway I can observe I2C TX signal by oscilloscope

    if(I2C_transfer(i2c, &i2cTransaction)) {
       Display_printf(display, 0, 0, "I2C transaction success");
    }
    else {
       Display_printf(display, 0, 0, "I2C transaction failed"); // ???
    }

    Regards,

    Jay