Go Down

Topic: sizing down my arduino (Read 16463 times) previous topic - next topic

Ste_Hughes

it would be like avatar except with Ethiopians

Frozen_One

G'day all,

I have been reading many posts on using tiny85's with Arduino.  I have tried HLT's and Coding Badly's.

All works fine until trying to send the 'blink' example via ArduinoISP.  Then I keep getting the error message below.

Can any of you see something obvious that I left out by looking at this?:


Binary sketch size: 664 bytes (of a 8192 byte maximum)

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)

Coding Badly


Post your customized boards.txt file (you did change it to use your particular programmer?).  Please use code tags.

Frozen_One

Sorry in advance (new to this)

Ah- I had not read the part about customizing the boards.txt file.

I no longer get the same error, but it hangs perpetually.  When I unplug the Arduino board (with 328 and ArduinoISP loaded) I see many of these "avrdude: stk500_2_ReceiveMessage(): timeout".

By 'Please use code tags.' do you mean hit the 'Check this if you'll be adding code' box?  I'll check that and paste the boards.txt contents if it comes up..

I don't see how to attach the file.

(many apologies again- new at forums, but eager to learn)

Frozen_One

Ahha- now I see it.

I only changed the '85 portions...

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

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

attiny45at8.name=ATtiny45 @ 8 MHz

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

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

attiny45at8.upload.maximum_size=4096
attiny45at8.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]

attiny45at8.bootloader.low_fuses=0xE2
attiny45at8.bootloader.high_fuses=0xD7
attiny45at8.bootloader.extended_fuses=0xFF
attiny45at8.bootloader.path=empty
attiny45at8.bootloader.file=empty45at8.hex

attiny45at8.bootloader.unlock_bits=0xFF
attiny45at8.bootloader.lock_bits=0xFF

attiny45at8.build.mcu=attiny45
attiny45at8.build.f_cpu=8000000L
attiny45at8.build.core=tiny

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

attiny45at1.name=ATtiny45 @ 1 MHz

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

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

attiny45at1.upload.maximum_size=4096
attiny45at1.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]

attiny45at1.bootloader.low_fuses=0x62
attiny45at1.bootloader.high_fuses=0xD7
attiny45at1.bootloader.extended_fuses=0xFF
attiny45at1.bootloader.path=empty
attiny45at1.bootloader.file=empty45at1.hex

attiny45at1.bootloader.unlock_bits=0xFF
attiny45at1.bootloader.lock_bits=0xFF

attiny45at1.build.mcu=attiny45
attiny45at1.build.f_cpu=1000000L
attiny45at1.build.core=tiny

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

attiny2313at8.name=ATtiny2313 @ 8 MHz

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

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

attiny2313at8.upload.maximum_size=2048
attiny2313at8.upload.speed=19200

# Default clock (slowly rising power; long delay to clock; 8 MHz internal)
# Int. RC Osc. 8 MHz; Start-up time: 14 CK + 65 ms; [CKSEL=0100 SUT=10]; default value
# Brown-out detection disabled; [BODLEVEL=111]
# Serial program downloading (SPI) enabled; [SPIEN=0]
# Preserve EEPROM memory through the Chip Erase cycle; [EESAVE=0]

attiny2313at8.bootloader.low_fuses=0xE4
attiny2313at8.bootloader.high_fuses=0x9F
attiny2313at8.bootloader.extended_fuses=0xFF
attiny2313at8.bootloader.path=empty
attiny2313at8.bootloader.file=empty2313at8.hex

attiny2313at8.bootloader.unlock_bits=0x3F
attiny2313at8.bootloader.lock_bits=0x3F

attiny2313at8.build.mcu=attiny2313
attiny2313at8.build.f_cpu=8000000L
attiny2313at8.build.core=tiny

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

attiny2313at1.name=ATtiny2313 @ 1 MHz

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

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

attiny2313at1.upload.maximum_size=2048
attiny2313at1.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: 14 CK + 65 ms; [CKSEL=0100 SUT=10]; default value
# Divide clock by 8 internally; [CKDIV8=0]
# Brown-out detection disabled; [BODLEVEL=111]
# Serial program downloading (SPI) enabled; [SPIEN=0]
# Preserve EEPROM memory through the Chip Erase cycle; [EESAVE=0]

attiny2313at1.bootloader.low_fuses=0x64
attiny2313at1.bootloader.high_fuses=0x9F
attiny2313at1.bootloader.extended_fuses=0xFF
attiny2313at1.bootloader.path=empty
attiny2313at1.bootloader.file=empty2313at1.hex

attiny2313at1.bootloader.unlock_bits=0x3F
attiny2313at1.bootloader.lock_bits=0x3F

attiny2313at1.build.mcu=attiny2313
attiny2313at1.build.f_cpu=1000000L
attiny2313at1.build.core=tiny

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

Frozen_One

Update- I tried HLT's http://hlt.media.mit.edu/wiki/pmwiki.php?n=Main.ArduinoATtiny4585 with Arduino v21 and she is blinkin'; YEAH!  (didn't work with v18)

I like the variety of options yours (Coding Badly) and would be eager to learn how to make that work.

Merry Christmas!

Coding Badly

Quote
Sorry in advance (new to this)

No need to apologize!

Quote
Ah- I had not read the part about customizing the boards.txt file.

Well, in your defense, I don't think anyone has ever written that it needs customizing.  That bit of knowledge is implied by the architecture of the IDE.  In your case, as someone new to this world, you would have no way of knowing.

Quote
I no longer get the same error, but it hangs perpetually.  When I unplug the Arduino board (with 328 and ArduinoISP loaded) I see many of these "avrdude: stk500_2_ReceiveMessage(): timeout".

You've modified the correct spot in boards.txt.  I suspect you need to comment out the "attiny85at8.upload.protocol" and add something for the Arduino ISP.  I'll investigate this evening.

Quote
By 'Please use code tags.'

You did it right.  Thanks.

Quote
Update- I tried HLT's http://hlt.media.mit.edu/wiki/pmwiki.php?n=Main.ArduinoATtiny4585 with Arduino v21 and she is blinkin'; YEAH!

Excellent!  That means the software and hardware all work correctly.  It also means that, once the correct entries are in boards.txt, you will be able to use the Tiny Core.

Quote
(didn't work with v18)

Do you need it to work with that version?

Quote
I like the variety of options yours (Coding Badly) and would be eager to learn how to make that work.

We'll get it working.  I ask just one thing, follow-up.  I'd like to make this process easier for the next person.  In order to do that, I need to know what you did to get it working (once it is working).

Merry Christmas to you!

Frozen_One

Quote
Do you need it to work with that version?


Nope.  v21 is great.

Quote
We'll get it working.  I ask just one thing, follow-up.  I'd like to make this process easier for the next person.  In order to do that, I need to know what you did to get it working (once it is working).


Happy to!

When I used HLT's (with v21) it worked without any modification to the boards.txt file: this was attractive, but editing yours was easy enough.

BTW- My program I had on the mega328 works on the tiny85 (minus the lack of 3rd PWM, but I'm hoping to find a thread with a w/ a way to make a pseudo PWM out of one of the remaining pins).

biocow

#38
Dec 23, 2010, 09:05 pm Last Edit: Dec 23, 2010, 09:14 pm by biocow Reason: 1
Not sure if this would work for you but I searched for "PWM from regular pin" and found a thread where Mowcius linked to this.

http://code.google.com/p/rogue-code/wiki/SoftPWMLibraryDocumentation

Orig thread: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1280562213

Good luck!

Edit: This lib looks really nice. I'm going to have to download it and play. Check out the example videos.

http://www.youtube.com/watch?v=jE7Zw1zNL6c&feature=player_embedded

Frozen_One

@Biocow, thanks- this looks great and complies perfect until I switch the tools>board over to ATtiny85.  Errors galore

Looks like it was made for the MEGA328.  Good to have in the 'toolbox' for a future project.

I like the way it is implemented- has some easy to use features:
i.e. SoftPWMSetFadeTime(pin, fadeUpTime, fadeDownTime)  
& SoftPWMSetPercent
very nice, just not tiny nice :(

mowcius

I'd have a chat to bhagman about it but I know he's uber busy with other stuff so wouldn't have time to write it/modify it for ATtiny.

It is a nice library :)

biocow

Oh well. Sorry. :(

Like you said, going in the toolbox. Will come in handy for my next project. Fireflies for the back yard ala Pirates of the Caribbean ride at Disneyland. (Leaving next week for "research" :p)

Coding Badly

Quote
(minus the lack of 3rd PWM, but I'm hoping to find a thread with a w/ a way to make a pseudo PWM out of one of the remaining pins)

The Tiny Core provides three PWM pins.  Two phase-correct and one fast.

Frozen_One

Code: [Select]
The Tiny Core provides three PWM pins.  Two phase-correct and one fast.

Really!?  My ignorance is showing.  I saw this on the HLT page...



and knew pins 5 and 6 would work easily (and they did) but got lost in the datasheet for the tiny85 trying to see how the third PWM might be used.

Coding Badly

Quote
Quote
The Tiny Core provides three PWM pins.  Two phase-correct and one fast.

Really!?

Yes.

Quote
My ignorance is showing.  I saw this on the HLT page...

That diagram is correct for the core available from the HLT website.  It's saposoft's (Alessandro Saporetti) core...
http://sites.google.com/site/elettronicaarduinoesperimenti/Home/arduino-ide-and-attiny45

Quote
and knew pins 5 and 6 would work easily (and they did) but got lost in the datasheet for the tiny85 trying to see how the third PWM might be used

Pins labeled with "OC" are capable of PWM...

 PB0 --> OC0A and /OC1A
 PB1 --> OC0B and OC1A
 PB3 --> /OC1B
 PB4 --> OC1B


A bar over the label indicates that the output is inverted.  So, if OC1A is configured for output on both PB0 and PB1 then PB1 will have a "normal" PWM signal and PB0 will be "inverted".  As far as I know, none of the cores make use of inverted PWM signals so you can ignore them.  That leaves...

 PB0 --> OC0A
 PB1 --> OC0B and OC1A
 PB4 --> OC1B


...three pins that can provide a PWM signal.  PB1 can be connected to either timer 0 or timer 1 (I have no idea what happens if it's connected to both).

The Tiny Core uses timer 1 for fast PWM and timer 0 for phase-correct PWM.  The PWM pins in the Tiny Core are...

 PB0 --> OC0A
 PB1 --> OC0B
 PB4 --> OC1B


Go Up