Page 1 of 1

I2C latency

Posted: Fri Feb 16, 2018 6:24 pm
by Jstar88
Hi,

i'm using I2C in master mode(ESP32) to communicate with a single slave(LCD).
The SDK is the last one at this date.

I'm having some troubles with performance since commands are delayed each other by over 100us.
You can see the follow screenshots
Image
http://www.image-share.com/ipng-3693-170.html

Code: Select all

#define LCD_SCL_PIN GPIO_NUM_5
#define LCD_SDA_PIN GPIO_NUM_18

Code: Select all

bool Display_writeComIIC(Display* obj, int para)
{
	bool status = false;
	i2c_cmd_handle_t cmd = i2c_cmd_link_create();
	i2c_master_start(cmd);

	i2c_master_write_byte(cmd, (obj->address << 1) | I2C_MASTER_WRITE, true);
	i2c_master_write_byte(cmd, 0x20, true);
	i2c_master_write_byte(cmd, para, true);
	i2c_master_stop(cmd);
	if (i2c_master_cmd_begin(I2C_NUM_0, cmd, 1000 / portTICK_RATE_MS) == NO_ERROR)
	{
		i2c_cmd_link_delete(cmd);
		status = true;
	}
	else
	{
		i2c_cmd_link_delete(cmd);
	}
	return status;
}

Re: I2C latency

Posted: Sat Feb 17, 2018 6:09 pm
by Jstar88
Just solved keeping I2C open and sending a buffer of data!