Pages: [1]   Go Down
Author Topic: Connect Attiny85 to a Raspberry PI via I2C problem  (Read 1355 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 22
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am currently trying to connect an Attiny85 to a Raspberry PI via I2C. The I2C circuit is level shifted via two Mosfets (I need the Attiny to run at 5V).

The sketch is based on the TinyWireS library that can be found at: http://playground.arduino.cc/Code/USIi2c

I use the MIT Attiny85 Core that supports the Arduino IDE on the Attiny85 (http://hlt.media.mit.edu/?p=1695)

My problem is that my Sketch, or any other example sketch that uses I2C is giving  a very unstable I2C bus. My other I2C devices, a display for example, cannot always be reached. I first thought that my level shifters were not good, but I have other 5V I2C devices connected that work.

I tried a "normal" Arduino as a replacement for the Attiny85 and then it all works.

I know that this is a rare setup; but does this ring a bell to anyone here? Thanks in advance.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Did you try reducing the I2C bus speed on the Raspberry Pi? Running at the default of 100 KHz I found that communicating from the Raspberry Pi to the ATtiny85 running at 1MHz was not reliable (spurious flipped bits) until I reduced the bus speed to 32 KHz. You might also try increasing the ATtiny85 clock speed.

Code:
cat /sys/module/i2c_bcm2708/parameters/baudrate
echo 32000 > /sys/module/i2c_bcm2708/parameters/baudrate
Logged

Pages: [1]   Go Up
Jump to: