Denver
Offline
God Member
Karma: 19
Posts: 776
Inactive - PM
|
 |
« Reply #15 on: April 02, 2011, 05:22:25 pm » |
Is there any fundamental reason why this would not work on attiny85? I don't think there is. It was just a bit over my head so I didn't take the time to do it. If you add those, let me know and I'll update the libs I put on the Playground.
|
|
|
|
|
Logged
|
"Data is not information, information is not knowledge, knowledge is not understanding, understanding is not wisdom." ~ Clifford Stoll
|
|
|
|
Australia
Offline
Jr. Member
Karma: 0
Posts: 61
|
 |
« Reply #16 on: February 21, 2012, 04:57:59 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Denver
Offline
God Member
Karma: 19
Posts: 776
Inactive - PM
|
 |
« Reply #17 on: February 21, 2012, 11:24:24 pm » |
You set the slave address in your sketch with the .begin -
#define I2C_SLAVE_ADDR 0x26 // i2c slave address (38) TinyWireS.begin(I2C_SLAVE_ADDR); // init I2C Slave mode
|
|
|
|
|
Logged
|
"Data is not information, information is not knowledge, knowledge is not understanding, understanding is not wisdom." ~ Clifford Stoll
|
|
|
|
Australia
Offline
Jr. Member
Karma: 0
Posts: 61
|
 |
« Reply #18 on: February 21, 2012, 11:51:33 pm » |
Thanks. I was actually most of the way through determining it for myself  For anyone interested in I2C for the attiny and other atmel AVR mc's the atmel here's what I've found. The atmel application notes can be found here http://www.atmel.com/products/microcontrollers/avr/tinyAVR.aspx?tab=documentsScroll 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)
|
|
|
|
« Last Edit: February 22, 2012, 12:18:14 am by m12lrpv »
|
Logged
|
|
|
|
|
Denver
Offline
God Member
Karma: 19
Posts: 776
Inactive - PM
|
 |
« Reply #19 on: February 22, 2012, 12:32:04 am » |
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.
|
|
|
|
|
Logged
|
"Data is not information, information is not knowledge, knowledge is not understanding, understanding is not wisdom." ~ Clifford Stoll
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 3
|
 |
« Reply #20 on: April 10, 2012, 07:45:05 am » |
Hello,
Do you know if the TinyWire library also supports the ATtiny84? Thank you very much.
Pedro Santos
|
|
|
|
|
Logged
|
|
|
|
|
Down Under (Australia), SA
Offline
Jr. Member
Karma: 0
Posts: 55
Newbie is an understatement
|
 |
« Reply #21 on: May 02, 2012, 02:05:28 am » |
i want to use the DS1307 with the attiny85 but i cant understand the example you provided. can you tell me how i can get the seconds, minutes and hours in to individual integers.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 64
|
 |
« Reply #22 on: May 02, 2012, 06:18:33 am » |
Do you know if the TinyWire library also supports the ATtiny84? Thank you very much.
Yes, I have had success running on an ATtiny84.
|
|
|
|
|
Logged
|
|
|
|
|
Australia
Offline
Jr. Member
Karma: 0
Posts: 61
|
 |
« Reply #23 on: May 02, 2012, 06:41:19 am » |
i want to use the DS1307 with the attiny85 but i cant understand the example you provided. can you tell me how i can get the seconds, minutes and hours in to individual integers.
Attached is the code I use to connect the DS1307 and a dfrobot I2C LCD to the attiny85 at 8mhz internal. 10k pullups on the SDA and SCL lines. The base DS1307 code I got from tronixstuff. My liquidcrystal I2C library is modified to handle the DFrobot display. Other displays can have significant variations in function so the display part won't work for you straight up.
|
|
|
|
« Last Edit: May 02, 2012, 06:43:48 am by m12lrpv »
|
Logged
|
|
|
|
|
Down Under (Australia), SA
Offline
Jr. Member
Karma: 0
Posts: 55
Newbie is an understatement
|
 |
« Reply #24 on: May 12, 2012, 03:33:23 am » |
hey when verifying the example code i get this error "C:\Users\Owner\Documents\Arduino\libraries\TinyWireM\USI_TWI_Master.cpp:329: error: 'USIPF' was not declared in this scope"
how do i fix this and what do i need to change to run it at 8MHz
|
|
|
|
|
Logged
|
|
|
|
|
Australia
Offline
Jr. Member
Karma: 0
Posts: 61
|
 |
« Reply #25 on: May 12, 2012, 03:50:27 am » |
There's a good chance you have arduino version issues and attiny core issues. The reference you're missing is in the following file in my arduino environment. \hardware\tools\avr\avr\include\avr\iotnx5.h I'm using the http://code.google.com/p/arduino-tiny/ core exclusively now after encountering far too many issues burning fuses and general compiling with the high-low tech core. I also followed coding badly's instructions for updating the AVR core and editing some of the files to get my environment correct first. Subsequently I have a hybrid 0022/1.0 arduino environment. Unfortunately getting the environment correct is the first step. Setting yourself up to burn the fuses to 8mhz is a good first goal. If you can successfully do that you're environment should be right from then on. Search the forum for attiny85 and 8mhz and you'll get there.
|
|
|
|
|
Logged
|
|
|
|
|
Down Under (Australia), SA
Offline
Jr. Member
Karma: 0
Posts: 55
Newbie is an understatement
|
 |
« Reply #26 on: May 12, 2012, 04:05:59 am » |
thanks for the help i will get on to it now.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 2
|
 |
« Reply #27 on: July 06, 2012, 10:35:13 pm » |
I'm using a ATtiny85 using a Arduino Duemilanove as an ISP. The cores i'm using are located here: http://code.google.com/p/arduino-tiny/downloads/detail?name=arduino-tiny-0100-0012.zip ... i believe it's being referred to as the "google" cores. I'm trying to communicate with 4 blinkm's over i2c using a ATtiny85 and the TinyWireM lib. I've already been able to do this using my Arduino to communicate over i2c with these blinkm's with the builtin Wire lib and everything works ... so I know that the blinkm's are functioning properly. My code is here: https://gist.github.com/dae96d4658745cd966ec ... It seems that the "change color" command is making it to the blinkm's but not the "stop script" command. If anyone can help me out that'd be greatly appreciated.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Dallas
Offline
Shannon Member
Karma: 118
Posts: 10153
|
 |
« Reply #28 on: July 07, 2012, 01:38:25 am » |
Do you have pull ups on the I2C lines?
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 2
|
 |
« Reply #29 on: July 07, 2012, 01:49:36 am » |
yes I have a 4.7K on pins 5 and 7. i've also re-fused the attiny85 back to 1mhz instead of 8mhz.
|
|
|
|
« Last Edit: July 07, 2012, 01:52:29 am by heatxsink »
|
Logged
|
|
|
|
|
|