RA2E1 R_IIC_MASTER_Open() Error

Hi,

I'm trying to establish I2C communication using RA2E1.

In RA2E1, there's two communcation blocks existing in RA2E1 which are r_sci_i2c and  r_iic_master.

The program stops after R_IIC_MASTER_Open() function is called. the same situation is happened when  R_SCI_I2C_Open() function is also called and  these situations are both  happening on e2studio and IAR. I couldn't find a way to operate I2C

Figure 1. Smart Configurator I2C Config

Figure 2. Code

Figure 3. Error

I'll be appreciated if you illuminate me.

Thanks.

Parents
  • Have you looked at the example projects?  You could try looking at those projects for an idea.

    Also, check the return code of the API calls.  This will help identify the issue.

    for example:

    fsp_err_t err;

    err = R_IIC_MASTER_Open(&g_i2c_master_ctrl, &g_i2c_master_cfg); 

    if (FSP_SUCCESS != err)
    {
        __BKPT(1); // error - investigate why
    }

    err = R_IIC_MASTER_Write(&g_i2c_master_ctrl, measure_enable_payload, TWO_BYTE, false);
    if (FSP_SUCCESS == err)
    {
        err = validate_i2c_event();
        /* handle error */
        if (FSP_SUCCESS != err)
       {
            __BKPT(1); // error - investigate why
       }

    }
    /* handle error */
    else
    {

       {
            __BKPT(1); // error - investigate why
       }
    }

  • Hi,

    Thanks for replying my question.

    I've checked the return code of API of R_IIC_MASTER_Open() function. it returns FSP_SUCCESS but the problem is after R_IIC_MASTER_Open()  API is called, the program stops working and drops into Default_Handler() function as in Figure 3.

  • Hi hurkanhokelek-

    Have you looked at the stack call sequence to see where the error is coming from?

  • Hi,

    Sorry for late reply.

    I solved the problem by adding R_IIC_MASTER_Close() function after the reading or writing process of I2C is completed. Without adding R_IIC_MASTER_Close() function, the program drops Default_Handler() function as in Figure 3.

    Thanks.

Reply Children
No Data