Arduino Forum

Forum 2005-2010 (read only) => Hardware => Development => Topic started by: macsimski on May 25, 2010, 10:49 pm

Title: ATTiny85 port (work in progress)
Post by: macsimski on May 25, 2010, 10:49 pm
I wanted a very small arduino type chip and foud out about a soic version of the attiny85v. My aim is a chip with a pull-up resistor to the reset pin. so a internal clock on 8Mhz. the fuse settings reflect this. here is my attempt at a altered hardware folder for the arduino ide. of course you cannot use the normal upload procedure and have to use icsp to program the chip because the attiny does not have a hardware UART.

unfortunately i have had no time yet to test the files, but here is wat i deduced by looking at the original atmega168 pdf and the pins_arduino.c and pins_arduino.h files and a very good explanation of the workings from here:
http://www.urbanhonking.com/ideasfordozens/2009/05/an_tour_of_the_arduino_interna.html

So this is the changed pins_arduino.c file:

Code: [Select]

/*
 pins_arduino.c - pin definitions for the Arduino board
 Part of Arduino / Wiring Lite

 Copyright (c) 2005 David A. Mellis

 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
 License as published by the Free Software Foundation; either
 version 2.1 of the License, or (at your option) any later version.

 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General
 Public License along with this library; if not, write to the
 Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 Boston, MA  02111-1307  USA

 $Id: pins_arduino.c 254 2007-04-20 23:17:38Z mellis $
 adapted to ATTiny85 2010-05-25 22:19:10 by swc
*/

#include <avr/io.h>
#include "wiring_private.h"
#include "pins_arduino.h"

// On the Sanguino board, digital pins are also used
// for the analog output (software PWM).  Analog input
// pins are a separate set.

// ATMEL ATTINY85
//
//                  +-\/-+
//            PB5  1|    |8  VCC
//     (AI 3) PB3  2|    |7  PB2 (AI 1)
//     (AI 2) PB4  3|    |6  PB1 PWM
//            GND  4|    |5  PB0 PWM
//                  +----+

#define PB 1


// these arrays map port names (e.g. port B) to the
// appropriate addresses for various functions (e.g. reading
// and writing)
const uint8_t PROGMEM port_to_mode_PGM[] =
{
     NOT_A_PORT,
   &DDRB,
};

const uint8_t PROGMEM port_to_output_PGM[] =
{
     NOT_A_PORT,
     &PORTB,
};

const uint8_t PROGMEM port_to_input_PGM[] =
{
     NOT_A_PORT,
     &PINB,
};

const uint8_t PROGMEM digital_pin_to_port_PGM[] =
{
     PB, /* 0 */
     PB,
     PB,
     PB,
     PB,
};

const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] =
{
     _BV(0), /* 0, port B */
     _BV(1),
     _BV(2),
     _BV(3),
     _BV(4),
};

const uint8_t PROGMEM digital_pin_to_timer_PGM[] =
{
     TIMER0A,       /* 0  - PB0 */
     TIMER1A,       /* 1  - PB1 */
     NOT_ON_TIMER,       /* 2  - PB2 */
     TIMER1B,           /* 3  - PB3 */
     TIMER1B,             /* 4  - PB4 */
};

and this the boards.txt file

Code: [Select]
##############################################################

attiny85.name=attiny85

attiny85.upload.using=avrispmk2

attiny85.upload.maximum_size=8190
attiny85.upload.speed=38400
attiny85.bootloader.low_fuses=0xE2
attiny85.bootloader.high_fuses=0xDF
attiny85.bootloader.extended_fuses=0xFF
attiny85.bootloader.path=attiny85v
attiny85.bootloader.file=attiny85v
attiny85.bootloader.unlock_bits=0x3F
attiny85.bootloader.lock_bits=0x0F
attiny85.build.mcu=attiny85v
attiny85.build.f_cpu=8000000L
attiny85.build.core=arduino


of course i should make one for the attiny13 as well


I have not done the analog mapping in wiring_analog.c yet. first i have to find out how that works. same with pwm. maybe the attiny2313 port wil clarify it.

remember, this code is not tested yet, but pure to see if I missed something. i encourage everybody to post comments and improve on this.

*update added
Code: [Select]
attiny85.upload.using=avrispmk2 to the boards.txt file. and removed
Code: [Select]
attiny85.upload.protocol=stk500
Title: Re: ATTiny85 port (work in progress)
Post by: Coding Badly on May 25, 2010, 11:21 pm

Are you able to upload using the IDE?
Title: Re: ATTiny85 port (work in progress)
Post by: dpharris on May 26, 2010, 01:44 am
How did you find the http://www.urbanhonking.com/ideasfordozens/2009/05/an_tour_of_the_arduino_intern... , it is dead for me, and the Way-back machine says the last update on that site was in 2008 !?

Thanks, David
Title: Re: ATTiny85 port (work in progress)
Post by: Coding Badly on May 26, 2010, 02:06 am
@dpharris:

Did you click the link or copy-and-paste it?  It looks like the forum software truncated the URL and placed an ellipses on the end.
Title: Re: ATTiny85 port (work in progress)
Post by: macsimski on May 26, 2010, 08:09 am
@dpharris: sorry. url was not complete. now it is. please reload this page and click the link

@coding badly: no no upload due to missing uart(serial input) on the attiny
Title: Re: ATTiny85 port (work in progress)
Post by: Coding Badly on May 26, 2010, 08:41 am

I believe we're talking past each other.  Let me try again...

I think it's possible to get the IDE to upload using an ICSP.  I tried with an ATtiny84 using IDE version 0017.  It doesn't work.  I think the problem has something to do with the processor name.  I believe Rene Bohne got something similar to work but he had to modify and rebuild the IDE.

Have you tried uploading a Sketch to an ATtiny85 through an ICSP using the IDE?  Or do you upload Sketches from the command-line?
Title: Re: ATTiny85 port (work in progress)
Post by: borref on May 26, 2010, 09:26 am
I believe I've had the Arduino IDE working with direct upload for both AtTiny84 and AtTiny85 at some point.

If my memory serves me right, one issue was with Arduino constructing a mcu identifier not recognized by Avrdude. Knowing the identifier created by Arduino however, you can easily patch the avrdude.conf file to fix the "unknown part" issue.
Title: Re: ATTiny85 port (work in progress)
Post by: macsimski on May 26, 2010, 09:34 am
no, i never tried. will keep you posted.
Title: Re: ATTiny85 port (work in progress)
Post by: Coding Badly on May 26, 2010, 10:11 am
Quote
If my memory serves me right, one issue was with Arduino constructing a mcu identifier not recognized by Avrdude.

That's the problem!

Quote
Knowing the identifier created by Arduino however, you can easily patch the avrdude.conf file to fix the "unknown part" issue.

Add an entry for "m84" (or "m85")?
Title: Re: ATTiny85 port (work in progress)
Post by: borref on May 26, 2010, 11:05 am
Quote
Add an entry for "m84" (or "m85")?

I don't have my notes to verify against, but I believe this is correct (avrdude expects "t84"). There was also some tossing of ideas to patch the IDE to help with this, but I don't remember seeing anything from that make it to 0018.

Anyhow it should be possible to upload from within the IDE and even with an all empty core you're quickly up and running without having to learn new tools.
Title: Re: ATTiny85 port (work in progress)
Post by: Coding Badly on May 26, 2010, 04:29 pm

Nice!  Thank you!

I'll play around with it when I get back from vacation and report what I find (but I suspect macsimski will be reporting back much sooner).
Title: Re: ATTiny85 port (work in progress)
Post by: Osgeld on May 26, 2010, 04:37 pm
I have the same issue in 17 with my 84, it always comes back invalid part m84, I was getting around to that question just have not yet

NOW that that is resolved, when doing the exact same thing in 18 it always comes back with a not in sync error, even though the 2 are setup identically
Title: Re: ATTiny85 port (work in progress)
Post by: macsimski on May 26, 2010, 05:18 pm
Well. I finally had some time to look into the stuff. it looks promising, but i was yelling to early.  >:(
A lot of files in the core directory need to be changed to get the things working. with the above files and a bare minimum sketch i get a  compile error. after removing the v behind attiny85v that was changed into acompile error in WInterrupts.c complaining that EICRA was not defined. this is true because this is not a atmega8:

Code: [Select]
#if defined(__AVR_ATmega8__)
#define EICRA MCUCR
#define EIMSK GICR
#endif


[/code]
so there is something wrong with:


#if !defined(__AVR_ATmega8__)


but i have not found the place where that would be defined. a folder search in the core dir did not yield a file.
Title: Re: ATTiny85 port (work in progress)
Post by: wyager on May 26, 2010, 07:57 pm
I got an error when I tried to compile, I forget what it was but I'll tell you later. Would this work on an attiny45 too?
Title: Re: ATTiny85 port (work in progress)
Post by: Coding Badly on May 26, 2010, 08:48 pm
Quote
so there is something wrong with:
#if !defined(__AVR_ATmega8__)
but i have not found the place where that would be defined

__AVR_ATmega8__ is defined by the compiler from the mmcu option which the Arduino IDE gets from boards.txt (Whew!  That sentence overran.) ...

http://www.nongnu.org/avr-libc/user-manual/using_tools.html

For an ATtiny85 or ATtiny85V __AVR_ATtiny85__ is defined (but not __AVR_ATmega8__).
Title: Re: ATTiny85 port (work in progress)
Post by: macsimski on May 26, 2010, 09:23 pm
Ok. that makes sense. i think i can do without special cases and make the whole cores files attiny85 only. I get the feeling that the #if defined is only needed to make one cores dir for a few very similar AVR's. maybe later someone can add the special cases for a attiny84.

I was incorporating the latest developements into the first post but i'm a little ambivalent about it. of course it is nice to have the latest version available, but it could happen that someones comment becomes obsolete. that is confusing at the least...

i will not do that again.

Title: Re: ATTiny85 port (work in progress)
Post by: macsimski on May 26, 2010, 10:37 pm
This is fun! i now have the following files open on my mac:

attiny85.pdf
atmega8a.pdf
atmega168.pdf

arduino with a bare minimum sketch (so only setup() and loop() are there)

and bbedit for the editing of my source files.

I hit run in arduino and look at the lines of errors i get.

Code: [Select]
../Attiny85/cores/arduino/wiring_analog.c: In function 'analogWrite':

../Attiny85/cores/arduino/wiring_analog.c:86: error: 'TIMER1A' undeclared (first use in this function)

../Attiny85/cores/arduino/wiring_analog.c:86: error: (Each undeclared identifier is reported only once

../Attiny85/cores/arduino/wiring_analog.c:86: error: for each function it appears in.)

../Attiny85/cores/arduino/wiring_analog.c:88: error: 'TCCR1A' undeclared (first use in this function)

../Attiny85/cores/arduino/wiring_analog.c:91: error: 'TIMER1B' undeclared (first use in this function)


in this order i lookup all the acronyms like TIMER1Ain the atmega168 pdf and find out what they do. then i lookup the same function in the attiny85.pdf and change the according cores file.

a lot of work, but is not to difficult.
Title: Re: ATTiny85 port (work in progress)
Post by: Osgeld on May 26, 2010, 10:57 pm
heh, god bless the search box
Title: Re: ATTiny85 port (work in progress)
Post by: macsimski on May 26, 2010, 11:32 pm
and the find of bbedit is fabulous!
pfew. i'm half way through the files. have to call it a night now. maybe tomorrow more.

i had to guess with the timers because obviously the attiny has less of them. well we will find out later.
Title: Re: ATTiny85 port (work in progress)
Post by: Osgeld on May 27, 2010, 01:16 am
well I know I appreciate the work people put into porting the arduino functionality to these tiny chips

and even though I dont have a application where a 85 would fit in, I know it probably wont be long before I do

Thanks for your efforts, and keep up the good work
Title: Re: ATTiny85 port (work in progress)
Post by: smspencer on May 27, 2010, 11:20 am
And of course, there's always the other extreme -- I'm currently working on a 1284 port, now I have my hands on a few 1284P DIPs.

Of course, the 644 port helps, but there are other differences apart from FLASH size and RAM.
Title: Re: ATTiny85 port (work in progress)
Post by: macsimski on May 27, 2010, 08:36 pm
well. i got a compile without errors now, but i had to disable some functions in tone.cpp and others because i lack the time to do it propperly. it means digging in the amount of timers and their functions. the tiny has less timers so it could get crowded.

next thing is actually uploading the sketch to the little beast and see if it works. unfortunate all my breadboards are at my workplace tonight.  >:( Ohh well maybe I start reading into the workings of the timers and how they are used in the arduino...

I would not dare upload the unfinished cores before i have proof of its functionality. so please be patient.
Title: Re: ATTiny85 port (work in progress)
Post by: macsimski on May 27, 2010, 09:47 pm
:) :) :)

of course i let myself not ne hampered by missing hardware. that is what a junk box is for.

i needed to change a  thing to the boards.txt file:

Quote
attiny85.upload.using=avrispmk2


was wrong. it should be
Quote
attiny85.upload.using=avrispmkii


and after successfully uploading the blink sketch the led blinked 8 times to slow. this with a virgin attiny85. that is set from the fatory @ 1Mhz so i had to flash the fuses with
Code: [Select]
avrdude -c avrispmkII -P usb -p attiny85 -U hfuse:w:0xDF:m -U lfuse:w:0xE2:m

then it works.

so the main production stream is smooth now. next step will be trying several procedures like pwm and analog in...
Title: Re: ATTiny85 port (work in progress)
Post by: macsimski on May 27, 2010, 10:00 pm
Ok. so with pwm i get some errors in the

Arduino-0018.app/Contents/Resources/Java/libraries/Servo/Servo.cpp

file.

It can't find  TCCR1A declared. Hmm. that was something i did'nt have time to look into. is there someone with timer knowledge around to help me out?
Title: Re: ATTiny85 port (work in progress)
Post by: TheMakersWorkbench on May 28, 2010, 02:19 pm
Nice! I am keeping my eye on this.
Title: Re: ATTiny85 port (work in progress)
Post by: billroy on May 28, 2010, 03:46 pm
I have a Tiny85 version of Bitlash here that's not ready for release, but I'm happy to share the arduino hardware interface code, including serial tx/rx, pwm on one timer, and analog input handling:

http://bitlash.net/wiki/_media/bitlash-hardware-attiny85.c

Caveat: this is collated from several bits of work-in-progress and I can't testify it even compiles.  But it may help with this excellent project.

Good luck.  Happy to answer questions.

-br
http://bitlash.net
http://entropymouse.com
Title: Re: ATTiny85 port (work in progress)
Post by: wyager on May 29, 2010, 01:30 am
Why would this work on the tiny85 and not the 45? I don't want the bootloader or anything, so 4k should be fine.... Or am I missing something?
Title: Re: ATTiny85 port (work in progress)
Post by: macsimski on May 29, 2010, 11:30 am
did someone say it doesnt work on a attiny45?
Title: Re: ATTiny85 port (work in progress)
Post by: Martin Gerken on May 29, 2010, 05:29 pm
What's the smallest ATtiny that works? Even the ATtiny13(A)?
Title: Re: ATTiny85 port (work in progress)
Post by: macsimski on May 29, 2010, 05:48 pm
the 13a has the same footprint as a tiny85. specs are different. less ram, eeprom or flash. it should be doable, but after finding the tiny85 more worthwile i abandoned the 13a. i choose the tiny because of its physical size. the soic-8 is just 7.7 x 5.5 x 1.5 mm and with a internal rc clock you only need one external resistor to make it run.
Title: Re: ATTiny85 port (work in progress)
Post by: wyager on May 29, 2010, 08:43 pm
I just hadn't seen anybody mention anything about stuff besides the attiny85. I'll try harder to get this working later.

EDIT:
I got rid of some errors by changing simple stuff (like trying to identify the chip as attiny85v and not attiny85). Now I get
Code: [Select]
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/pins_arduino.c:49: error: conflicting types for 'port_to_mode_PGM'

/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/pins_arduino.h:54: error: previous declaration of 'port_to_mode_PGM' was here

/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/pins_arduino.c:55: error: conflicting types for 'port_to_output_PGM'

/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/pins_arduino.h:56: error: previous declaration of 'port_to_output_PGM' was here

/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/pins_arduino.c:61: error: conflicting types for 'port_to_input_PGM'

/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/pins_arduino.h:55: error: previous declaration of 'port_to_input_PGM' was here


Have you gotten around this yet?
Title: Re: ATTiny85 port (work in progress)
Post by: Ro-Bot-X on May 31, 2010, 12:11 am
I want to use a Tiny45 for a tiny robot that uses 3 servos and 2 LDR sensors. For that I need the analog conversion to work and perhaps software servo, or I guess I'll just generate the servo pulses in my code, because the Servo library uses Timer1 that is 16bit in the mega, but 8 bit in the tiny. 8 bit PWM does not give a good enough resolution for servos.

So, I need to find out how to make it possible to compile and upload the sketches from the IDE (windows 7). I have tried in the past to port a Tiny861 but failed due to numerous libraries that do not work properly. I will be using a AVR ISP programmer to upload the sketches. Can someone point me what files I need to modify to make this work?

Thank you in advance.
Title: Re: ATTiny85 port (work in progress)
Post by: macsimski on Jun 01, 2010, 07:27 pm
@Wyager: i did'nt have those errors so i cannot tell. at the moment i'm fixing tone.cpp. a lot to do with remapping timers because the attiny heas less. i think i fixed analogread pwm and analogwrite, but still without hardware proof.
Title: Re: ATTiny85 port (work in progress)
Post by: JimEli on Jun 05, 2010, 04:34 pm
attiny85 + avrstudio + avrdude = much less pain.
Title: Re: ATTiny85 port (work in progress)
Post by: Arnonh on Jun 09, 2010, 09:56 pm
have you seen this port
http://sites.google.com/site/elettronicaarduinoesperimenti/Home/arduino-ide-and-attiny45
it should be vary similar to this one
Title: Re: ATTiny85 port (work in progress)
Post by: wyager on Jun 10, 2010, 02:47 am
That last one there worked for me, it was very simple to change boards.txt. I have to actually try putting it on the chip though, I only compiled. Another thing is that the size of the arduino sketch is HUGE compared to the same program in avr-c, like 700 bytes vs probably under 100. Still, it could be useful.
Title: Re: ATTiny85 port (work in progress)
Post by: macsimski on Jun 11, 2010, 09:26 pm
well it has been really busy last week, so i finally have the time to test some things. blink works, fade works, if only on pin 0. and i upload it directly from the ide with a avrusbmkII. i have to compare my cores with that from the above link to see what are the differences.

the problems still exist with includes to other libraries :-( servo.h does not work (yet!)
Title: Re: ATTiny85 port (work in progress)
Post by: bill2009 on Aug 08, 2010, 11:07 pm
any more progress?  I'm going to give this a go.
Title: Re: ATTiny85 port (work in progress)
Post by: bill2009 on Aug 09, 2010, 08:35 pm
I'm trying this out using the core from http://sites.google.com/site/elettronicaarduinoesperimenti/Home/arduino-ide-and-attiny45

installed in the sketchbook folder
Code: [Select]
What seems to work is
>sketchbook folder
>sketchbook folder\hardware
>sketchbook folder\hardware\arduino
>sketchbook folder\hardware\arduino\boards.txt //attiny85.build.core=attiny85
>sketchbook folder\hardware\arduino\cores
>sketchbook folder\hardware\arduino\cores\WProgram.h
etc...
Title: Re: ATTiny85 port (work in progress)
Post by: bill2009 on Aug 10, 2010, 01:16 am
Whoah, cool.  I have an attiny85 running on the core ref'd above with all digital pins confirmed and software serial talking to the PC.

It's amazing what this community an amateur like me to do.  Thanks to all who've contributed to this.

Next step is to verify the timers for millis etc. and to get INT0 and pin change interrupts working.

I don't need softserial for my final application and i probably can't afford the ram but it's great for debugging.  I'm sure it would work fine at higher baud rates by the way - I was just being chicken.


Code: [Select]
/*
Thanks for the work on the tiny cores
 28-08-2009 for attiny84 R.Wiersma
 09-10-2009 for attiny45 A.Saporetti

// ATMEL ATTINY45 / ARDUINO
//
//                 +-\/-+
// Ain0 (D5) PB5* 1|    |8  Vcc
// Ain3 (D3) PB3  2|    |7  PB2 (D2) Ain1 sck
// Ain2 (D4) PB4  3|    |6  PB1 (D1) pwm1 miso
//           GND  4|    |5  PB0 (D0) pwm0 mosi
//                 +----+
//* Pin 1 is Reset and tied high on my boards
//available digital pins are D0-D4

*/

// include the SoftwareSerial library so you can use its functions:
#include <SoftwareSerial.h>

#define rxPin 0  //ic pin 5
#define txPin 3  // ic pin 2
#define ledPin 4 // IC pin 3

// set up a new serial port
SoftwareSerial mySerial =  SoftwareSerial(rxPin, txPin);

void setup()  {
 // define pin modes for tx, rx, led pins:
 pinMode(rxPin, INPUT);
 pinMode(txPin, OUTPUT);
 pinMode(ledPin, OUTPUT);
 // set the data rate for the SoftwareSerial port
 mySerial.begin(300);
 mySerial.println("Hi!");
 blink(ledPin,7);
}

void loop() {
 mySerial.print("<");
 byte ch=mySerial.read();
 mySerial.print(ch);
 mySerial.print("> ");
 
 // toggle an LED just so you see the thing's alive.  
 blink(ledPin,1);
}



void blink( int pinnum,int count){
 pinMode(pinnum,OUTPUT);
 for (int i=0; i<count; i++){
   digitalWrite(pinnum,HIGH);
   delay(100);
   digitalWrite(pinnum,LOW);
   delay(150);
 }
}

Title: Re: ATTiny85 port (work in progress)
Post by: Coding Badly on Aug 10, 2010, 02:19 am

What programmer are you using?  Or are you using a bootloader?
Title: Re: ATTiny85 port (work in progress)
Post by: bill2009 on Aug 10, 2010, 03:15 am
I have an avr dragon which doesn't work well with the ide so I'm compiling with the ide then using avr studio to drive the dragon for programming.

I think any standard programmer would work, I'm waiting for a pololu programmer to come in the mail.
Title: Re: ATTiny85 port (work in progress)
Post by: Coding Badly on Aug 10, 2010, 05:20 am

This one?
http://www.pololu.com/catalog/product/1300
Title: Re: ATTiny85 port (work in progress)
Post by: bill2009 on Aug 10, 2010, 01:24 pm
yes, that's it.
Title: Re: ATTiny85 port (work in progress)
Post by: bill2009 on Aug 11, 2010, 05:01 pm
ok, as of this morning I have my 8mhz attiny85 running with software serial at 4800 baud, int0 interrupt works, pin change interrupt(from Bill Roy's bitlash code) works fine, and millis() seems accurate.  A million thanks to the contributors.  I'll move on to getting my app working now.  below is my clumsy code for the record.

Code: [Select]
/*
Thanks for the work on the tiny cores
 28-08-2009 for attiny84 R.Wiersma
 09-10-2009 for attiny45 A.Saporetti
and to Bill Roy at bitlash for the pin change interrupt code

// ATMEL ATTINY45 / ARDUINO
//
//                  +-\/-+
// Ain0 (D5) PB5* 1|    |8  Vcc
// Ain3 (D3) PB3  2|    |7  PB2 (D2) Ain1 sck INT0
// Ain2 (D4) PB4  3|    |6  PB1 (D1) pwm1 miso PCINT1
//           GND  4|    |5  PB0 (D0) pwm0 mosi PCINT0
//                 +----+
//* Pin 1 is Reset and tied high on my boards
//available digital pins are D0-D4

*/

// include the SoftwareSerial library so you can use its functions:
#include <SoftwareSerial.h>

#define rxPin 0  //ic pin 5
#define pcint1pin 1 //prog change int pcint on PB1 on IC pin 6
#define txPin 3  // ic pin 2
#define ledPin 4 // ic pin 3
#define int0pin 2 //ic pin 7 - definition not needed - just marking off

int int0cnt=0; //interrupt0 count
int pcint1cnt=0; //program change interrupt 1 count
// set up a new serial port
SoftwareSerial mySerial =  SoftwareSerial(rxPin, txPin);

void setup()  {
 // define pin modes for tx, rx, led pins:
 pinMode(rxPin, INPUT); pinMode(pcint1pin,INPUT); //not really needed
 pinMode(txPin, OUTPUT);
 pinMode(ledPin, OUTPUT);
 attachInterrupt(0, int0monitor, RISING);  //interrupt 0
 // Enable the pin-change interrupt
 PCMSK |= 1<<pcint1pin;      // enable pin change ints on pb1/pcint1/ic 6
 GIMSK |= 1<<PCIE;                  // enable master pin change interrupt
 mySerial.begin(4800); //set baud rate for software serial
 mySerial.println(" "); mySerial.println("Hi!");
 blink(ledPin,7);
}

void loop() {
 mySerial.print("@");
 mySerial.print(millis());
 mySerial.print(">");
 byte ch=mySerial.read();
 mySerial.print(ch);    
 mySerial.print("=");mySerial.print(int(ch));
 mySerial.print(" int0cnt=");
 mySerial.print(int0cnt);
 mySerial.print(" pcint1cnt=");
 mySerial.println(pcint1cnt);
 
 
 // toggle an LED just so you see the thing's alive.  
 blink(ledPin,1);
}
ISR(PCINT0_vect) {
 static unsigned long prevpcint1=0;
 if ((PINB & (1<<pcint1pin))) { //if it's a high on our pin
 if (millis()>(prevpcint1+5)){
   pcint1cnt++;
   prevpcint1=millis();
 }
 }
}  
 


void int0monitor(){
 static unsigned long prevint0=0;
 if (millis()>(prevint0+5)){
   int0cnt++;
   prevint0=millis();
 }
}


void blink( int pinnum,int count){
 pinMode(pinnum,OUTPUT);
 for (int i=0; i<count; i++){
   digitalWrite(pinnum,HIGH);
   delay(100);
   digitalWrite(pinnum,LOW);
   delay(150);
 }
}
Title: Re: ATTiny85 port (work in progress)
Post by: Coding Badly on Aug 13, 2010, 07:19 am

Are you able to upload using the IDE?  With the Pololu programmer?
Title: Re: ATTiny85 port (work in progress)
Post by: Hyperjer on Aug 17, 2010, 04:47 pm
:) I knew my break out board was a good idea

http://jertechonline.com/product_info.php/products_id/30

how functional is the code for the 85 now?
what needs work? I want to jump in and help
Title: Re: ATTiny85 port (work in progress)
Post by: CBX on Aug 19, 2010, 10:33 pm
nice work  ;)

does the servo library work here?
Title: Re: ATTiny85 port (work in progress)
Post by: bill2009 on Aug 29, 2010, 02:06 pm
"Are you able to upload using the IDE?  With the Pololu programmer?"

sorry, the pololu programmer is cute but it doesn't provide +V to the target so I stalled a bit til I rtfm.  I'll post an update today but so far things are great,
Title: Re: ATTiny85 port (work in progress)
Post by: bill2009 on Aug 31, 2010, 04:47 pm
ok, so as of just now I have the attiny85 core working well with the ide driving the pololu programmer.  For the record, my setup looks like the following:
http://sites.google.com/site/elettronicaarduinoesperimenti/Home/arduino-ide-and-attiny45
installed in the sketchbook folder
Code: [Select]
What seems to work is
>sketchbook folder
>sketchbook folder\hardware
>sketchbook folder\hardware\arduino
>sketchbook folder\hardware\arduino\boards.txt //**see below
>sketchbook folder\hardware\arduino\programmers.txt //**see below
>sketchbook folder\hardware\arduino\cores
>sketchbook folder\hardware\arduino\cores\WProgram.h
etc... (the other core files)

Code: [Select]

**Boards.txt contains
attiny85.name=Arduino w ATtiny85  via avrispv2 Aug 31
attiny85.upload.using=avrispv2
attiny85.upload.maximum_size=8192
attiny85.upload.speed=19200
attiny85.bootloader.low_fuses=0xE2
attiny85.bootloader.high_fuses=0xDF
attiny85.bootloader.path= attiny85
attiny85.bootloader.file=ATmegaBOOT.hex
attiny85.bootloader.unlock_bits=0x3F
attiny85.bootloader.lock_bits=0x0F
attiny85.build.mcu=attiny85
attiny85.build.f_cpu=8000000L
attiny85.build.core=attiny85

Code: [Select]

**programmers.txt contains
avrispv2.name=AVR ISP V2 per Bill Aug 31
avrispv2.communication=serial
avrispv2.protocol=stk500v2
avrispv2.speed=19200


note that programmers.txt only exists because boards.txt is in the sketchbook directory.  If you modified the boards.txt in the original arduino directory it would use the programmers.txt from there.

I suspect my description of the setup is still confusing so if anyone has a better way of describing the structure please chime in.

I have not tried analog read/write but I have done all the digital pins, software serial at 4800 baud, native interrupts, and pin change interrupts - everything worked without a hitch. Here's a "blink" sketch as an example:
Code: [Select]

/*Thanks for the work on the tiny cores
 28-08-2009 for attiny84 R.Wiersma
 09-10-2009 for attiny45 A.Saporetti
and to Bill Roy at bitlash for the pin change interrupt code
*/
// ATMEL ATTINY85 / ARDUINO
//
//                  +-\/-+
// Ain0 (D5) PB5* 1|    |8  Vcc
// Ain3 (D3) PB3  2|    |7  PB2 (D2) Ain1 sck INT0
// Ain2 (D4) PB4  3|    |6  PB1 (D1) pwm1 miso PCINT1
//           GND  4|    |5  PB0 (D0) pwm0 mosi PCINT0
//                 +----+
//* Pin 1 is Reset and tied high on my boards
//available digital pins are D0-D4

int ledpin=3; //IC pin 2
void setup(){
 pinMode(ledpin,OUTPUT); //IC pin 2
}
void loop(){
 digitalWrite(ledpin,HIGH);
 delay(250);
 digitalWrite(ledpin,LOW);
 delay(750);
}

Title: Re: ATTiny85 port (work in progress)
Post by: Coding Badly on Aug 31, 2010, 11:23 pm
Quote
I have not tried analog read
...
28-08-2009 for attiny84 R.Wiersma

I believe this is the original core...
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1236434254/94#94

In which case the analog reference constants may be wrong.  I vaguely recall that incorrectly setting the analog reference can lead to a short-circuit.  I suggest carefully reviewing the three constants and, if you have the patience, the source code before connecting anything to the processor.

Beyond knowing that the constants may be wrong, I probably can't provide much help.  But, if you'd like, I'm willing to do what I can.
Title: Re: ATTiny85 port (work in progress)
Post by: Osgeld on Aug 31, 2010, 11:28 pm
looks like I need to order some 85's, keep up the good work bill
Title: Re: ATTiny85 port (work in progress)
Post by: bill2009 on Sep 01, 2010, 12:36 am
Quote
I believe this is the original core...
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1236434254/94#94

In which case the analog reference constants may be wrong.  I vaguely recall that incorrectly setting the analog reference can lead to a short-circuit.  I suggest carefully reviewing the three constants and, if you have the patience, the source code before connecting anything to the processor.


I used that core for the '84 and definitely tried at least some analog pins with no issues.  Is there another name for the analog reference constants?  google draws a blank
Title: Re: ATTiny85 port (work in progress)
Post by: Coding Badly on Sep 01, 2010, 07:51 am

There are four keywords that may help in your searching...
analogReference
INTERNAL
DEFAULT
EXTERNAL

Unfortunately, the last three are extremely generic words.  But it may not matter.  After looking over the datasheets and the header files, I'm starting to remember the details...

These are the analogReference constants from the Arduino core (wiring.h)...

#define INTERNAL 3
#define DEFAULT 1
#define EXTERNAL 0

For the 84/85 processors "3" is reserved (shouldn't be used) so INTERNAL is wrong.  The closest match is "2".  I can't tell for certain but I believe there is supposed to be a capacitor connected to AREF in this mode.

EXTERNAL for the 84/85 processors is "1" not "0".

That leaves DEFAULT.  There isn't an exact match on the 84/85 processors.  The closest is "0" which uses VCC (internally I assume) and the AREF pin becomes a normal digital pin.  I believe this is the power-up default.

In my case, I made certain analogReference was NOT called during initialization so I could use the AREF pin as a normal digital pin.  I believe this also gives the closest matching behaviour to the existing Arduino core.
Title: Re: ATTiny85 port (work in progress)
Post by: bill2009 on Sep 02, 2010, 01:59 am
Ok, I still haven't tried analogRead but I'm not afraid to - I think it's all right.  Looking at wiring_analog.c I find
Code: [Select]
uint8_t analog_reference = DEFAULT;

void analogReference(uint8_t mode)
{
     // can't actually set the register here because the default setting
     // will connect AVCC and the AREF pin, which would cause a short if
     // there's something connected to AREF.
     analog_reference = mode;
}

int analogRead(uint8_t pin)
{
     uint8_t low, high;

     // set the analog reference (high two bits of ADMUX) and select the
     // channel (low 4 bits).  this also sets ADLAR (left-adjust result)
     // to 0 (the default).
//      ADMUX = (analog_reference << 6) | (pin & 0x3f); // more MUX
// sapo per tiny45
     ADMUX = pin & 0x3f;


and looking at the data sheet I see that the hard coded 0x3f set to admux sets the adc to use vcc as a reference and ignore any value set to analogReference.

I also see that we need to add saposoft to the list of those to thank for the attiny45/85 core.
Title: Re: ATTiny85 port (work in progress)
Post by: graynomad on Sep 03, 2010, 06:14 am
Quote
I vaguely recall that incorrectly setting the analog reference can lead to a short-circuit.

I think that when choosing an internal reference it is routed to the AREF pin so you can decouple it, however if you already had say 5v on AREF that would create the "short circuit" when connected to 2.56 or 1.1v
Title: Re: ATTiny85 port (work in progress)
Post by: bill2009 on Sep 03, 2010, 05:22 pm
In the case of the attiny85 port though, the analogRead deliberately forces selection of vcc as the reference so it's safe as long as you don't go poking at the registers directly.

I'm using analogRead now by the way and it's fine.

I've now ported a fairly serious application from the atmega168 to the attiny85.  The circuit board is gratifyingly smaller and less complex.

The major downsides to using the 'tiny are:
1) the timing is a bit off (maybe 3-5%)
2) I can only run softserial at 4800 baud (maybe because of 1).  This may seem like carping but it bogs everything down when debugging to the point where it interferes with other timing.
3) I pretty well have to pop the chip out to re-program it to prevent the target circuit connections from interfering with the programmer and vice-versa.

So the tradeoff is worth it in my mind but the selection of the atmega for the arduino just saves everyone a whole bunch of grief.
Title: Re: ATTiny85 port (work in progress)
Post by: Coding Badly on Sep 05, 2010, 09:25 am
Quote
I'm using analogRead now by the way and it's fine.

Excellent!

Quote
The major downsides to using the 'tiny are:
1) the timing is a bit off (maybe 3-5%)

Are you using a crystal or the internal oscillator?
Title: Re: ATTiny85 port (work in progress)
Post by: graynomad on Sep 05, 2010, 02:01 pm
Quote
I pretty well have to pop the chip out to re-program it to prevent the target circuit connections from interfering with the programmer and vice-versa.

Has anyone built an "emulator" for the 85? By that I mean a small board that muxes the ISP pins so you don't have to remove the chip. I've had one on the drawing board for ages but never got around to building it.
Title: Re: ATTiny85 port (work in progress)
Post by: mellis on Sep 05, 2010, 06:13 pm
BTW, I wrote up a small tutorial on how to use the ATtiny45 / 85 port: http://hlt.media.mit.edu/wiki/pmwiki.php?n=Main.ArduinoATtiny4585
Title: Re: ATTiny85 port (work in progress)
Post by: Fe2o3Fish on Sep 06, 2010, 05:30 am
Sweet!    **THAT** is what I was looking for!  THANK YOU!!!
I 'preciate it!
Title: Re: ATTiny85 port (work in progress)
Post by: Coding Badly on Sep 09, 2010, 05:23 am
Quote
I pretty well have to pop the chip out to re-program it to prevent the target circuit connections from interfering with the programmer and vice-versa.

I have this problem as well.  I know a relay could be used to isolate the processor while it's programmed.  Is there another way?  Something like a TRIAC but for low-voltage DC?
Title: Re: ATTiny85 port (work in progress)
Post by: graynomad on Sep 10, 2010, 05:57 am
I've just done a circuit (on paper only) to do this, it uses a mux chip for the ISP signals and a relay for RST so I can do HV programming as well.

See here for a schematic  http://www.robgray.com\quub\docs\emulator_85.pdf

It's only a first draft but the general idea is that the programming signals come from the right connector (you plug a ribbon cable into the 8-pin socket on an STK500 but can change to make more generic) and another ribbon cable into a socket on the target.

Press a button to program and another to run, but also it should be able to auto detect the RST going low and change over automatically for low-voltage programming.

I'll be offline for the next few days or a week but can answer any questions when I get back.

Rob

Title: Re: ATTiny85 port (work in progress)
Post by: Coding Badly on Sep 10, 2010, 08:58 am

Two quick questions...

1. What is a "SN743257"?  I can't find any reference to it.

2. Which "G6HK2" do you plan to use?  I found dozens of variations.
Title: Re: ATTiny85 port (work in progress)
Post by: foxbat on Sep 16, 2010, 12:36 pm
Thanks very much for your work, it is very helpful. I have one item of feedback. delayMicroseconds() in wiring.c doesn't work with the default chip settings because it assumes an 8Mhz clock. The devices come preset at 1Mhz.
Title: Re: ATTiny85 port (work in progress)
Post by: graynomad on Sep 17, 2010, 04:33 pm
Quote
1. What is a "SN743257"?  I can't find any reference to it.

Full number is sn74cbt3257c from TI.

http://au.farnell.com/texas-instruments/sn74cbt3257cd/logic-mux-demux-fet-4bit-16soic/dp/1741545

Data sheet

http://focus.ti.com/lit/ds/symlink/sn74cbt3257c.pdf

Quote
2. Which "G6HK2" do you plan to use?  I found dozens of variations.

the G6HK-2100 5DC, DPDT latching (typo in schematic which probably didn't help)

http://au.farnell.com/omron-electronic-components/g6hk-2100-5dc/relay-pcb-dpco-latching-5vdc/dp/1181061?Ntt=G6HK-2100+5DC

Data sheet,

http://www.farnell.com/datasheets/13455.pdf

although the above PN (from the Farnel site) doesn't quiet gel with it.
Title: Re: ATTiny85 port (work in progress)
Post by: graynomad on Sep 17, 2010, 05:15 pm
Updated schematic

http://www.robgray.com\quub\docs\emulator_85.pdf

with a few comments.

Note that the P3 and P1 connectors are 10-way IDC headers that connect to 10-way ribbon cable that in turn connect to small IDC10->DIP8 adapter PCBs. AFAIK you can't get 8-pin DIP plugs as used in the fancy emulators. These adaptors should plug into existing DIP8 sockets on both the target and the programmer.

Alternatively P2 is the standard 6-pin AVR ISP header and can be used with any programmer.

If using high-voltage programming with an STK500 to get that extra pin on the 85 P1 would plug into the DIP8 socket on the 500 and a few jumpers have to be run between headers on the 500.

The "controlling ATtiny85" is just a simple way of combining a few logic gates + allowing the possibility of auto detecting the programming.

Title: Re: ATTiny85 port (work in progress)
Post by: ChineseJacklee on Sep 21, 2010, 04:10 pm
Hi Guys,

I am trying to make attiny85 to talk with Arduino via softserial, but I can't get attiny85 to send (tx) data correctly.

The code I have on 85:

// include the SoftwareSerial library so you can use its functions:
#include <SoftwareSerial.h>

#define rxPin 0  //ic pin 5
#define txPin 3  // ic pin 2

// set up a new serial port
SoftwareSerial mySerial =  SoftwareSerial(rxPin, txPin);

void setup()  {
 // define pin modes for tx, rx, led pins:
 pinMode(rxPin, INPUT);
 pinMode(txPin, OUTPUT);
 // set the data rate for the SoftwareSerial port
 mySerial.begin(4800);

}

void loop() {
  mySerial.println("Hi!");
}

The pin 2 (txPin) of attiny85 is directly connect to RX(pin 0) of Arduino. Above code is working for Arduino(send) to Arduino(receive) (I have two Arduinos), but does't work for attiny85(send) to Arduino(receive). Any ideas ?
Title: Re: ATTiny85 port (work in progress)
Post by: Coding Badly on Sep 22, 2010, 09:46 am

Is the '85 running from an external crystal?  Internal oscillator?  Something else?

Do you have access to an oscilliscope?
Title: Re: ATTiny85 port (work in progress)
Post by: ChineseJacklee on Sep 22, 2010, 10:59 am
No, the ATTiny85 uses internal oscillator (I think it is running at 8hz). Does it matter ?
Title: Re: ATTiny85 port (work in progress)
Post by: graynomad on Sep 22, 2010, 11:04 am
Quote
(I think it is running at 8hz). Does it matter ?

If you are trying to talk serial the CPU clock speed matters a lot.
Title: Re: ATTiny85 port (work in progress)
Post by: ChineseJacklee on Sep 22, 2010, 02:36 pm
Hi guys, thanks for your reply. So you think the problem is caused by not having external crystal (so the ATTiny85 runs too slow) ?
Title: Re: ATTiny85 port (work in progress)
Post by: Coding Badly on Sep 22, 2010, 05:37 pm
Quote
So you think the problem is caused by not having external crystal (so the ATTiny85 runs too slow) ?

The problem could be the oscillator.  Atmel guarantees ±10% (tunable to ±1%) accuracy which may be too much for serial communications to work...

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1264584005/8#8

Quote
No, the ATTiny85 uses internal oscillator (I think it is running at 8hz). Does it matter ?

It might.  Which is why I asked if you had access to an oscilliscope.

If you have another '85 processor, try it.  There is very likely some variation.

Or, if you have an external crystal, try running the processor from it.

But, before you do any of that, make certain you've wired everything correctly...

Quote
#define txPin [glow]3[/glow]  // ic pin [glow]2[/glow]
The pin [glow]2[/glow] (txPin) of attiny85
Title: Re: ATTiny85 port (work in progress)
Post by: graynomad on Sep 22, 2010, 05:40 pm
Also check that the /8 fuse is set correctly, you may be running at 1MHz.
Title: Re: ATTiny85 port (work in progress)
Post by: ChineseJacklee on Sep 23, 2010, 03:19 pm
Thank you guys. Can 1mhz  runs ? If answer is no, then why not ? and what is the minim speed ? 8mhz ?
Title: Re: ATTiny85 port (work in progress)
Post by: ChineseJacklee on Sep 23, 2010, 03:26 pm
how can I check and define speed for ATTiny85 ?

I went through bill2009's code on page 3 [glow]http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1274820597/30[/glow] many times, and can't find anywhere defines CPU speed to 8Mhz.

Anyone can help please !

Title: Re: ATTiny85 port (work in progress)
Post by: graynomad on Sep 23, 2010, 03:37 pm
Quote
ok, as of this morning I have my 8mhz attiny85 running with software serial at 4800 baud

post #44

I haven't been following this much but I do know that the 85 can run at 1 or 8MHz and I'm fairly sure it will default to 1 unless you program the fuse differently.

As for finding this in the code I don't think you will, the fuse is set by the programmer.
Title: Re: ATTiny85 port (work in progress)
Post by: foxbat on Sep 26, 2010, 02:26 pm
Quote

how can I check and define speed for ATTiny85 ?

I went through bill2009's code on page 3 http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1274820597/30 many times, and can't find anywhere defines CPU speed to 8Mhz.

Anyone can help please !


The default speed from the factory is 1Mhz. You have to set a fuse bit to change to 8Mhz. Be super careful setting fuse bits on the ATtiny. If you change the one that selects whether the RESET pin is for reset or data then you'll lock yourself out and only a high voltage programmer can get you back.

That said, this the avrdude configuration you need to increase the clock to 8Mhz:

(http://i98.photobucket.com/albums/l264/foxbat_gb/electronics/attiny85Fuses8Mhz.png)

The 'E2' fuse value was calculated by this excellent web page:

http://www.engbedded.com/fusecalc
Title: Re: ATTiny85 port (work in progress)
Post by: bill2009 on Sep 26, 2010, 02:32 pm
Thanks, I had assumed the question was about boards.txt and answwered by pm.  nice calculator link.
Title: Re: ATTiny85 port (work in progress)
Post by: foxbat on Sep 26, 2010, 03:01 pm
There are two more problems I've found that may or may not be an issue for others.

Firstly, the default port of the core code continues to use timer 0 for millis() and micros() timing. The ATtiny has only two timers and they are not equally capable. Timer 0 can do full PWM in the same way as we're used to with the ATmega series. Timer 1 cannot and is the less useful of the two. Therefore it makes more sense to me to move the millis() and micros() timer to timer 1 so that the app can play with timer 0 without messing up the 'clock'.

Secondly, the core code cannot do microsecond delays unless the clock speed is 16 or 8Mhz so the default 1Mhz clock is immediately a problem.

Both of those problems are in wiring.c. I modified my own copy to fix both issues. The timer0 to timer1 move definitely works but I know I'll be off slightly on my fix to delayMicroseconds() due to my lack of knowledge about how many instructions each line of C++ compiles down to. Feedback on that would be appreciated.

Here's the code:

Code: [Select]

/*
 wiring.c - Partial implementation of the Wiring API for the ATmega8.
 Part of Arduino - http://www.arduino.cc/

 Copyright (c) 2005-2006 David A. Mellis

 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
 License as published by the Free Software Foundation; either
 version 2.1 of the License, or (at your option) any later version.

 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General
 Public License along with this library; if not, write to the
 Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 Boston, MA  02111-1307  USA

 $Id: wiring.c 585 2009-05-12 10:55:26Z dmellis $

 Modified 28-08-2009 for attiny84 R.Wiersma
 Modified 14-108-2009 for attiny45 Saposoft
*/

#include "wiring_private.h"

// the prescaler is set so that timer0 ticks every 64 clock cycles, and the
// the overflow handler is called every 256 ticks.
#define MICROSECONDS_PER_TIMER0_OVERFLOW (clockCyclesToMicroseconds(64 * 256))

// the whole number of milliseconds per timer0 overflow
#define MILLIS_INC (MICROSECONDS_PER_TIMER0_OVERFLOW / 1000)

// the fractional number of milliseconds per timer0 overflow. we shift right
// by three to fit these numbers into a byte. (for the clock speeds we care
// about - 8 and 16 MHz - this doesn't lose precision.)
#define FRACT_INC ((MICROSECONDS_PER_TIMER0_OVERFLOW % 1000) >> 3)
#define FRACT_MAX (1000 >> 3)

volatile unsigned long timer0_overflow_count = 0;
volatile unsigned long timer0_millis = 0;
static unsigned char timer0_fract = 0;

//different name, TIMER0_OVF_vect to this
ISR(TIMER1_OVF_vect)
{
     // copy these to local variables so they can be stored in registers
     // (volatile variables must be read from memory on every access)
     unsigned long m = timer0_millis;
     unsigned char f = timer0_fract;

     m += MILLIS_INC;
     f += FRACT_INC;
     if (f >= FRACT_MAX) {
           f -= FRACT_MAX;
           m += 1;
     }

     timer0_fract = f;
     timer0_millis = m;
     timer0_overflow_count++;
}

unsigned long millis()
{
     unsigned long m;
     uint8_t oldSREG = SREG;

     // disable interrupts while we read timer0_millis or we might get an
     // inconsistent value (e.g. in the middle of a write to timer0_millis)
     cli();
     m = timer0_millis;
     SREG = oldSREG;

     return m;
}

unsigned long micros() {
     unsigned long m, t;
     uint8_t oldSREG = SREG;
     
     cli();      
     t = TCNT1;
 
#ifdef TIFR0
     if ((TIFR0 & _BV(TOV0)) && (t == 0))
           t = 256;
#else
     if ((TIFR & _BV(TOV1)) && (t == 0))
           t = 256;
#endif

     m = timer0_overflow_count;
     SREG = oldSREG;
     
     return ((m << 8) + t) * (64 / clockCyclesPerMicrosecond());
}

void delay(unsigned long ms)
{
     unsigned long start = millis();
     
     while (millis() - start <= ms)
           ;
}

/* Delay for the given number of microseconds.  Assumes a 8 or 16 MHz clock.
* Disables interrupts, which will disrupt the millis() function if used
* too frequently. */
void delayMicroseconds(unsigned int us)
{
     uint8_t oldSREG;

     // calling avrlib's delay_us() function with low values (e.g. 1 or
     // 2 microseconds) gives delays longer than desired.
     //delay_us(us);

#if F_CPU >= 16000000L
     // for the 16 MHz clock on most Arduino boards

     // for a one-microsecond delay, simply return.  the overhead
     // of the function call yields a delay of approximately 1 1/8 us.
     if (--us == 0)
           return;

     // the following loop takes a quarter of a microsecond (4 cycles)
     // per iteration, so execute it four times for each microsecond of
     // delay requested.
     us <<= 2;

     // account for the time taken in the preceeding commands.
     us -= 2;
#elif F_CPU == 8000000L
     // for the 8 MHz internal clock on the ATmega168

     // for a one- or two-microsecond delay, simply return.  the overhead of
     // the function calls takes more than two microseconds.  can't just
     // subtract two, since us is unsigned; we'd overflow.
     if (--us == 0)
           return;
     if (--us == 0)
           return;

     // the following loop takes half of a microsecond (4 cycles)
     // per iteration, so execute it twice for each microsecond of
     // delay requested.
     us <<= 1;
   
     // partially compensate for the time taken by the preceeding commands.
     // we can't subtract any more than this or we'd overflow w/ small delays.
     us--;
#elif F_CPU == 1000000L
     // for the 1 MHz internal clock on the ATtiny85

     // for a <16 microsecond delay, simply return.  the overhead of
     // the function calls takes more than 16 microseconds.

     if(us<16)
           return;

     us-=16;

     // the following loop takes 4 microseconds (4 cycles)
     // per iteration, so execute it for a quarter of the delay
     us >>= 2;

     // partially compensate for the time taken by the preceeding commands.
     // we can't subtract any more than this or we'd overflow w/ small delays.
     us--;
#else
#warning MCU speed not supported by delayMicroSeconds()!
#endif

     // disable interrupts, otherwise the timer 0 overflow interrupt that
     // tracks milliseconds will make us delay longer than we want.
     oldSREG = SREG;
     cli();

     // busy wait
     __asm__ __volatile__ (
           "1: sbiw %0,1" "\n\t" // 2 cycles
           "brne 1b" : "=w" (us) : "0" (us) // 2 cycles
     );

     // reenable interrupts.
     SREG = oldSREG;
}

void init()
{
     // this needs to be called before setup() or some functions won't
     // work there
     sei();

// default values for timer 0 (fast pwm)
     
     sbi(TCCR0A, WGM01);
     sbi(TCCR0A, WGM00);

// set timer 0 prescale factor to 64

     sbi(TCCR0B, CS01);
     sbi(TCCR0B, CS00);

// setup timer 1 for the millis() and micros() interrupt because it's
// less likely to be wanted by the application

     sbi(TCCR1, CS12);                        // clk/64
     sbi(TCCR1, CS11);                        // clk/64
     sbi(TCCR1, CS10);                        // clk/64
     sbi(TIMSK, TOIE1);                  // overflow interrupt enable (see handler above)

     // set a2d prescale factor to 128
     // 16 MHz / 128 = 125 KHz, inside the desired 50-200 KHz range.
     // XXX: this will not work properly for other clock speeds, and
     // this code should use F_CPU to determine the prescale factor.
/* added F_CPU prescaler */
#if F_CPU >= 16000000L //128
     sbi(ADCSRA, ADPS2);
     sbi(ADCSRA, ADPS1);
     sbi(ADCSRA, ADPS0);
#elif F_CPU >= 8000000L //64
     sbi(ADCSRA, ADPS2);
     sbi(ADCSRA, ADPS1);
#else                        //8
     sbi(ADCSRA, ADPS1);
     sbi(ADCSRA, ADPS0);
#endif
     // enable a2d conversions
     sbi(ADCSRA, ADEN);
}

Title: Re: ATTiny85 port (work in progress)
Post by: ChineseJacklee on Sep 27, 2010, 02:09 am
Thank you all very much, I think the checking speed of Attiny CPU problem I was asking is defined in the boards.txt.
Title: Re: ATTiny85 port (work in progress)
Post by: ChineseJacklee on Sep 27, 2010, 02:09 am
Actually, I just found out when I use one Arduino with RF(434mhz,http://www.sparkfun.com/commerce/product_info.php?products_id=8946 from sparkfun) together, the softserial does NOT work.

How I connect them is:

1. Arduino pin 2 (Pin 2 is set as Tx in the softserial) to Transmitter model "data in" pin,and
2. Receiver model "data out" pin to the Arduino (the same Arduino as above) pin 3 (Pin 3 is set as Rx in the softserial)

the problems disappear if I user either of following solutions:
1. Removing RF models, so the Pin2 is directly connect with Pin3
2. use standard hardware serial Pins (Pin 0 and Pin 1)

Can anyone help me out please, I spent days on it and still can't work it out !
Title: Re: ATTiny85 port (work in progress)
Post by: moustic on Sep 27, 2010, 08:37 am
I read in another thread that RF modules should not shere the same ground.
Title: Re: ATTiny85 port (work in progress)
Post by: ChineseJacklee on Sep 27, 2010, 09:44 am
The transmitter's ground is connected with Arduino's ground, but the receiver is powered by a separate battery (the receiver's ground is connected with battery's ground). So they are NOT sharing the same ground.

Also, remember if I change to hardware serial Pins, everything works well (the grounds connections is the same with softserial).
Title: Re: ATTiny85 port (work in progress)
Post by: bill2009 on Sep 27, 2010, 01:39 pm
per my PM, check that the software serial is working at the right baud rate by connecting it to your PC.  I assume this is a tiny 85 - right?  Mine will not work at 9600 which could easily be the default for the rf module.


also, the 85 doesn't have hardware serial so you must be switching chips when you try that.
Title: Re: ATTiny85 port (work in progress)
Post by: foxbat on Sep 27, 2010, 10:08 pm
Quote

Actually, I just found out when I use one Arduino with RF(434mhz,http://www.sparkfun.com/commerce/product_info.php?products_id=8946 from sparkfun) together, the softserial does NOT work.

If you have taken a factory fresh ATtiny85 and changed boards.txt to say it runs at 8Mhz without explicitly flashing the corresponding fuse byte then software serial will not work and neither will anything else that relies on timing because your MCU is still running at the factory default of 1MHz.
Title: Re: ATTiny85 port (work in progress)
Post by: foxbat on Sep 27, 2010, 10:24 pm
...and I just checked the source code for SoftwareSerial and it uses delayMicroseconds() which is only implemented for 16Mhz and 8Mhz MCU's as I documented in my previous posts in this thread. So you're going to have to flash your fuses up to 8Mhz (or 16Mhz if you want to use the internal PLL) or help with extending the capability of the library code.
Title: Re: ATTiny85 port (work in progress)
Post by: ChineseJacklee on Sep 28, 2010, 01:55 am
Thank you very much guys! So can I confirm three things please:

1. The softserial will NOT work on 1 mhz unless the delayMiscroseconds() fixed as Andy said in pervious thread.
2. By default, the attiny 85 will run as 1mhz.
3. Changing the speed setting in the boards.txt will NOT automatically change the speed of the CPU, it needs to be set by flashing the corresponding fuse too.

Can someone confirm these please :)
Title: Re: ATTiny85 port (work in progress)
Post by: graynomad on Sep 28, 2010, 02:08 am
1. True
2. True
3. True (AFAIK)
Title: Re: ATTiny85 port (work in progress)
Post by: Osgeld on Sep 28, 2010, 03:34 am
3 true, the boards.txt fuses only get set when you "burn a bootloader"
Title: Re: ATTiny85 port (work in progress)
Post by: cintax on Sep 28, 2010, 06:23 am
Is there a code repository for this project where updated versions of the modified files are available for download?

The files I Have, I got from:

http://hlt.media.mit.edu/wiki/pmwiki.php?n=Main.ArduinoATtiny4585
Title: Re: ATTiny85 port (work in progress)
Post by: ChineseJacklee on Sep 28, 2010, 10:27 am
Does anyone has an explanation on why the Adruino (not ATTiny85)+softserial+RF doesn't work from my pervious question ? Thanks.
Title: Re: ATTiny85 port (work in progress)
Post by: harrod159 on Sep 29, 2010, 04:57 pm
Hi,

I'm trying to get a tiny45 and NSSerial working, i'm getting an error relating to timer0, i assume its because the tiny45 either doesnt have a timer0 or its called something else (it seems to be looking for TIMSK0).

Quote

C:\Program Files (x86)\arduino-0019\libraries\NewSoftSerial\NewSoftSerial.cpp: In static member function 'static void NewSoftSerial::enable_timer0(bool)':
C:\Program Files (x86)\arduino-0019\libraries\NewSoftSerial\NewSoftSerial.cpp:520: error: 'TIMSK0' was not declared in this scope
C:\Program Files (x86)\arduino-0019\libraries\NewSoftSerial\NewSoftSerial.cpp:526: error: 'TIMSK0' was not declared in this scope


I'm going to compare datasheets now and see what i can find.
Title: Re: ATTiny85 port (work in progress)
Post by: harrod159 on Sep 29, 2010, 05:16 pm
Turns out it was easier than i thought.

Because the ATtiny45 only has one timer the register is called TIMSK not TIMSK0. Therefore, if you edit the end of NewSoftSerial.cpp to look like this:

Quote

#if defined(__AVR_ATtiny45__)
   sbi(TIMSK, TOIE0);
#else
   sbi(TIMSK0, TOIE0);
#endif
 else
#if defined(__AVR_ATtiny45__)
   cbi(TIMSK, TOIE0);
#else
   cbi(TIMSK0, TOIE0);
#endif


and recompile it will work. I think you'll probably have to have the 45/85 running at atleast 8MHz though.
Title: Re: ATTiny85 port (work in progress)
Post by: graynomad on Sep 29, 2010, 05:24 pm
@Chinese Jack
Quote
the problems disappear if I user either of following solutions:
1. Removing RF models, so the Pin2 is directly connect with Pin3
2. use standard hardware serial Pins (Pin 0 and Pin 1)


Can you verify that SS is actually talking at the correct bit rate?
Title: Re: ATTiny85 port (work in progress)
Post by: jabshier on Oct 08, 2010, 12:57 am
I am trying to changes the fuses to run at 8MHz.  I am using an Arduino as an ISP (http://hlt.media.mit.edu/wiki/pmwiki.php?n=Main.ArduinoATtiny4585).  Here is my boards.txt
Code: [Select]
attiny45.name=ATtiny45
attiny45.upload.using=arduino:arduinoisp
attiny45.upload.maximum_size=4096
attiny45.build.mcu=attiny45
attiny45.build.f_cpu=1000000L
attiny45.build.core=attiny45_85

attiny85s.name=ATtiny85
attiny85s.upload.using=arduino:arduinoisp
attiny85s.upload.maximum_size=8192
attiny85s.build.mcu=attiny85
attiny85s.build.f_cpu=1000000L
attiny85s.build.core=attiny45_85

attiny85.name=ATtiny85-8MHz
attiny85.upload.using=arduino:arduinoisp
attiny85.upload.maximum_size=8192
attiny85.bootloader.low_fuses=0xE2
attiny85.bootloader.high_fuses=0xDF
attiny85.bootloader.path= attiny85
attiny85.bootloader.file=fake.hex
attiny85.bootloader.unlock_bits=0x3F
attiny85.bootloader.lock_bits=0x0F
attiny85.build.mcu=attiny85
attiny85.build.f_cpu=8000000L
attiny85.build.core=attiny45_85

When I try to burn the bootloader to set the fuses I get the following errors
Code: [Select]
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
avr_read(): error reading address 0x0000
   read operation not supported for memory "lock"
avrdude: failed to read all of lock memory, rc=-2


John Abshier
Title: Re: ATTiny85 port (work in progress)
Post by: Coding Badly on Oct 24, 2010, 02:22 am
@Andy Brown:

Quote
Firstly, the default port of the core code continues to use timer 0 for millis() and micros() timing. The ATtiny has only two timers and they are not equally capable. Timer 0 can do full PWM in the same way as we're used to with the ATmega series. Timer 1 cannot and is the less useful of the two.

In what way is PWM limited when performed from Timer 1?
Title: Re: ATTiny85 port (work in progress)
Post by: Coding Badly on Oct 25, 2010, 07:51 am
@John Abshier:

Quote
When I try to burn the bootloader to set the fuses I get the following errors
Code: [Select]
avr_read(): error reading address 0x0000
   read operation not supported for memory "lock"
avrdude: failed to read all of lock memory, rc=-2


I've run into the same problem.  Did you figure out how to get it to work?
Title: Re: ATTiny85 port (work in progress)
Post by: jabshier on Oct 25, 2010, 05:49 pm
I didn't get it to work.  I borrowed a friends programmer and burnt the fuses with that.

John Abshier
Title: Re: ATTiny85 port (work in progress)
Post by: Coding Badly on Oct 25, 2010, 08:45 pm

As luck would have it, very early this morning I figured out why the "read operation not supported for memory "lock"" error occurs.  There is a section missing from the avrdude.conf file that ships with Arduino.

Code: [Select]
#------------------------------------------------------------
# ATtiny85
#------------------------------------------------------------

part
    id            = "t85";
    desc          = "ATtiny85";

[lots of stuff here not included in this post]

    memory "lock"
        size            = 1;
        write           = "1 0 1 0  1 1 0 0  1 1 1 x  x x x x",
                          "x x x x  x x x x  1 1 i i  i i i i";
[glow]         read            = "0 1 0 1  1 0 0 0  0 0 0 0  0 0 0 0",
                          "0 0 0 0  0 0 0 0  o o o o  o o o o";[/glow]
       min_write_delay = 9000;
       max_write_delay = 9000;
      ;


I copied the section for the ATtiny84.  I have no idea if it is accurate but it seems to work.  I don't have time to verify the change against the latest version of AVRDUDE.
Title: Re: ATTiny85 port (work in progress)
Post by: rj44319 on Nov 04, 2010, 03:35 am
I have been looking at this post and i whent to this web page:
http://hlt.media.mit.edu/wiki/pmwiki.php?n=Main.ArduinoATtiny4585
I followed the instructons to the "T" and when i program the chip it gives me this error  :(...
Code: [Select]

java.lang.NullPointerException
     at processing.app.debug.AvrdudeUploader.getProgrammerCommands(AvrdudeUploader.java:97)
     at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:58)
     at processing.app.Sketch.upload(Sketch.java:1498)
     at processing.app.Sketch.exportApplet(Sketch.java:1465)
     at processing.app.Sketch.exportApplet(Sketch.java:1420)
     at processing.app.Editor$46.run(Editor.java:2219)
     at java.lang.Thread.run(Thread.java:619)

What is this all about?? :-[
Any ideas???
Title: Re: ATTiny85 port (work in progress)
Post by: Coding Badly on Nov 04, 2010, 04:57 am

Which IDE version are you using?

Post your boards.txt file.  Please use code tags.
Title: Re: ATTiny85 port (work in progress)
Post by: rj44319 on Nov 04, 2010, 05:33 am
Arduino v18 IDE
this is the board file in hardware sketch file
Code: [Select]

attiny45.name=ATtiny45
attiny45.upload.using=arduino:arduinoisp
attiny45.upload.maximum_size=4096
attiny45.build.mcu=attiny45
attiny45.build.f_cpu=800000L
attiny45.build.core=attiny45_85

attiny85.name=ATtiny85
attiny85.upload.using=arduino:arduinoisp
attiny85.upload.maximum_size=8192
attiny85.build.mcu=attiny85
attiny85.build.f_cpu=800000L
attiny85.build.core=attiny45_85


I am using the attiny 85v -10PU-ND just for refrence..
I am using the Arduino Duemilanove (w/ 328) for the ISP
I have a ISP (usb tiny ISP) and if i could figure out how to use that with this I think id be better off.)
Title: Re: ATTiny85 port (work in progress)
Post by: Coding Badly on Nov 04, 2010, 10:20 am

Two suggestions...

1. I'm not certain if version 0018 supports Tiny processors.  I know version 0019 does.  If it won't cause problems for you, I suggest installing 0019.

2. Try including the bootloader options in boards.txt...

attiny85.bootloader.low_fuses=0x62
attiny85.bootloader.high_fuses=0xD7
attiny85.bootloader.extended_fuses=0xFF
# attiny85.bootloader.path=empty
# attiny85.bootloader.file=empty85at1.hex
attiny85.bootloader.unlock_bits=0xFF
attiny85.bootloader.lock_bits=0xFF
Title: Re: ATTiny85 port (work in progress)
Post by: rj44319 on Nov 04, 2010, 02:02 pm
By not changing anything i am getting to this point...
Code: [Select]

Binary sketch size: 666 bytes (of a 8192 byte maximum)
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
avrdude: stk500_program_enable(): protocol error, expect=0x14, resp=0x50
avrdude: initialization failed, rc=-1
        Double check connections and try again, or use -F to override
        this check.

avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51


I think this is that reset issue with having to cut that trace to allow it to upload.....
i would like to modify the download setting to the USBtinyISP, any idea how?
Title: Re: ATTiny85 port (work in progress)
Post by: Osgeld on Nov 04, 2010, 02:23 pm
Quote
1. I'm not certain if version 0018 supports Tiny processors.


I use 18 with your 84 core, works fine
Title: Re: ATTiny85 port (work in progress)
Post by: rj44319 on Nov 04, 2010, 11:44 pm
I got it to work with the v19 arduino IDE.
This is he board file in the shekch area....
Code: [Select]

attiny45.name=ATtiny45
attiny45.upload.using=arduino:arduinoisp
attiny45.upload.maximum_size=4096
attiny45.build.mcu=attiny45
attiny45.build.f_cpu=1000000L
attiny45.build.core=attiny45_85

attiny85.name=ATtiny85
attiny85.upload.using=arduino:arduinoisp
attiny85.upload.maximum_size=8192
attiny85.build.mcu=attiny85
attiny85.build.f_cpu=1000000L
attiny85.build.core=attiny45_85

I am still trying the USbtinyISP
Title: Re: ATTiny85 port (work in progress)
Post by: Coding Badly on Nov 04, 2010, 11:51 pm
Quote
Quote
1. I'm not certain if version 0018 supports Tiny processors.

I use 18 with your 84 core, works fine

Good to know.  Thanks.

Quote
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85

That error may be because your avrdude.conf needs to be updated.  It's a text file.  See if there's a section for the '85 processor.

I'm using the Pololu USB Programmer.  This is my programmers.txt files...
Code: [Select]
pololu.name=Pololu USB AVR Programmer
pololu.communication=serial
pololu.protocol=avrispv2

And my boards.txt...
Code: [Select]

###########################################################################
#
# Example boards.txt from...
#
# http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1236434254/94#94
# http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1274754985/6#6
# http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1274820597/49#49
#
###########################################################################

attiny84at8.name=ATtiny84 @ 8 MHz

# The following do NOT work...
# attiny84at8.upload.using=avrispv2
# attiny84at8.upload.using=Pololu USB AVR Programmer

# The following DO work (pick one)...
# attiny84at8.upload.protocol=avrispv2
attiny84at8.upload.using=pololu

attiny84at8.upload.maximum_size=8192
attiny84at8.upload.speed=19200

# Default clock (slowly rising power; long delay to clock; 8 MHz internal)
# Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms; [CKSEL=0010 SUT=10]; default value
# Brown-out detection disabled; [BODLEVEL=111]
# Preserve EEPROM memory through the Chip Erase cycle; [EESAVE=0]

attiny84at8.bootloader.low_fuses=0xE2
attiny84at8.bootloader.high_fuses=0xD7
attiny84at8.bootloader.extended_fuses=0xFF
attiny84at8.bootloader.path=empty
attiny84at8.bootloader.file=empty84at8.hex

attiny84at8.bootloader.unlock_bits=0xFF
attiny84at8.bootloader.lock_bits=0xFF

attiny84at8.build.mcu=attiny84
attiny84at8.build.f_cpu=8000000L
attiny84at8.build.core=tiny

###########################################################################

attiny84at1.name=ATtiny84 @ 1 MHz

# The following do NOT work...
# attiny84at1.upload.using=avrispv2
# attiny84at1.upload.using=Pololu USB AVR Programmer

# The following DO work (pick one)...
# attiny84at1.upload.protocol=avrispv2
attiny84at1.upload.using=pololu

attiny84at1.upload.maximum_size=8192
attiny84at1.upload.speed=19200

# Default clock (slowly rising power; long delay to clock; 8 MHz internal; divide clock by 8)
# Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms; [CKSEL=0010 SUT=10]; default value
# Divide clock by 8 internally; [CKDIV8=0]
# Brown-out detection disabled; [BODLEVEL=111]
# Preserve EEPROM memory through the Chip Erase cycle; [EESAVE=0]

attiny84at1.bootloader.low_fuses=0x62
attiny84at1.bootloader.high_fuses=0xD7
attiny84at1.bootloader.extended_fuses=0xFF
attiny84at1.bootloader.path=empty
attiny84at1.bootloader.file=empty84at1.hex

attiny84at1.bootloader.unlock_bits=0xFF
attiny84at1.bootloader.lock_bits=0xFF

attiny84at1.build.mcu=attiny84
attiny84at1.build.f_cpu=1000000L
attiny84at1.build.core=tiny

###########################################################################

attiny85at8.name=ATtiny85 @ 8 MHz

# The following do NOT work...
# attiny85at8.upload.using=avrispv2
# attiny85at8.upload.using=Pololu USB AVR Programmer

# The following DO work (pick one)...
# attiny85at8.upload.protocol=avrispv2
attiny85at8.upload.using=pololu

attiny85at8.upload.maximum_size=8192
attiny85at8.upload.speed=19200

# Default clock (slowly rising power; long delay to clock; 8 MHz internal)
# Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms; [CKSEL=0010 SUT=10]; default value
# Brown-out detection disabled; [BODLEVEL=111]
# Preserve EEPROM memory through the Chip Erase cycle; [EESAVE=0]

attiny85at8.bootloader.low_fuses=0xE2
attiny85at8.bootloader.high_fuses=0xD7
attiny85at8.bootloader.extended_fuses=0xFF
attiny85at8.bootloader.path=empty
attiny85at8.bootloader.file=empty85at8.hex

attiny85at8.bootloader.unlock_bits=0xFF
attiny85at8.bootloader.lock_bits=0xFF

attiny85at8.build.mcu=attiny85
attiny85at8.build.f_cpu=8000000L
attiny85at8.build.core=tiny

###########################################################################

attiny85at1.name=ATtiny85 @ 1 MHz

# The following do NOT work...
# attiny85at1.upload.using=avrispv2
# attiny85at1.upload.using=Pololu USB AVR Programmer

# The following DO work (pick one)...
# attiny85at1.upload.protocol=avrispv2
attiny85at1.upload.using=pololu

attiny85at1.upload.maximum_size=8192
attiny85at1.upload.speed=19200

# Default clock (slowly rising power; long delay to clock; 8 MHz internal; divide clock by 8)
# Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms; [CKSEL=0010 SUT=10]; default value
# Divide clock by 8 internally; [CKDIV8=0]
# Brown-out detection disabled; [BODLEVEL=111]
# Preserve EEPROM memory through the Chip Erase cycle; [EESAVE=0]

attiny85at1.bootloader.low_fuses=0x62
attiny85at1.bootloader.high_fuses=0xD7
attiny85at1.bootloader.extended_fuses=0xFF
attiny85at1.bootloader.path=empty
attiny85at1.bootloader.file=empty85at1.hex

attiny85at1.bootloader.unlock_bits=0xFF
attiny85at1.bootloader.lock_bits=0xFF

attiny85at1.build.mcu=attiny85
attiny85at1.build.f_cpu=1000000L
attiny85at1.build.core=tiny

###########################################################################
Title: Re: ATTiny85 port (work in progress)
Post by: adamdb on Nov 10, 2010, 05:25 am
I'm not clear on something.  Are there any actual changes to the software serial code, or does it just work because the timing in the millis() and micros() functions has been fixed up for the tiny 85?
Title: Re: ATTiny85 port (work in progress)
Post by: Coding Badly on Nov 10, 2010, 05:30 am
Quote
I'm not clear on something.

That makes two of us.   :)

Quote
Are there any actual changes to the software serial code, or does it just work

Are you asking about NewSoftSerial?

Quote
because the timing in the millis() and micros() functions has been fixed up for the tiny 85?

I don't think either was changed in the published '85 core.  But I don't think they needed to be changed.