Questions tagged [i2c]

I²C (Inter-Integrated Circuit) is a multi-drop serial bus invented by Philips (now NXP) for communication between ICs on the same PCB, i.e. short distance.

Filter by
Sorted by
Tagged with
117
votes
8answers
122k views

Tradeoffs when considering SPI or I2C?

What tradeoffs should I consider when deciding to use an SPI or I2C interface? This accelerometer/gyro breakout board is available in two models, one for each interface. Would either one be easier ...
72
votes
8answers
103k views

Is there a correct resistance value for I2C pull-up resistors?

The datasheet of the 24LC256 EEPROM states that: The SDA bus requires a pull-up resistor to VCC (typical 10 kΩ for 100 kHz, 2 kΩ for 400 kHz and 1 MHz). I thought that any resistor with a kΩ value ...
39
votes
8answers
37k views

How to resolve I2C address clashes?

I want to connect multiple I2C slave devices to a micro controller all on the same set of pins but the I2C devices all share the same address. The addresses are fixed in the hardware. Is there any ...
38
votes
5answers
109k views

Maximum I2C Bus Length?

What is the maximum length of cable that could be used to connect two I2C devices (I2C master-> I2C slave)? Yes, I know that I2C is really designed for intra-board communication. I have been tasked ...
36
votes
10answers
17k views

SPI or I2C: which to use for a longish bus

I'm contemplating a project that would require several AVRs talking to each other over a bus. They'd be separated by as much as 6 feet. It seems like both I2C and SPI can let a series of micros ...
35
votes
4answers
8k views

I2C 3.3 to 5.0 V conversion

I'm trying to interface a 3.3V I2C device to a 5V Arduino. I don't have any problem with SCL line. I can use a simple voltage divider but I have an issue with the SDA line as this is bi-directional. ...
33
votes
7answers
46k views

What happens if I omit the pullup resistors on I2C lines?

Just now I realized that the I2C data and clock lines (SDA and SCL) must have pullup resistors. Well, I've built a couple of clocks using the DS1307 RTC (see datasheet) according to the schematic ...
31
votes
4answers
122k views

How to connect multiple i2c-interface devices into a single pin A4 (SDA) and A5 (SCL) on Arduino?

I want to add a real time clock module into my little project. I want to display both time and date on my existing i2c 2x16 LCD module. Both i2c-interface real time clock module and 2x16 LCD module ...
26
votes
3answers
27k views

What is difference between I2C and TWI?

What is difference between I2C and TWI interfaces? Wikipedia says, that TWI is variant of I2C. Some other sources says that only name is differ...
24
votes
5answers
5k views

Can I use I2C over 2m cables?

In my current project, I need to communicate between a microcontroller and some sensors over I2C. One of them is a temperature sensor, it needs to be placed at approximatively 2 meters far from the ...
22
votes
7answers
5k views

Why I2C designed to work with pull-up resistors and not pull-down ones?

I understand that in I2C, SCL and SDA lines use pull-up resistors and the pin drivers are open collector NPN devices which can drive pins to ground. This gives I2C an advantage that the same bus now ...
19
votes
6answers
4k views

Why the need for multiple I²C ports?

The I²C protocol allows, in theory and with 7-bit addressing, up to 127 devices to be connected to the master. This is a large number, so why would any low-cost microcontroller (e.g. this PIC24), have ...
19
votes
3answers
2k views

How to fix a PCB design mistake after manufacturing?

Newbie 16 years old here. My project is a mini robot with the pcb as the chassis, lipo battery with charger circuit, and infrared sensors. I used LSM6DS33TR for my I2C accelerometer and gyroscope ...
18
votes
7answers
2k views

General protocol for data transfer from one system to another?

What is the general protocol to send information from one system to another? For example, let's say we have some information collected from microcontroller over a length of time that we want to send ...
17
votes
9answers
32k views

How many i2c slaves can a i2c master support?

Is there a maximum number of i2c slaves that a i2c master can drive? What are the physical limiting factors?
17
votes
8answers
5k views

Why is serial EEPROM preferred over parallel EEPROM?

In the wikipedia page for EEPROM: http://en.wikipedia.org/wiki/EEPROM it is given that "Parallel EEPROM devices typically have an 8-bit data bus and an address bus wide enough to cover the complete ...
16
votes
7answers
11k views

Is there any definitive I2C pin-out guidance out there? Not looking for a “STANDARD”

EDIT: This has been repeated several times, so putting it on top: Yes, it is well known that there is no "standard" for I2C inter-device connectors, but surely this community can formulate a list of "...
16
votes
4answers
23k views

What I2C address should I choose?

Now I know in order to have an I2C address reserved for yourself you have to pay the I2C people some money. But I don't want to do this. I'm asking for advice on what address I should choose for my ...
15
votes
9answers
3k views

Why does I²C only have pull-up resistors (interview question)?

The interviewer wanted to know why pull-up resistors are used on SDA and SCL when the opposite logic can also be implemented. Is there an explanation for why pull-up resistor usage is the chosen ...
15
votes
3answers
1k views

HDMI and I\$^2\$C

I was having a look at the HDMI pinout and I thought: why would they use I\$^2\$C for the display-host communication? My question here is about the design metrics that lead to this choice. HDMI is a ...
13
votes
4answers
6k views

How to reverse engineer I2C and SPI protocols?

If I have an unkown device which talk I2C or SPI how can I reverse engineer the protocol. Basically I am looking for something similar as snoop or tcpdump. For software Mac is preferred but can also ...
12
votes
3answers
16k views

I2C minimum clock speed and reliability

Is there a minimum clock rate specified by I2C? I know the most widely used clock rate is 100kHz and there is a "fast" mode of 400kHz supported by some devices, and a faster yet mode supported by ...
12
votes
3answers
19k views

I2C: 3.3V and 5V devices without level-shifting on 3.3V-bus?

do I really need a level-shifter if I use 5V-powered devices on an I2C-bus that has pull-ups to 3.3V? In my understanding the devices will only pull the lines (SDA, SCL) low (to ground) and never ...
11
votes
5answers
3k views

Is I2C mixed frequency possible?

Suppose we have a 400 kHz I2C bus. There is one master and a bunch of slave devices. We would like to introduce one more slave device, but unfortunately it only goes to 100 kHz . Clearly, the solid ...
11
votes
1answer
23k views

Addressing registers with I2C STM32F0 HAL libraries

I'm very new to using STM's CUBE and HAL_libraries. I'm using an STM32F0 microcontroller with 32 pins. The schematic for I2C is correct. So I need a little help here. I have a capacitive sensor (...
11
votes
7answers
15k views

I2C slave address not acknowledged (sometimes)

I'm trying to communicate with a remotely connected FRAM (FM24C04 from Ramtron) by using I2C. This memory is embedded on a board that can be inserted and removed at any time to/from the system (...
11
votes
1answer
2k views

BMA180 accelerometer. How does it manage to share pins between I2C and SPI?

BMA180 accelerometer can be either SPI slave or I2C slave. The pins for both buses are shared. ...
11
votes
2answers
821 views

I2C level shifting

I am currently designing a circuit that can record data from a sensor and save the data recorded into an EEPROM. My two devices (EEPROM and for testing purpose a RTC) are connected via an I2C bus to a ...
10
votes
2answers
10k views

I2C pullup resistor calculations

I am trying to drive this I2C LCD display with an ATxmega16A4U microcontroller. Both devices are listed to work with I2C clock frequencies up to 400 kHz. The two devices are the only devices on the ...
10
votes
1answer
7k views

What is slew rate for I2C?

I'm configuring I2C on a PIC18 using the built-in functions of the C18 compiler as described in section 2.4 of the documentation: ...
10
votes
2answers
569 views

The use of redundant I2C in spacecraft avionics

I recently read this report about the JPL x2000 avionics development project, which developed more modular avionics platform using commercial silicon, to cut cost and power. They opted for an ...
9
votes
4answers
1k views

Can I put vias on routing I2C lines traces on FR4 PCB?

I am using a MSP430FR2633 micro controller and ADS122C04IPWR DAC over I2C at 100kHz. Can I route the I2C lines through vias in a 2 Layer PCB?
9
votes
4answers
1k views

Is this communication I²C?

I need to decode communication between two devices, but I have no information about these devices. All I know is that four wires are needed (GND, VCC and two wires of communication). I suspect that it ...
9
votes
2answers
5k views

How to deal with multiple pull-up resistors on modules

I was thinking about doing a modules for a development board I did a few days ago that will include spi/i2c interfaces. The problem is that I didn't included pull-up resistors in the MCU pins in the ...
9
votes
2answers
3k views

MCP3424, how to read channels in parallel?

About this question I do not have an electronics engineering background, and this is one of my first challenges with communicating via I2C, and with writing to a register, so please do not assume too ...
9
votes
4answers
8k views

I2C read/write failure under heavy interrupt load

In my system, I am using I2C and I realize under heavy interrupt load (from other sources), I2C communication is easily disrupted. Is this expected behavior for I2C? I would have expected despite ...
9
votes
1answer
2k views

I2C only works when probed or loaded with 1Mohm

I am trying to troubleshoot communications between an msp430fr5847 (master) and a slave sensor with unknown I2C chip (part of an industrial sensor) I am having issues with a new batch of sensors ...
9
votes
5answers
2k views

I2C EEPROM bit-banging: Writes fine, but only if first bit is not set

I am currently working on an I2C EEPROM project using bit-banging to drive the SDA and SCL lines. My read function works fine but whenever I write any byte with a leading "1", I always read FF back; ...
8
votes
8answers
11k views

Sending I2C reliabily over Cat5 cables

I am considering implmenting an home automation system around my Raspberry Pi but I found the price and space requirement of inserting a Pi every place some control is required too much but the Cat5e ...
8
votes
4answers
2k views

I2C signal and power over long range (10meter cable)

After some reading/testing I managed to make stable communication between 2 devices using I2C with FTP CAT5 copper twisted pair cable. Green wire - SCL White/green wire - GND Blue wire - SDA White/...
8
votes
3answers
44k views

Starting with I2C on PIC18s

For a project I'd like three PICs (two slaves PIC18F4620, one master PIC18F46K22) to communicate over the I2C bus. Later on, more slaves may be added (like EEPROM, SRAM, ...). I'm writing the code for ...
8
votes
5answers
4k views

Implementing I2C to analog

How can I implement (or maybe there is an IC that already does that) a board whose input would be I2C and output would be analog voltage (0V - 5V) ? Eventually I would like to connect a couple of ...
8
votes
5answers
868 views

What is the most popular embedded serial bus? [closed]

I'm designing an embedded device that I would like to make interoperable with third party peripherals through a serial bus. Should I choose SPI, I²C, or some other bus? The peripherals will be ...
8
votes
5answers
28k views

multiple arduino communication (1 master, n slaves)

I would like to develop a master/slave network that consists of: 1 Arduino master that reads sensors and generates velocity ramp profiles based on the sensor signals and then sends those ramps to ...
8
votes
2answers
8k views

How do I get an Arduino (5 V) and MPR121 (3.3 V) to talk?

I have the Sparkfun MPR121 I2C Capacitive touch sensor breakout board I have read that it uses 3.3 V, I know that I can't just connect up the 3.3 V power supply output from the Arduino as the ...
8
votes
1answer
367 views

I2C IC for part identification

I am looking for a way for a host system to identify that a certain mechanical module C is connected to it. This mechanical module doesn't need to have any electronics in it, but due to host ...
8
votes
3answers
2k views

Which microcontroller should be master / slave?

I'm design an alarm to wake me up the morning. The system is composed of 3 subsystems : (S1) RGB seven segments management. Composed of 5µCs, one for each digit and one for ":". The high number of µC ...
8
votes
2answers
468 views

Designing my own Bus

This question is further to my previous question: Alternatives to SPI because of EMI. I am toying with the idea of designing my own communication bus. I would be grateful if someone could cast their ...
8
votes
1answer
4k views

Is it possible to only utilise SMBus on PCI Express 1X?

According to the Wikipedia page on PCI Express, the PCI-e 1X slots have 18 pin positions on two lanes (so 36 pins) and positions 5-9 represent SMBus and JTAG. I'd like to hook up a µC as an ...
8
votes
2answers
566 views

MITM on I2C Bus

I've been trying to design a module that will allow me to modify selected slave responses on an I2C bus. Here is the original bus configuration (the pull-ups and power connections are not shown for ...