14
votes
Is it a good idea to perform I2C Communication in the ISR?
In the olden days, when we had a single thread of execution, and many sources of interrupts, you kept the ISR as short and quick as possible, so that it is able to keep up with many frequent interrupt ...
11
votes
Is it a good idea to perform I2C Communication in the ISR?
I don't believe it's a good idea, in general. The I2C protocol allows for clock stretching, which means that any I2C device you're trying to talk to can effectively stop your bus, or at least dork ...
5
votes
Accepted
How can I use AVR microcontroller's SPI and I2C at the same time if they use the same pins?
This ATTINY is not capable of being programmed over SPI. You need TPI for this, which is a two-wire protocol.
Only TPIDATA and SDA are shared on PB1, SCK and TPICLK are not on the same pins.
This ...
5
votes
Accepted
How can I connect 8 I2C modules with entirely different addresses on ESP32?
For using multiple modules on the same I2C bus, you need to check:
that no module tries to pull the voltage higher than the maximum allowed voltage for any other module (nb: some modules might allow ...
4
votes
Is it a good idea to perform I2C Communication in the ISR?
Well, assuming the I2C bus is running at 100 kbit/s, and you're reading/writing roughly 500 bits, the whole interrupt will take about 5 milliseconds. Do you care if your main program is paused for 5 ...
3
votes
What happens if I short the MISO line and SCL line?
Bad idea.
The I²C device has no idea about the CS line and could happily desturb the data during SPI communication if the pattern on the bus was just right.
SPI usage will also violate the timing and ...
3
votes
Is it a good idea to perform I2C Communication in the ISR?
Egregious examples of systems that disable interrupts for long periods of time:
Early Macintoshes, which disabled interrupts for the entire duration of floppy disk operations, thereby preventing the ...
3
votes
Is it a good idea to perform I2C Communication in the ISR?
[General guidelines. We don’t know the nature of the sensor, the nature of the instrument. We’ll make working assumptions.]
The general advice is not to do serial communication in an ISR. Don’t ...
3
votes
Is it a good idea to perform I2C Communication in the ISR?
In time-critical applications the RDY output of the chip/module/whatever can be useful to get the data or initialise a transmission immediately. Otherwise, it's still possible to read the RDY output ...
3
votes
Is it a good idea to perform I2C Communication in the ISR?
It highly depends on the architecture of the processor.
As a general rule, you should not put any time-consuming operation in an isr.
Some architectures have some measures to prevent any long task in ...
2
votes
How can I use AVR microcontroller's SPI and I2C at the same time if they use the same pins?
The MCU would have configuration registers to select either SPI or I2C on the pins you want. You have to do that before you use the SPI driver. You wont be able to use SPI and I2C at the same time on ...
2
votes
Is it a good idea to perform I2C Communication in the ISR?
In general, an ISR should avoid doing anything that would require that it wait a non-trivial amount of time for something to happen. If some action would require that a pin be asserted for at least ...
2
votes
Accepted
How to design a flex PCB with 4 I2C sensors?
The main concern PCB-wise is that you stay within the maximum capacitance. You can use an online calculator to estimate the capacitance from the total run. A ground plane will increase noise immunity ...
1
vote
How to design a flex PCB with 4 I2C sensors?
Will I have to add pull-up resistors on each of the sensors for all the pins?
The datasheet answers your question. See page 6.
1
vote
Is it a good idea to perform I2C Communication in the ISR?
As many of the other answers have said, it's generally a bad idea to do anything that stalls, in an ISR. Instead, do the minimum possible that MUST be done RIGHT NOW, and get out. Let some slower ...
1
vote
Accepted
Necessary components for a basic I2C circuit
I got the circuit working. My general advice for anyone with a similar issue/level of experience is to learn to use an oscilloscope and what your clock/data signals ought to look like.
Problem 1 - ...
1
vote
PCF8563 not answering ACK, is there something wrong with my circuit?
Any suggestions on what I’m doing wrong ?
The OSCI input requires a capacitor to ground (usually a trimmer to calibrate the clock precisely) having a value between 5 pF and 25 pF: -
You can check ...
1
vote
Accepted
Is my assumption about "Enabling FM+ I2C on lower frequency gives more robustness" correct?
No, you are not necessarily correct.
If you need to communicate over a longer bus with more capacitance and stronger pull-ups, you need the devices at both ends of the bus to be able to drive that bus....
1
vote
Is my assumption about "Enabling FM+ I2C on lower frequency gives more robustness" correct?
This assumption is correct. FM+ is an extension to standard I2C, so it is still backward compatible, but can run with longer cables EXOR higher speed.
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
i2c × 2039microcontroller × 262
arduino × 241
stm32 × 207
pic × 138
spi × 129
sensor × 106
raspberry-pi × 86
c × 85
pullup × 84
communication × 82
eeprom × 63
avr × 60
embedded × 50
atmega × 50
level-shifting × 47
uart × 46
smbus × 44
serial × 41
multiplexer × 37
adc × 35
lcd × 35
rtc × 35
esp32 × 34
bus × 33