Author Topic: A Quick I2C Question  (Read 1970 times)

0 Members and 1 Guest are viewing this topic.

Offline German_EETopic starter

  • Super Contributor
  • ***
  • Posts: 2399
  • Country: de
A Quick I2C Question
« on: November 26, 2015, 07:14:58 pm »
A question for those who know more about I2C than me. Assuming a 100 KHz interface speed how many I2C writes can I do per millisecond? The receiving device is a memory chip so the limitation here is the bus speed.
Should you find yourself in a chronically leaking boat, energy devoted to changing vessels is likely to be more productive than energy devoted to patching leaks.

Warren Buffett
 

Offline 0xdeadbeef

  • Super Contributor
  • ***
  • Posts: 1580
  • Country: de
Re: A Quick I2C Question
« Reply #1 on: November 26, 2015, 07:27:39 pm »
This also depends on the device. Reading from or writing to the "current" address is faster than a random access. But continued read/write is typically limited by the actual device (EEPROMs tend to have "pages" e.g of 64 bytes).

Full random write access:
START | 7BIT_DEV_ADR | 0(Write) | ACK(Slave) | 8BIT_ADR_HI | ACK(Slave) | 8BIT_ADR_LOW | ACK(Slave) [ 8BIT_DATA | ACK(Slave) ]xN | STOP

Current address read:
START | 7BIT_DEV_ADR | 1(Read) | ACK(Slave) | [ 8BIT_DATA | ACK(Master) ]xN | 8BIT_DATA | NACK(Master) | STOP

If you count START, STOP and ACK/NACK as one clock, you can calculate with the above information how much clocks you need to transfer N bytes of data.
Trying is the first step towards failure - Homer J. Simpson
 

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 17203
  • Country: 00
Re: A Quick I2C Question
« Reply #2 on: November 26, 2015, 08:01:42 pm »
A question for those who know more about I2C than me. Assuming a 100 KHz interface speed how many I2C writes can I do per millisecond? The receiving device is a memory chip so the limitation here is the bus speed.

To send one byte of data needs 9 clock cycles, so your maximum speed is slightly more than 11000 bytes/sec.

But you also have to send extra data because you need to address the chip, set up the writing address, etc. The amount of extra data will depend on the memory chip.
 

Offline German_EETopic starter

  • Super Contributor
  • ***
  • Posts: 2399
  • Country: de
Re: A Quick I2C Question
« Reply #3 on: November 26, 2015, 08:25:47 pm »
I think I'm going to make it. The requirement is to send 8 writes in 5 milliseconds and the figures from Fungus indicate about 55 possible writes in the same period less address overhead
Should you find yourself in a chronically leaking boat, energy devoted to changing vessels is likely to be more productive than energy devoted to patching leaks.

Warren Buffett
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: A Quick I2C Question
« Reply #4 on: November 26, 2015, 08:34:47 pm »
Quote
Assuming a 100 KHz interface speed how many I2C writes can I do per millisecond?

100Kbps/9 bits per byte transmitted * 1ms = ?
================================
https://dannyelectronics.wordpress.com/
 

Offline German_EETopic starter

  • Super Contributor
  • ***
  • Posts: 2399
  • Country: de
Re: A Quick I2C Question
« Reply #5 on: November 26, 2015, 08:37:30 pm »
That's the theory Dannyf, but with I2C there is a lot of overhead with start bits, stop bits, ACK signals and lots of other stuff. Hence my question.
Should you find yourself in a chronically leaking boat, energy devoted to changing vessels is likely to be more productive than energy devoted to patching leaks.

Warren Buffett
 

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 17203
  • Country: 00
Re: A Quick I2C Question
« Reply #6 on: November 27, 2015, 07:27:34 am »
I think I'm going to make it. The requirement is to send 8 writes in 5 milliseconds and the figures from Fungus indicate about 55 possible writes in the same period less address overhead

Should work even if each write is 4 bytes total.

(ie. I2C address, 16-bit chip-memory address, data byte)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf