I gave it a whirl talking (or not, heh) to a AD5171 digital cap, I didn't get any output from pin5 or pin7 on the attiny, though I discovered when i was hooking it up that the closest to 4.7k resistors I had was 3.9k.
I'm going to spend some more time with it later on today hopefully, I'd be very, very pleased if I can get it to work as I was going to have to work out a way to bitbang it, which is rather over my head!
I think 3.9K is close enough. (They are pull ups right?)
So I'll assume . . .
your using the I2C master lib (TinyWireM)
it compiles and loads to the ATtiny fine
you have an LED on one of the other pins showing the sketch started
you put a scope on pin 5 (SDA) and pin 7 (SCL) and saw nothing
Humph, as you can see in the examples that come with the lib, as a master, I had it talking to an I2C temp sensor, RTC and a GPIO.
The AD5171 looks like a straight forward chip to interface to.
What ATtiny core files are you using?
I've only been using those from "high-low tech", and loading with the ArduinoISP or the USBtinyISP.
I haven't done the scope yet, I'm going to take it to work on monday and do that. Got some 4.7k resistors for good measure.
The attiny core files are one generation old now, I need to update. That might be the problem right there.
I'll update the core files and check it out on the scope and post back after that.
The "hlt" core works fine and it's simpler in some ways - a lot less going on in boards.txt. If you don't like that core for some reason, I still suggest you try it first - you can always go back to the other after you see everything working.
After changing boards.txt to upload with the USBtinyISP I found that the TinyWireM lib worked with those cores.
However, the sketch was running 10X slower - even the Blink sketch. :.
So I changed the speed in boards.txt from f_cpu=800000L to f_cpu=1000000L and now it works fine.
I don't know why one set of cores uses an 8MHz clock and another set uses a 10MHz clock.
Could have been 8X could have been 10X I didn't put a stopwatch on it. It was at least 8X. It is a critical difference for making a determination?
800K is nowhere to be found in boards.txt. Was it an 8M entry you changed?
Ya got me! I dropped a 0 during the post. I changed it from 8MHz to 10MHz as I stated.
As you know boards.txt in google code core is set for 8MHz.
Are the target processor's fuses set to run at 1 MHz? Or 8 MHz?
I suggest you look at the google code boards.txt and answer that yourself. I made no changes.
The HIT core uses a 10 MHz clock?
That's what I said. You can download the HIT core and verify that if you wish.
In the google code site for the core you asked if someone would verify if these libraries would work with that core.
This is what I've done, and this is, I guess, my thanks.
Kinda busting my chops on this aren't you?
This is what I've done, and this is, I guess, my thanks.
I do apologize for upsetting you. That was not my intention. I'm simply trying to determine if there is a problem with either core or if there is a misunderstanding on how either of them should work. I simply don't want another user to have the same problems that you've just had. Both cores should be simple to install and easy to use. I promise to refrain from any further communication.
For what it's worth, I appreciate your efforts and thank you for your time.
Well, I was wrong! Adamant, but wrong.
I was posting instead of sleeping, and between cut & paste and counting zeros, I screwed up.
boards.txt for HIT core is set for 1MHz.
boards.txt for "google code" core is set for 8MHz.
(It also sets fuses which sets the internal clock speed.)
Nonetheless, when I used the "google code" core, Blink ran 8X slower.
When I changed it from f_cpu=8000000L to f_cpu=1000000L it ran normally.
Reloading again with the HIT core it continued to run normally.
It looks like the fuse settings in boards.txt for "google code" aren't getting set for some reason.
That's all I know. Sorry about the confusion.
In any case, the ATtiny I2C libs work with either core.
boards.txt for "google code" core is set for 8MHz.
(It also sets fuses which sets the internal clock speed.)
It looks like the fuse settings in boards.txt for "google code" aren't getting set for some reason.
Ah! In order to change the fuse settings you have to select "ATtiny85 @ 8 MHz" then execute "Burn Bootloader". "Burn Bootloader" is also a nice way to clean the slate when switching to another project or putting a processor into storage. In addition to changing the fuse settings an empty do nothing Sketch is uploaded.
Well, I was wrong! Adamant, but wrong.
I was posting instead of sleeping, and between cut & paste and counting zeros, I screwed up.
The moral of the story is ... friends don't let friends play with Arduinos when sleep deprived?
boards.txt for HIT core is set for 1MHz.
The "google code" should also have a "ATtiny85 @ 1 MHz" option. It should be almost identical in behaviour to the HIT core.
In any case, the ATtiny I2C libs work with either core.
select "ATtiny85 @ 8 MHz" then execute "Burn Bootloader".
Ive tried that, but I get errors. (Perhaps it's best I PM you on them, or start another thread.)
In any case, I managed to set the fuses properly using Avrdude. (Every evening this week I found myself being drawn deeper and deeper into the dark side. ) So now I am able to test the libs with both cores at both 1MHz and 8MHz.
Sorry it took me so long to get back to you, it's been a hectic week around here.
I got all set up with the scope this morning and the 4.9k resistor pull-ups, and the scope picture was perfect so I plugged in the digipot (which controls a fan pwm controller) and it worked perfectly too!
So either A) 3.9k resistor pull-ups do not work, or B) I didn't have them all the way inserted into the breadboard.
In any case, you code is working perfectly for me, thanks! (I made no changes in software/firmware/sketch/etc)
Sorry if I cause you mental issues with my screwup!
Blink seems to be running the right speed for me, for whatever that is worth.
I'm going to give this a try with attiny85 as i2c slave. Has anyone tried to implement onReceive and onRequest? Is there any fundamental reason why this would not work on attiny85?
Posting in this old thread because this is the google top entry for attiny85 i2c and the question is relevant.
Does anyone know how to change the slave address for an Attiny?
The default appears to be 0x26 from the TinyWireS library code but i've been looking in the attiny85 datasheet and cannot find where it's specified nor how to change it (because I don't know what to look for).
I want to change it to allow me to connect to two (or more) Attiny85's.
Scroll down and look for Application notes AVR310, AVR311, AVR312 and AVR315 and have a read. It's in here that I found the specification for the pullups, the C commands and process flow diagrams.
My determination is that to connect to multiple attiny85 slaves you skip the define and specify the address you want in the TinyWireS object begin method calls for each attiny you want to slave (or use multiple defines).
From what I could determine there is no default address, it's all in the initialisation (the begin function)
My determination is that to connect to multiple attiny85 slaves you skip the define and specify the address you want in the TinyWireS object begin method calls for each attiny you want to slave (or use multiple defines).
From what I could determine there is no default address, it's all in the initialisation (the begin function)
Ah yea. It looks like what you determined pretty much agrees with my post above. That's nice.