The latest firmware implements device tree support. That will have broken things like I²C, SPI, and 1-wire bus.
For fuller details see I²C, SPI, I2S, LIRC, PPS, stopped working? Read this..
Add one or more of the following to your /boot/config.txt and reboot.
No longer add: dtparam=i2c1=on (or dtparam=i2c0=on on old models)
Instead add: ...
There's a lot of information about RPi's GPIO here: http://elinux.org/Rpi_Low-level_peripherals
According to it, you can program any GPIO pins for I²C, but:
Pin 3 (SDA0) and Pin 5 (SCL0) are preset to be used as an I²C interface. So there are 1.8 kilohm pulls up resistors on the board for these pins.
That wiki page also has some low-level GPIO code ...
Generally this happens because something is pulling SDA (pin 3) low.
The i2cdetect program checks for the existence of a device by sending its address then letting SDA float high. If the device exists it should pull SDA low to signal its presence.
Check your wiring to make sure SDA hasn't been inadvertently connected to ground.
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 be changed you can use an I2C multiplexor chip to typically connect 8 devices to the same I2C bus. You send a command to the multiplexor to specify the device ...
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 programmable
pulls), GPIO pins can be switched (multiplexed) into various other modes backed by dedicated
peripheral blocks such as I2C, UART and SPI.
The short answer to your question, how to safely connect the RPi to an Arduino, is indeed given at the first link you posted: http://blog.oscarliang.net/raspberry-pi-arduino-connected-i2c/. I have used the method given there with great success, and without damaging any components.
But your question suggests that you don't trust that method, and I think the ...
I²C protocol is very simple. It does not really define data structures that are sent over the wire. The frame consist of a slave address (with direction bit indicating if master wants to read or write) and (in case of writing) some bytes of data. Since it doesn't make sense to initiate write with 0 bytes of data, first byte is mandatory.
This first byte is ...
But on a new Pi (Raspbian/B+) I could not get it to work until I followed the Advanced option in raspi-config and enbaled i2c there(and rebooted).
This is because newer Raspbian kernels use device tree "to manage some resource allocation and module loading":
The main impact of using Device Tree is to change from everything on, relying on module ...
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 W)!
Setting up a working slave:
Be sure to have commented out this line in your /boot/config.txt:
There's a i2c-dev header in the Linux userspace. I can't remember if this header is shipped with the lm-sensors package, or if it will need to be installed from source. I'd check your distro's package repository. xGoat has a nice article covering preparation & usage.
Including i2c-dev header will allow the following ...
Lots of discussions going on about this. Here's what my reading and messing around with shows me:
I2C support is not built into the default kernel with the Debian "squeeze"
A custom kernel will have to be compiled with the i2cspi module (Here is a GIT tree excerpt)
The drivers that have been written so far are only for the 3.2 kernel and later, and the ...
This should help you: AN10658 Sending I2C-bus signals via long communications cables
If possible you should use a cable with the lowest capacitance, maybe Cat5 cable or something closer. Shielding won't hurt either.
The maximum I2C cable capacitance is limited to 500pf, a cat5 cable has the capacitance of 50pf/meter. So, basically, for a 10m cable you will ...
If you don't want to spare your USB port of your Rpi, you can use GPIO Serial to communicate with your Arduino. There is a great tutorial of Conor O'Neill for connecting Rpi with a Arduino Pro Mini. The procedure is the same with your Arduino Uno.
All you need is a LLC (Logic Level Converter) to be able to connect these two devices. As you've already ...
Overclocked use may permanently damage components enough to cause them to misbehave (even under normal operating conditions) without becoming totally unusable.
In general, overclockers claim that testing can ensure that an overclocked system is stable and functioning correctly. Although software tools are available for ...
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 different types of device different addresses, so normally there is no need to do anything special.
As far as wiring is concerned just connect each device to SDA and ...
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 it a command to tell it which I2C multiplexed output you want to talk to, then you can address the board you want to address.
So, you'll need to select the ...
According to the wiki, I2C is exposed on pins 3 (SDA) and 5 (SCL).
Using from Python on Debian (Untested)
Based on reading this forum post.
sudo apt-get install python-smbus
to install the drivers. At the time of writing, there is a test script here.
Note: Someone needs to test this.
Questions 1 to 3 are answered the same:
Current kernel at github is already 3.2. It includes I2C and SPI drivers in the source tree. You just have to activate it in the configuration and compile your own kernel.
I fixed the issue by manually adding the i2c group and setting the group for i2c-* devices in udev. Thanks @ikku for the hints.
# groupadd i2c
# usermod -aG i2c myusername
# echo 'KERNEL=="i2c-[0-9]*", GROUP="i2c"' >> /etc/udev/rules.d/10-local_i2c_group.rules
There is no need to install i2c-tools to access the I2C bus for users in the group i2c (but ...
Depending on the LEDs you are using, It may be possible to use a multiplexing scheme to reduce the number of drivers you need.
It's probably simpler to use a bunch of 4094 shift registers daisy chained. You can bitbang the clock/data or use the SPI hardware to drive them
Each 4094 can control 8 LEDs. You'll most likely need a small driver (eg transistor) ...
The various releases are listed here the Debian Wheezy python-smbus page.
I assume you can just install via apt-get, although I believe you need to i2c tools package as well:
sudo apt-get install i2c-tools
sudo apt-get install python-smbus
When you create your virtual environment you should be able to inherit the system site packages using the --system-...
The rev. 2 model A and B both have a breakout for a second I2C bus, with the caveat that you can't use it and the camera header at the same time (this is software switchable while the pi is running).
The eight hole breakout is easy to see just inside of the GPIO header.
This is usually referred to as the P5 header in documentation, but on one (of two) of ...
The I2C clock bps (bits per second) can be set between 125 Mb/s and 3826 b/s (250Mhz core clock with even divider between 2 and 65536). BCM2835 ARM Peripherals pages 28-36.
In practice speeds higher than 30 Mb/s are unlikely to work.
The maximum bps I've heard of is 3.4 Mb/s but I don't remember any evidence being offered.
Bit rates of 400 kb/s (a sort of ...
You can drive as many servos from the Pi as you can find spare gpios.
You have to use hardware timed PWM rather than software timed PWM.
People who report jitter have been using software timed PWM.
My pigpio library generates independent hardware timed PWM on all the user gpios and is suitable for servos. I think the defaults used mean it has ...
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 usings pigs, see the i2c* commands, e.g. i2co.
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-mode
(400Kb/s) BSC controller. The Broadcom Serial Control bus is a
proprietary bus compliant with the Philips® I2C bus/interface version
2.1 January 2000....