I want to estimate the throughput of i2c lines and this is the calculation I have done:
What am I trying to do?
Sensors will connect to MCU via multiplexer. There will be a max wire length of 1 meter between MCU and any sensor. MCU will read all sensors cyclically and transmit the data to a PC or a mobile phone over bluetooth/wifi for further processing.
Total data from one sensor:
Accelerometer : 3 axis X 16 bits = 48 bits
Gyroscope : 3 axis X 16 bits = 48 bits
Each read will have some device address overhead = 31 bits (Edited as per JimmyB's comment)
Single read will require 48+48+31 = 127 bits
Assuming that my i2c clock is operating at 400 kHz, I will be able to transfer 1 bit every clock cycle, and hence 400,000 bits in a second.
One complete read = reading all sensors once, i.e. 127x8 = 1016 bits
Thus no. of times I can read all sensor values every second (RPS):
RPS = 400,000 / 1016 = 393.7 assuming my sensors are ready to supply data at that rate.
Notes from datasheet:
Output data rate for Gyro = 4 Hz to 8000 Hz
Output data rate for Accelero = 4Hz to 1000 Hz
Worst case scenario : My sensors will be at a distance of 1 meter (max) from the MCU. Taking into consideration increased bus capacitance and other things that might slow down data transfer, I am thinking 100 kHz will still be achievable (am I right in thinking so?).
Thus reduced RPS = 98.4
Are my calculations correct?
What precautions should I take to improve my data throughput? (twisted cable?, some i2c buffer?)
I did some research after posting this question. I found one i2c bus buffer P82B96 which allows me to have 400 kHz clock frequency for wire lengths exceeding 20 meters.
Limiting thing is program only I guess, provided my calculations are accurate.