daniel-thompson / i2c-star

A clone of the i2c-tiny-usb based upon STM32 and libopencm3
GNU General Public License v3.0
124 stars 31 forks source link
i2c-bus stm32f103 stm32f4-discovery

i2c-star - A STM32 based clone of the i2c-tiny-usb

i2c-star is a compatible clone of Till Harbaum's i2c-tiny-usb. The firmware has no software in common with Till's implementation but is compatible with the i2c-tiny-usb driver found in the mainline Linux kernel. As a result it will work out of the box without requiring any special software on the host computer.

Quickstart

Examples

Note that the +i2c_dev+ kernel module needs to be loaded before using any of the +i2c-tools+ utilities.

$ i2cdetect -l
...
i2c-7   unknown         i2c-tiny-usb at bus 001 device 031      N/A

$ i2cdetect -y 7

To make Linux aware of I2C devices on the bus, use the following command:

$ echo tmp102 0x48 | sudo tee /sys/class/i2c-adapter/i2c-7/new_device

Where +tmp102+ is the name of the kernel driver you want to associate with the I2C device, +0x48+ is the I2C device's 7-bit address, and +i2c-7+ is the bus number the kernel assigned to the i2c-star adapter (appears as +i2c-tiny-usb+ in +dmesg+ and +i2cdetect+).

Hardware setup

The firmware can be easily ported but has been tested on an small STM32F103C8T6 based breakout board. Connections required are:

It has also been tested on the STM32F4-Discovery board, where no connections (except for USB) are required because this board has I2C peripherals built in

Example hardware

http://item.taobao.com/item.htm?spm=a1z10.1.w4004-386456545.4.3eifcC&id=22097803050[STM32F103C8T6 microcontroller development board] from vcc-gnd.com. Normally very easy to source on eBay.

image::images/stm32f103c8t6_dev_board.jpg["STM32F103C8T6 microcontroller development board"]