ESP32 Arduino Wire Library problem

afonsus1997
Posts: 1
Joined: Tue Jun 02, 2020 7:33 pm

ESP32 Arduino Wire Library problem

Postby afonsus1997 » Tue Jun 02, 2020 7:38 pm

Hello,

I’ve been building a project using PlatformIO and the ESP32 on a custom board.
I’m interfacing an LED matrix using a matrix driver that communicates over I2C. The issue that I am facing is that for some reason there is a big delay between consecutive I2C transfers (write only) that is causing very poor refresh rate. This using the Wire library.

This is how I’m sending the data:

I am filling 2 buffers with data

Code: Select all

uint8_t i2cAddrbuffer[1054];
uint8_t i2cCMDbuffer[1054];
int tail = 0;
for(int y = 0; y<9; y++){

	for(int x = 0; x<39; x++){
		i2cAddrbuffer[tail] = 0xFE;
		i2cCMDbuffer[tail++] = 0xC5;

		i2cAddrbuffer[tail] = 0xFD;
		i2cCMDbuffer[tail++] = IS31FL3741addrmap[y][x][1];

		i2cAddrbuffer[tail] = IS31FL3741addrmap[y][x][0];
		i2cCMDbuffer[tail++] = 0x3;
	}
	
}
And then sending the data over to the I2C bus using the wire library:

Code: Select all

for(int i = 0; i<tail; i++)
	I2CWriteByte(addr, i2cAddrbuffer[i], i2cCMDbuffer[i]);
tail=0;
I’ve hooked up my scope and captured some screenshots to made it easier to show what’s happening:

Image

Is this an inherent problem with the Wire library? Should I use the original ESP I2C library?
I thought that this could be an issue that could be caused by task switching from FreeRTOS (I’m running this code on the Setup function) but lowering the freertos scheduler frequency didnt help.

Thanks in advance!

Who is online

Users browsing this forum: No registered users and 77 guests