Community
cancel
Showing results for 
Search instead for 
Did you mean: 
BBOUC2
New Contributor II
2,289 Views

I2C performances on Galileo

Hello all,

just to be clear : do not search my question... There is no question, I just want to share the measurements made on a Galileo in order to know what are the exact performances you can expect from the Wire library. Do not forget that Galileo runs on a Linux kernel, your sketch being compiled as a single-thread executable file. The performances you obtain are then significantly different from the ones you will get on a AVR based Arduino.

I have performed the test using a I/O Expander board I designed, equipped with two PCF8574A I/O expander, running on a 100kHz I2C bus. Measurements have been made with a logic analyzer with a 125ns timebase.

Here are the values I found

Time between call to Wire.beginTransmission and effective transmission of address byte on the bus : 70 microseconds

Time between call to Wire.endTransmission and effective transmission of data bytes (queued by Wire.write) : 115 microseconds for one byte in the queue, 180 microseconds for two bytes in the queue. When more than 2 bytes are transmitted, the delay grows roughly of 6 microseconds for each byte (194 for 4 bytes in the queue)

Time between call the Wire.endTransmission and return to sketch code : 80 microseconds (this last value gives roughly 150 microseconds as a minimum between last transmitted data byte and the tranmission of the next address byte)

I hope this can help somebody

8 Replies
asss
Valued Contributor II
86 Views

Hi,

I think need to provide the following information:

- Galileo board type

- Linux Kernel version

BR,

xbolshe

BBOUC2
New Contributor II
86 Views

Good suggestion...

Test performed on Galileo 1 with the default firmware (not the "full" Yocto). I will repeat the test tomorrow with the Yocto firmware (installed on the SD), to see if I find any difference

I think that Galileo Gen 2 will give the same results (but I have no Gen 2 to verify)

asss
Valued Contributor II
86 Views

Just FYI:

BR,

xbolshe

BBOUC2
New Contributor II
86 Views

Mmmmm... sounds very weird

As far as I know, the Cypress chip is not compatible with the fast I2C (400kHz). I will check that today when I am back on my Galileo

Benoit

BBOUC2
New Contributor II
86 Views

I confirm : I2C speed is 100kHz on my Galileo, it's not set to 400kHz.

Do you have a specific script running on your Galileo, xbolshe? I know that the Quark can run the I2C at 400kHz, but it's not supported by the chipset, so setting the speed to "fast" seems dangerous for me (the Cypress will become unresponsive)

BBOUC2
New Contributor II
86 Views

As discussed, I repeated the test with Intel Yoctos on the SD. I am rather surprized by the results (in a good way): the delays are reduced. For example, I see now that delay between address and data bytes can be as low as 20 microseconds. It seems that the drivers are a little bit more optimized with the Yoctos.

However, the variation seems bigger (I see delays varying from 20 to 164 microseconds, with an average value of 90 microseconds)

asss
Valued Contributor II
86 Views

Galileo Gen2 works with 400 kHz I2C bus, Gen1 - with 100 kHz.

BR,

xbolshe

BBOUC2
New Contributor II
86 Views

Just gave a quick look to Gen 2 schematics : it's not the same I/O chip than Gen 1

Gen 1 = CY8C9540A (limited to 100kHz)

Gen 2 = PCAL9535 (compatible with 400kHz I2C)

That explains what you see xbolshe. By the way, I see this choice from Intel as a bit dangerous, because the standard Arduino library uses 100kHz by default (it can be changed in the source code of the Wire library). That means that some I2C shields may not work with a Galileo Gen 2...

I tlooks like I really need to buy a Gen 2, and check this in detail