The I2C Bus Speed

Thread Starter

John99407

Joined Jul 12, 2019
77
Hello

My question is that if I will connect the I2C Slave to different microcontrollers, will the speed of the i2c bus remain same or different?

  1. I2C slave with 32 KHz
  2. 8051 with 11.0592 Mhz
  3. PIC with 20 Mhz
  4. ARM with 32 MHz

What will the i2c bus speed if I2C slave will communicate with 8051 ?
What will the i2c bus speed if I2C slave will communicate with PIC ?
What will the i2c bus speed if I2C slave will communicate with ARM ?

standards speed grades (standard mode: 100 kbit/s, full speed: 400 kbit/s, fast mode: 1 mbit/s, high speed: 3,2 Mbit/s) are maximum ratings
 

AlbertHall

Joined Jun 4, 2014
12,347
Any speed you want up to the maximum the slave can handle, this is not related to the slave clock speed. The clock comes from the master.
 

Thread Starter

John99407

Joined Jul 12, 2019
77
Any speed you want up to the maximum the slave can handle, this is not related to the slave clock speed. The clock comes from the master.
I didn't understand, That's why i took following examples

What will the i2c bus speed if I2C slave (32 KHz) will communicate with 8051 (11Mhz) ?
What will the i2c bus speed if I2C slave (32 KHz )will communicate with PIC (20Mhz) ?
What will the i2c bus speed if I2C slave (32 KHz ) will communicate with ARM (32Mhz)?
 

JohnInTX

Joined Jun 26, 2012
4,787
The I2C clock speed is independent from the type of microcontroller or the microcontroller's clock speed. (within reason). You will have to take the microcontroller's clock speed into account when configuring I2C for a given bus speed but after that, the I2C is the same regardless of the processor used.
 

Papabravo

Joined Feb 24, 2006
21,227
Consider the first case where the slave SCL frequency is 32 KHz and the master clock frequency is 11 MHz.

I2C bus speed can not be more then 32 KHz for any microcontroller ?
The slave device DOES not determine the I2C bus frequency. It might be a maximum value that the slave device can support. In any case there is ABSOLUTELY no connection between the I2C bus frequency and the processor bus frequency. All I2C master devices have a facility for dividing their master clock down to an appropriate speed for the I2C bus. Why are you obsessing about this. Have you read the datasheeets? Have you implemented a system or tried to implement a system where this was a problem? I think not. The spec says that I2C devices should operate at a maximum frequency of 100 kHz. there is NO LOWER LIMIT. You could have an I2C bus that runs at a clock frequency of 1Hz. There is a provision in the spec for some devices to run at a bus frequency of 400 kHz. If you actually benchmark some devices you might find that just like processors they can be overclocked. Specification are all about what the manufacturer wants to guarantee over time, temperature, and power supply variations.
 

Thread Starter

John99407

Joined Jul 12, 2019
77
Have you read the datasheeets?
I followed this link https://www.best-microcontroller-projects.com/i2c-tutorial.html

I have read it following datasheets
DS1307 RTC page 3 https://datasheets.maximintegrated.com/en/ds/DS1307.pdf
SSD1306 (OLED Display) page 49 https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf
MCP23017 page 1 http://ww1.microchip.com/downloads/en/devicedoc/20001952c.pdf

Each device operate at different frequency

DS1307 can not run faster than 100kHz
SSD1306 can not run faster than 407 kHz
MCP23017 can not run faster than 1.7 MHz
PiC with 20 MHz clock frequency,

What's the minimum and maximum bus speed for PIC and DS1307 ? I think maximum speed is 100Khz and minimum is less then 100 Khz ie 80 Khz, 60 Hz
What's the minimum bus maximum speed for PIC and SSD1307? I think maximum is 400Khz may be 100 Khz, 300 Khz, 350 KHz
What's the minimum bus maximum speed for PIC and MCP23017 ? speed may be anything less then 1.7Mhz, 1.3 Mhz, 1.4Mhz
 
Last edited:

AlbertHall

Joined Jun 4, 2014
12,347
What's the minimum bus maximum speed for PIC and MCP23017 ? speed may be anything less then 1.7Mhz, 1.3 Mhz, 1.4Mhz
Note the datasheet specifies minimum widths for the clock pulses but no maximum is given so the pulses could be, let's say, 10 seconds wide.
1580735047548.png
 

Papabravo

Joined Feb 24, 2006
21,227
Just because a PIC has a clock frequency of 20 MHz DOES NOT MEAN THAT THE I2C bus MUST RUN AT THAT FREQUENCY. Where did you get that ridiculous notion. The PIC has internal hardware that divides the I2C bus frequency down to some set of values that can be matched to the peripherals that you have -- ALL OF THEM!!
 

Thread Starter

John99407

Joined Jul 12, 2019
77
Just because a PIC has a clock frequency of 20 MHz DOES NOT MEAN THAT THE I2C bus MUST RUN AT THAT FREQUENCY. Where did you get that ridiculous notion. The PIC has internal hardware that divides the I2C bus frequency down to some set of values that can be matched to the peripherals that you have -- ALL OF THEM!!
I am trying to clear my doubts @Papabravo What is the answer's for following question's

1. Suppose SSD1306 communicate with PIC over I2C. What would be speed of I2C bus ?
2. Suppose MCP23017 communicate with PIC over I2C. What would be speed of I2C bus ?
 

MrChips

Joined Oct 2, 2009
30,823
Here is an analogy going back to legacy serial communications.
For a long time, all serial communications occurred at 1200 baud.
It did not matter what clock speed the computer and devices were running. All communication was at the same speed.

Same thing with I2C.
Ignore what system clock speed the device or computer is running.
The master device and slave device will operate the I2C at the same speed, dictated by the master device.
If the slave device can only operate I2C at 32kHz, then the master device must accommodate that by communicating at 32kHz regardless of its own maximum I2C capability.

An I2C master can communicate with different devices at different speeds. This may require separate communication buses to avoid miscommunication.
 

SamR

Joined Mar 19, 2019
5,052
1200 Baud was fast compared to 300 Baud. Serial communications were/are severely limited by speed vs. distance even on shielded twisted pair cables. Hence the Modem.
 

Papabravo

Joined Feb 24, 2006
21,227
I am trying to clear my doubts @Papabravo What is the answer's for following question's

1. Suppose SSD1306 communicate with PIC over I2C. What would be speed of I2C bus ?
2. Suppose MCP23017 communicate with PIC over I2C. What would be speed of I2C bus ?
The speeds can be anything less than or equal to the maximum speed supported by the I2C device. There is not a single unique answer to your question. There is a set of speeds that are possible. You select the one that best matches the two devices. For example you might choose a speed which is less than the maximum possible speed to enhance reliability, or because the actual bus has more capacitance that must be charged and discharged by the wimpy drivers on the SDA or SCL lines. I truly do not understand why this is so hard for you to grasp. You seem to be in a universe of solo possibilities.
 

Thread Starter

John99407

Joined Jul 12, 2019
77
The speeds can be anything less than or equal to the maximum speed supported by the I2C device. There is not a single unique answer to your question. I truly do not understand why this is so hard for you to grasp. You seem to be in a universe of solo possibilities.
I understood , I have given answer of my questions in post 8. All I needed was the confirmation that you made in the last post

Thank you all
 

djsfantasi

Joined Apr 11, 2010
9,163
I’ve been sitting quietly, shaking my head.

I2C communication speed depends on one thing. The speed YOU define the master to run at.

Of course, you can’t pick just any old speed. The speed you initialize the I2C bus on the master must be less than or equal to the minimum of the fastest speed the master can support or the fastest speed the slaves can support.

That’s it... Note that this does NOT directly depend on the processor speed of any node. That is indirectly a factor, but differs from processor to processor, and you can’t predict the speed of the I2C bus based on the processor speed.
 

BobaMosfet

Joined Jul 1, 2009
2,113
Hello

My question is that if I will connect the I2C Slave to different microcontrollers, will the speed of the i2c bus remain same or different?

  1. I2C slave with 32 KHz
  2. 8051 with 11.0592 Mhz
  3. PIC with 20 Mhz
  4. ARM with 32 MHz

What will the i2c bus speed if I2C slave will communicate with 8051 ?
What will the i2c bus speed if I2C slave will communicate with PIC ?
What will the i2c bus speed if I2C slave will communicate with ARM ?

standards speed grades (standard mode: 100 kbit/s, full speed: 400 kbit/s, fast mode: 1 mbit/s, high speed: 3,2 Mbit/s) are maximum ratings
i2c/twi bus speed is set to by master. You have to tell the transmitter to transmit at a choice of speeds when you configure it. Usually master/slave systems are designed together so a mutual speed is determined during the design phase.

I would recommend operating at the fastest speed you can muster, as a slave. If your device gets addressed, and you can't understand what is being sent to you, step your speed down and send a NACK.
 
Top