Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wire.h fails #118

Open
aldenkeshap opened this issue Aug 1, 2017 · 4 comments
Open

Wire.h fails #118

aldenkeshap opened this issue Aug 1, 2017 · 4 comments

Comments

@aldenkeshap
Copy link

I am using code similar to this (minus Serial). All other tests have worked. The error message I get is quite long, but it is here.

@Ted-CAcert
Copy link

Just ran into the same problem.

From what I found out, the ATtiny (at least the x5 variants, I don't know the x4 ones) supports TWI but implementation is quite different from the other AVR chips. While ATmega chips support a dedicated TWI module, ATtiny has a "Universal Serial interface" (USI), which can be used to implement TWI and SPI interfaces (and other things).

ATmega TWI and ATtiny USI use different registers, so the Wire library will fail to compile for ATtiny.

To me it looks like the low level part of the Wire library (twi.c and twi.h) would have to be re-implemented to support ATtiny.

@Ted-CAcert
Copy link

Ted-CAcert commented Aug 2, 2017

After looking a bit more I found http://playground.arduino.cc/Code/USIi2c

There are several related repositories on GitHub, like https://github.com/adafruit/TinyWireM and https://github.com/rambo/TinyWire and several more. At this point I don't have an idea about which one is suited for which purpose.

Another options seems to be the USIWire library https://github.com/puuu/USIWire which is part of the 1.8.3 IDE installation package.

@Ted-CAcert
Copy link

FYI: The USIWire library worked well for my project, which has to fetch data from an Si7021 humidity sensor.

@himijendrix24
Copy link

I just tried the adafruit TinyWireM library to use an attiny85 as a i2c-master and it did not work.
No compile-errors, but connection to slave never worked.

In the end i got it running by just changing this newer core:
https://github.com/SpenceKonde/ATTinyCore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants