I2C issue on write(), transaction never complete

Hi, my name is Hendra and currently i am working with Renesas S5D5 and trying to activate the I2C.

 

At first let me explain about my environment. I am using:

- e2studio version 7.3.0

- SSP version 1.6.0

 

Driver configuration:

I am using SCI I2C channel 7 with pin 401 and 402 with setting as below:

 

Here is my code:

 

void i2c_thread_entry(void)

{
    uint8_t write[6] = {0,0,0,0,0,0};

    g_i2c_lcd.p_api->open(g_i2c_lcd.p_ctrl, g_i2c_lcd.p_cfg);

    while (1)

    {

        g_i2c_lcd.p_api->write(g_i2c_lcd.p_ctrl,write, 1, false);    <-- always fail here

        tx_thread_sleep (1);

    }

}

 

Issue:

Opening the driver is okay, but every time i execute write function always stuck in here:

this is from r_sci_i2c.c. what i know i am not using the callback so it will enter there, but i don't know why the transaction is never completed. i already check using oscilloscope but both SCL and SDA will never output signal. i am already adding pull up resistor on the bus.

also i am already trying to switch the SCI I2C to IIC but the result are the same.

 

please help. thank you...

  • Hi,

    Can you check the return values of the API calls? They may help you to determine what the problem is.

    Also, you are performing back to back writes without waiting for the previous write to complete. The write API call is non-blocking. I suggest you add a callback and set a software flag or post an RTOS semaphore when the write completes and wait for that flag/event.

    Regards,

    Ian.
  • In reply to Ian:

    Hi Ian, thank you for your response.

    So, for write function, I already tried to do it just once (not looping as my reference code). And also I already try to give it callback just to flag whether write function is done or not. But it may be not the cause. SCL and SDA pin still not give any output signal.

    Recently i found out that the problem is the interupt to writing the address to I2C is not working, so TEI interupt is also never called then my code will stuck in transaction uncomplete. I already checked for RXI, TXI, and TEI interupt is already enable before write the address to I2C. Everything seems normal until time for sending the address.

    May you have anything to check before writing the address? Thank you
  • In reply to Hendra:

    Hi,

    Check the return values from the API calls. It is possible the driver is not even opening.

    Regards,

    Ian.
  • In reply to Ian:

    Hi Ian,

    okay I already check for both function:
    g_i2c_lcd.p_api->open() >> returning SSP_SUCCESS
    g_i2c_lcd.p_api->write() >> never return because debugger is stuck on somewhere else

    Thank you
  • In reply to Hendra:

    Hi Hendra-
    Have you looked at the I2C example for the SK-S7G2 kit? Maybe it will give you some clues...
    www.renesas.com/.../D6003130.html

    Let us know if it helps at all...