I2C Bus Capacity?

Post Reply
copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

I2C Bus Capacity?

Post by copterrichie »

Question, How much data can the I2C bus handle operating at 400khz before it becomes too congested for reliable sensory data?

Sebbi
Posts: 478
Joined: Sun Jul 08, 2012 1:08 am
Location: Germany
Contact:

Re: I2C Bus Capacity?

Post by Sebbi »

in Fast-mode (400 kHz) the bandwith of the bus is 400 kbit/s (suprised?). I2C addresses are 7-10 bit so around 100 to 1000 devices can be on the same bus.

Since there is some protocol overhead I'll assume an actual bandwidth of 200 kbit/s ... an MPU6050s complete dataset (acc+temp+gyro+external mag) would be 160 bit, so you could ask that sensor for data 1250 times per second before the bus would fill up.

Since I2C consists of one master and multiple slaves congestion can never happen and you can just poll sensors for data as fast as the bus allows.

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: I2C Bus Capacity?

Post by copterrichie »

Thank you and that makes sense.

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: I2C Bus Capacity?

Post by copterrichie »

@Sebbi, Thanks again but I did not ask the right question, what I need to know is: What is the maximum time between polls to the Gyro/ACC is safe to maintain a stable flight? In other words, I would like to use the I2C bus to communicate with a slave processor and I need to understand the amount of data that can be transferred during that time frame.

Thank you.

Sebbi
Posts: 478
Joined: Sun Jul 08, 2012 1:08 am
Location: Germany
Contact:

Re: I2C Bus Capacity?

Post by Sebbi »

Since I2C is master/slave communication there is no way you could "overuse" I2C. The master asks a slave for data and when that operation finishes it can immediately do another one ... bus speed / sensor answering speed determines how fast this goes.

As for maximum time between sensor readings ... I think Arducopter uses a fixed 100 Hz poll rate while MultiWiis rate is usually much much higher.

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: I2C Bus Capacity?

Post by copterrichie »

Thank you Sebbi, that is exactly what I needed to know. so now I need to figure how often the MWC polls and can move forward. :)

Sebbi
Posts: 478
Joined: Sun Jul 08, 2012 1:08 am
Location: Germany
Contact:

Re: I2C Bus Capacity?

Post by Sebbi »

It should be between 300 and 600 Hz (gyro gets polled twice that fast in computeIMU()) ... depending on cycle time which largely depends on the features configured in config.h

Post Reply