I2C write failed at validate event

Hello everyone,
I'm working on RA6M5 MCU for I2C master. I try to read data from Sensirion's temperature sensor SHTC3.

I checked the I2C code and make sure:
The PIN definitions(P400/P401) are correct.
The sensor's I2C address(0x70) is correct.
The initialization is also correct.

Here are the commands for SHTC3:
static uint16_t mI2cCommand = 0x7866;
static uint16_t mSleepCommand = 0xb098;
static uint16_t mWakeUpCommand = 0x3517;

When I send command to wake up, it always fails at validate_i2c_event():
// write full buffer
err = R_IIC_MASTER_Write(&g_i2c_master0_ctrl, fullBuff, bytesWritten, false);
// handle error
if (FSP_SUCCESS != err)
tsPrintf("** I2CWriteAddrEx: R_IIC_MASTER_Write API failed **\r\n");
gI2c.err = I2C_ERR_NO_ACK;
return 0;

err = validate_i2c_event(); // <<<<==== Failed at this line

Here is the validate_i2c_event():
static fsp_err_t validate_i2c_event(void)
uint16_t local_time_out = UINT16_MAX;

/* resetting call back event capture variable */
i2c_event = (i2c_master_event_t)RESET_VALUE;

/* This is to avoid infinite loop */

if(RESET_VALUE == local_time_out)

}while(i2c_event == RESET_VALUE);

if(i2c_event != I2C_MASTER_EVENT_ABORTED)
i2c_event = (i2c_master_event_t)RESET_VALUE; // Make sure this is always Reset before return

i2c_event = (i2c_master_event_t)RESET_VALUE; // Make sure this is always Reset before return

What could cause this validate event failure? I run out of ideas.


Parents Reply Children
No Data