Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

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
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 ...
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 ...
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 ...
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. ...
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 ...
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 ...
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 "...
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 ...
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
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. ...
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 ...
5
votes
2answers
3k views

Unpowered devices on I2C/SPI bus

I'm trying to develop a board that includes I2C and SPI devices that are unpowered for the majority of the time to save power. I found that for these particular devices (Honeywell HSC pressure sensors)...
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 ...
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 ...
6
votes
1answer
1k views

Arduino: Reliable and practical way to connect an I²C device (1 m away)

This is a combined mechanical/electrical question. It is mainly about getting the I²C connection reliable; this question does not concern itself with the software side (i.e., how to handle an I²C ...
4
votes
3answers
2k views

Multiple I2C devices with the same address

I have multiple devices with the same address, and only one I2C bus. If I don't want to/can't use an address multiplexer, will the following arrangement work? (sorry for the messy schematic) ...
1
vote
2answers
601 views

how to choose the right pullup resistances for i2c lines with multiple slaves

In my project I have connected multiple sensor breakout boards to a Arduino-proMIni running at 3.3V and 8Mhz as follows on a fabricated pcb but preserving the original board layouts (so that I can ...
5
votes
4answers
4k views

I2C and SPI ,if they share same connection , is there confilict or not

We have a product which uses PIC18F4520, and we used some devices like LCD driver and so on, that all use I2C bus to comunicate with the micro. But now we want to add a couple of AD5504, which is a ...
4
votes
4answers
11k views

How to connect multiple of the same device to an Arduino using I2C?

I want to use two of the same magnetometer (HMC5883L) with my Arduino, but I cannot figure the code for calling each of them separately. I have read online that connecting multiple devices is ...
1
vote
4answers
219 views

Can I2C be used with momentary sensors?

[edit: clarifying the question] Is it possible to see events on I2C slaves, or a functional equivalent? I'm brainstorming a new project. I'm using an ESP-12F as a main logic board to control and ...
31
votes
4answers
123k 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 ...
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 ...
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 ...
3
votes
5answers
7k views

I2C busy flag strange behaviour

I've been using STMCUBE combined with Keil for some time now. For most part I like the HAL library and the documentation for STM32f1xx drivers is quite good. I'm doing a project where I am using ...
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...
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 ...
6
votes
1answer
1k views

How to isolate I2C bus when Master is being programmed?

I just asked this question trying to find out if having a powered I2C slave in an ISP bus during MCU (Attiny) programming would be problematic. Apparently it would, so I need to isolate the slave(s) ...
4
votes
4answers
4k views

Problems communicating with I²C RTC

I'm using PIC18F4680 to work with PCF8583P RTC using C18 compiler (and compiler's library functions for hardware \$I^2C\$) and I can't figure out how to read data from it or to determine if written ...
1
vote
3answers
1k views

I2C: Unable to Read Multiple Byte using Bit-Banging method

I am using Bit-Banging for I2C communication via PIC24FJ128GA010. The code works fine for writing 16bytes to EEPROM ( I recieved ACK = 0 for every Byte write ). While reading EEPROM I am able to ...
1
vote
3answers
638 views

I2C Level translation

In our current design, we have two devices which communicate with each other using I2C. But their I2C logic levels are different, so we need to use a level translation? Can I use a simple level ...
4
votes
1answer
2k views

Using MLX90614 OR is I2C and SMBus compatible?

I am trying to use a Melexis MLX90614 with Atmega8. I have failed in all my attempts till now. I tried sending this sequence ...
4
votes
3answers
547 views

Error interfacing DS1307 RTC with PIC32

I am interfacing DS1307 RTC with PIC32MX795F512L. I am using I2C1 for ...
4
votes
4answers
4k views

At what point does crosstalk on I2C become a problem?

If I have a pair of I2C traces (SDA and SCL) on a 1 oz board, each being 8mil wide and separated by an 8mil gap, how long would the traces have to be before crosstalk would become an issue? Edit: ...
3
votes
2answers
2k views

Using internal pull-ups for I2C on PIC18F

I'm working with a PIC18F46J53 and it was working quite well without any troubles. Suddenly, I found a hindrance on my path. I used RB4 and RB5 pins as I2C bus pins for communicating with an EEPROM (...
3
votes
3answers
3k views

Can this AVR MCU with 5V I2C work with this sensor with 3.3V I2C?

I'd like to interface an MPU-9150 sensor with an ATmega128 using I2C. The Atmega operates at 5V while the sensor chip operates at 3.3V. How can I find out if the two can work together? I'm not very ...
3
votes
3answers
3k views

Using I2C and SPI communication on the same same clock and data lines

I am using a PIC18F25K80 with multiple slave devices. All of them uses I2C except one. What i want to know is that can i first use I2C with the devives that uses I2C and then close I2C, change clock ...
2
votes
1answer
457 views

I2C bus occupied

I have a problem with an I2C communication and want you to ask whether there is a better solution than mine. I am programming an STM32F103 at the moment. There is one sensor (MPU6050) which is ...
2
votes
1answer
363 views

Bit-banging I2C question

When bit-banging I2C using 2 PIO lines do these lines still need to be pulled high? Obviously using a dedicated I2C bus the lines must be pulled high as the pins are open-drain outputs but PIO pins ...
1
vote
1answer
524 views

I2C on FFC or IDE cable - interference?

This is a follow-up question on this answer. I need to communicate with I2C over approximately 10cm and I'd like to use an FFC or IDE cable for that. Earlier, I used an FFC cable to link a segment ...
1
vote
2answers
1k views

Why does the I2C interface use the open-collector/open-drain?

The open-collector adds inconveniences like requiring an external pull-up resistor and slows down the throughput. Why did the I2C designers choose to use open-collector/open-drain?
1
vote
2answers
494 views

Multiple instances of same device on I2C bus

I am currently designing a board where I need to include a whole bunch of I2C devices. Since the number is quite high, address clashing is an issue, that of course we can solve implementing different ...
0
votes
1answer
513 views

I2C pullup resistors not working in simulation

I am trying to create a small project on PIC16F877a MCU, in which I am showing the lifetime of this project using RTC module and the temperature read from LM35 onto an LCD. Working with PULLUP ...
0
votes
2answers
152 views

Everything stops working after I enable PWM

So I implemented a simple PWM on a PIC 12F617. Had to use the Compare peripheral with interrupts since I couldn't generate 50hz with the PWM module (too low frequency). I set a value to the CCPR1 ...
0
votes
1answer
83 views

No change in MPU6050 values when interfaced with PIC. Why?

I'm trying to interface mpu6050 module with pic16f886 microcontroller. But, i'm getting x-axis, y-axis and z-axis as 0. Why is there no change in readings even when i move my mpu? edit: This is the ...
0
votes
1answer
89 views

Connecting up to 32 Devices I2C

I'm trying to connect 32 I²C "root of trust" NXP A71CH devices. I'm thinking about a good way that does that, I mean what kind of communication should I use? A digital multiplexer that selects a ...
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 ...
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 (...
7
votes
4answers
1k views

What small IC could give switchable I2C pullups?

My goal is to replace a DPST on pullup resistors with something simple, cheap and very small that can be activated with the I2C bus voltage. I thought that this might be a common enough requirement ...
7
votes
4answers
11k views

Open drain concept in I2C bus?

(I am mainly from a software background and just started to work on an embedded platform. Excuse me if this is a naive question...) I am planning to write a driver for an EEPROM which is connected to ...
4
votes
5answers
15k views

Establishing a proper TWI/I2C communication between a pair of Atmega32

I am a mechanical engineer with the desire of learning electronics stuff. I am working on these days at learning the TWI(I2C) communication in Atmega32. With a lot of internet search I have managed ...