I2C activation on raspberry PI B+ and 2

The new version of kernel now activate the device-tree standard, it means that instead of having all module activated by default with some stopped by a blacklist system, now, all are disable and activated only when described in a device tree.

Device tree details the system architecture and dependencies following configuration files. The device tree can be owned by the shield itself in an attached eprom.

As a consequence, now, i2c / spi are not activated by default. So if you need to activate it on startup. For this, edit /boot/config.txt and add line at the end like :

dtparam=i2c_arm=on   # for i2c 1
dtparam=i2c_vc=on    # for i2c 0
dtparam=spi=on
dtparam=i2s=on

dtparam=i2c_arm=on,i2c_vc=on

Then reboot

Use SPI port on raspberry PI

SPI is a frequent way to interface slave device with a micro-controller / cpu. SPI is a 4 wires synchronous connection between a slave and a master. As part of the 4 wires, there is a CLK signal, the speed is not defined and depends on the slave but it is usually > 10Mhz. SPI allows fast data transfer. Two data signals (MISO and MOSI) for Master (In/Out) Slave (In/Out) are used to transfer data in sync with the CLK clock. The last wire is a chip select signal named CEx for Chip Enable. As you can manage multiple slave, you have to manage different CEx signal, one per slave.

Continue reading