15
votes
Raspberry as an I2C SLAVE
Since this topic is very poorly covered and Sebastião's snippet
and helped me to solve this problem I want add a complete solution on how to setup a RaspberryPi right here (tested on a RPi 3 and Zero ...
13
votes
Can we use other GPIO pins as I2C
The whole point of I2C is it is a bus. You can therefore connect multiple I2C devices to the same GPIO provided they have different I2C device addresses.
If the devices share an address which can't ...
13
votes
Pi 4 I/O interface options... and where to find them
The preliminary Raspberry Pi 4 Model B datasheet, section "5.1.1 GPIO Pin Assignments" says:
As well as being able to be used as straightforward software controlled input and output (with ...
12
votes
Raspberry Pi DPI only works over short distances. Why?
All cables have a length limit. When you exceed that length limit, the signals in the cable attenuate due to resistance of the cable, get deformed due to capacitance and inductance in the cable, and ...
9
votes
Accepted
How to use Adafruit TCA9548A 1-to-8 I2C Multiplexer Breakout in C#?
A code sample is right there on Adafruit website (in Python, but it's very simple).
The TCA9548A multiplexer is interesting in that it has an I2C address (0x70 by default) - and you basically send ...
9
votes
Accepted
PoE hat fan activation on OS other than Raspbian
I'm using Ubuntu Server 20.04 LTS. The dtparams setting does not work, instead you need a udev rule.
The fan config is in /sys/class/thermal/cooling_device0/, if you cat /sys/class/thermal/...
9
votes
Accepted
Adafruit bonnet & adafruit-circuitpython-motorkit return "ValueError: No Hardware I2C on (scl,sda)=(3, 2)"
The fix is to use raspi-config to activate the I2C port.
I'm documenting this because the interthing had no link from that misleading error message to this fix, because nobody except me forgot to ...
8
votes
Accepted
How to Read I2C Address
The active address is 0x65.
The row indicates the 16's place and the column indicates the one's place. So the answer is 0x60 + 0x05 = 0x65.
7
votes
Accepted
Why did my Pi die?
From Wikipedia:
Overclocked use may permanently damage components enough to cause them to misbehave (even under normal operating conditions) without becoming totally unusable.
[...]
In ...
7
votes
Connecting multiple devices via I2C
I2C is a bus. You can connect multiple devices to a bus.
I2C requires that each device on the bus has a unique address (generally a small number between 0 and 127). Manufactures tend to give ...
7
votes
Accepted
How to setup a MCP79410 real time clock?
In order to set up a MCP79410 real time clock (RTC, see manual), one needs to start by connecting it to one's RPi and a quartz crystal. The following is supposed to be a rough sketch on how to connect ...
7
votes
Accepted
Raspberry as an I2C SLAVE
This is almost identical to your previous question. You probably should have edited that rather than asking a new question.
You need the bscXfer to be within the while loop. That is how the xfer ...
6
votes
Accepted
Is there a tool to read and write data using I2C?
sudo apt-get install i2c-tools
Then use i2cset, i2cget, i2cdump.
man i2cset # for help
man i2cget # for help
man i2cdump # for help
Aternatively my pigpio library supports I2C from the command line ...
6
votes
Accepted
Does the Raspberry Pi support I2C multi-master configurations?
I'm fairly sure the Raspberry Pi does NOT support I2C multi-master mode.
There is no mention of muli-master in the documentation.
The Broadcom Serial Controller (BSC) controller is a master, fast-...
6
votes
I2C Bus voltage
Some of the other comments are true, but not totally clear.
You can use the Pi I²C to connect to another I²C device, even if it is powered by 5V provided there are no pull-up resistors to 5V.
I ...
6
votes
Accepted
rPi3 I2C-LCD, do i need a logic level converter?
You can't just write to an I2C bus. The SCL line is an output from the master (Pi) but the SDA line is an input and an output.
The LCD should not have pull-ups to 5V on board but many do. Perhaps ...
6
votes
Accepted
/dev/mem vs /dev/i2c-1
Disadvantages using /dev/mem for accessing the I²C hardware of the Raspberry Pi directly:
It's not portable to other hardware platforms. It's not portable to additional USB I²C adapters. It's not ...
6
votes
Accepted
What is Rpi's I2C Maximum Speed?
Answer
I have confirmed that Rpi4B 4GB v1.2 buster 2020feb13 I2C #1 can set speed other than 100kHz.
Figures
Appendices
Appendix A - /boot/config.txt tlfong01 2020mar04
# /boot/config.txt ...
6
votes
What is Rpi's I2C Maximum Speed?
As a side note to anyone experimenting with the i2c baudrate, you don't have to set the baudrate via config.txt, which requires a reboot. You can do it at runtime by configuring the kernel module with ...
6
votes
Accepted
How to connect multiple sensors to an rpi with the I2C?
I2C is a bus system and allows you to connect multiple sensors to the same pins. The master system (the Pi) lets the sensors know who should respond by placing that sensor's address on the bus.
In ...
5
votes
Accepted
How to use i2c_gpio with Raspberry Pi?
As of June 2016 Raspbian already has the necessary modifications. You only need to enable the overlay in config.txt (step 6 onwards).
I finally got this working as follows:
Rebuild the kernel with ...
5
votes
Accepted
I2C using wiringPi or IOCTL in C, more than 2 bytes
I'm wondering, may understand that Raspberry Pi's I2C is in fact the SMBus version of I2C ?
I don't think it is limited in that sense but that is the normative way to use it. There is no such ...
5
votes
I2C not working on RPi 2 B
Initially Enable the I2C protocol feature in raspberry pi:
sudo raspi-config
Enable the I2C
Reboot your system
Connect the I2C device to its SDA and SCL pin respectively refer the pin out of ...
5
votes
Accepted
Prevent wake-from-halt
Yes there is a way to disable GPIO3 (physical pin 5) pulled low to boot.
In /boot/config.txt add the line
dtoverlay=gpio-poweroff
See the documentation for overlays in /boot/overlays/README. The ...
5
votes
Enable i2c on Ubuntu Mate Raspberry Pi 3
Add the following line to /boot/config.txt
dtparam=i2c_arm=on
Add the following line to /etc/modules
i2c-dev
Reboot
5
votes
Accepted
I2C bus 0 not working, I2C bus 1 is
After searching around I have found the problem.
Simple solution is that the config menu only enabled i2c-1 bus, not the i2c busses in general.
Opening the file /boot/config.txt and then adding the ...
5
votes
Accepted
Does the Pi4 have pullups on SDA/SCL?
I²C requires pullup to work. The unreferenced discussion seems to be misinformed.
All Pi models have on-board 1.8kΩ pullups on I²C pins 3,5.
I have not used I²C on a Pi4, but assume it is unchanged.
...
5
votes
Accepted
Pi locking up trying to use rising/falling edge detection
Solution:
Add:
dtoverlay=gpio-no-irq
to /boot/config.txt.
Previously the kernel would automatically disable interrupts when you set one of rising/falling edge detection methods but that apparently ...
5
votes
Accepted
How to connect two BME280 sensors via I2C to a Raspberry Pi 3B+
In general, every I2C device has its own address, and one can connect many devices to the same port e.g. of the PI. Individual communication is possible via those addresses. (This is something you set ...
5
votes
What is Rpi's I2C Maximum Speed?
The maximum supported speed is 400 Kb/s.
I am not aware of any difference in the I2C implementation between Pi models.
The Broadcom Serial Controller (BSC) controller is a master, fast-mode
(...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
i2c × 795gpio × 136
python × 119
raspbian × 92
pi-3 × 81
sensor × 72
pi-4 × 49
arduino × 42
spi × 34
pigpio × 32
pi-3b+ × 31
rtc × 31
hardware × 26
pi-zero-w × 23
pi-2 × 22
c × 21
wiringpi × 21
rpi.gpio × 16
serial × 16
lcd × 15
linux × 14
python-3 × 14
mpu6050 × 14
adafruit × 13
pi-zero × 12