Electronics ru
Advanced Search +


I2C-tiny-USB. Part 2

Compiling the firmware

The ATtiny45 is quite new and thus not all parts of the development chain support this chip in their current release versions. The latest binutils (linker an assembler) and avrdude (programmer) support the new chips as well but GCC doesn't. The GCC-4.1.0 has to be patched to support some AVR cpus incl. the attiny45. Get the latest avr device patches (patch-newdevices) e.g here.

Uploading the firmware

If you are familiar with Atmel programming you probably know what you are doing. The Makefile in i2c-tiny-usb/firmware/Makefile assumes, that you are using the stk500 for programming the attiny45. Since all 6 user configurable pins of the ATtiny45 are required, the so called high voltage serial programming (hvsp) mode of the attiny45 has to be used. E.g. the stk500, the AVR-Doper and the AVR Dragon are supporting this mode.

Two versions of the firmware can be compiled which are based on different USB software implementations for the AVR. If in doubt use the pre-compiled firmware.hex file distributed with the source code.


The device seems to work fine, it is detected correctly by Linux, but i get various error messages when accessing it from the test application.
First make sure that the kernel driver is not loaded when trying to use the libusb based test application. Since the kernel driver is part of the main kernel line, it may even be already installed on your system. Type rmmod i2c_tiny_usb to remove it. Also make sure that you run the test application as the root user since the standard user may lack the rights to access all aspects of the i2c_tiny_usb hardware.

The device is not properly detected. Linux reports an error like "device not accepting address" in the system log.
The USB interface is not working at all. Please make sure that the AVR CPU is correctly flashed and that the fuses are set correctly. Another reason may be that the zener diodes are too slow (see next problem).

The device is not properly detected. Linux reports an an error like "device descriptor read/all, error -71" in the system log.
The device is working partly and the USB transfers are unreliable. This is often cauesed by "slow" high current zener diodes. On a previous reichelt list i had those wrong zener types. These slow diodes often seem to have thicker wires than the other parts. You can just try to remove the zener diodes and the device will work if your host PC copes with 5V on the USB data lines. Also using a USB hub between a device without zener diodes and the PC may lead to a working setup. Otherwise you need faster diodes as a replacement (reichelt no "zf 3,6" as on the current reichelt list).

Using the device with a Nokia N800

The i2c_tiny_usb works at various hosts. One of the most interesting ones is the Nokia N800. You need to enable USB host mode capabilities on your N800 to make use of the i2c-tiny-usb.


The demo application (contained in the i2c_tiny_usb archive) can easily be installed on the N800 from the repository using the install button below. Once it's installed it can be run from extras menu. The current version comes with a udev rules file granting user access to the i2c-tiny-usb and thus not requiring root rights anymore. Below is a screenshot of my n800 with a ds1621 equipped i2c-tiny-usb.


The i2c_usb demo application currently supports two I2C client chips, a ds1621 temperature sensor and a pcf8574 parallel port driver (with some LEDs attached to it, so you can see what's happening). Further chips can easily be supported, just use the source above ... Happy hacking with the N800!



Slices ↓
Radiolocman facebook Radiolocman twitter Radiolocman google plus