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.
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.
So how did you implement this function? This doesn’t seem like a Wire call to me at all.
Do you have to make 351 individual one-byte I2C transfers or can you string it together in a large buffer if the chip has something like an auto-address-increase feature?
The Wire library seems to have some significant overhead in its drivers, looking at places like here and more importantly the I2C write functions and sub-calls like this, so 62 microseconds overhead between I2C transmissions doesn’t seem that absurd…
Even Wire.setClock(1000000); (docs) won’t help much if the inter-write times are so big. BTW your chip supports 1000 kHz fast-mode plus at p.6 – default Wire frequency is 100kHZ.
Also page 8 of the datasheet shows the "Writing to IS31FL3741 (Automatic address increment) " which should be what you want and the way to go to overcome the driver-overhead. Give the I2C driver the biggest possible continuous buffer it can handle and if it writes it efficiently (only big setup functions at the beginning of a multi-byte tranmissions) it should increase performance significantly.
Even Wire.setClock(1000000); (docs) won’t help much if the inter-write times are so big. BTW your chip supports 1000 kHz fast-mode plus at p.6 – default Wire frequency is 100kHZ.
Yes! I noticed that, I am running the Wire library with that same configuration. And like you said, it doesen’t help.
It was only when i tested the usual transfer without the unlocking command that I started to get better results. That led me believe that i could do the transfer of all of the registers of one page in one go (if the buffer allows it). I’m am still exploring this option but I think I will replace the Wire library with the IDF, that seems more robust.
Anyway, I appreciate the help and support, have a great day!
AM