Arduino Tiny

The next Arduino Tiny release is ready... http://code.google.com/p/arduino-tiny/

Included is a "highly compatible" core for the ATtiny2313, ATtiny84 family, and ATtiny85 family processors: most of the functions are very similar or identical to the 0022 core.

New Features...

  • F-macro provides inline PROGMEM strings (example below)
  • Support for ATtiny85 @ 16 MHz / external crystal. The Tiny Debug Serial pin moves to the other side of the processor (PB2 instead of PB3).
  • Support for ATtiny84 @ 16 MHz / external crystal. The Tiny Debug Serial pin moves to the other side of the processor (PA0 instead of PB0).
  • ADC converter can be left untouched (disabled) with a compile switch in "core_build_options.h".
  • Secondary timer (the timer not used for millis) can be left untouched with a compile switch in "core_build_options.h".
  • Change to millis interrupt service routine to make it smaller.
  • Improved labels on the Boards menu

F-macro example...

Serial.println( "This string consumes both Flash and SRAM." ); Serial.println( F( "This string only consumes Flash." ) );

More details are available here...

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1285218245/0#0 http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1285218245/2#2 http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1285218245/25#25 http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1285218245/26#26

The F macro does the exact same thing as PSTR, I think you should not be using F because it sounds more math related

Thank you for your reply.

The F macro does the exact same thing as PSTR

The two are similar but not identical. It is actually not possible to get the same functionality from a PSTR.

I think you should not be using F because it sounds more math related

The name ("F" as in "Flash string") comes from Mikal Hart's Flash Library. The two macros have similar functionality so sharing the name seems reasonable.

I'm using this new core and it's working fine.

Except that I wish I could program the fuses on the ATtiny85 through boards.txt. I'm using Sparkfun's "Pocket AVR Programmer" which works like the USBtinyISP. It uploads fine, but when I try Burn Bootloader I get

avr_read(): error reading address 0x0000
    read operation not supported for memory "lock"
avrdude: failed to read all of lock memory, rc=-2

Strangely, I'm able to "burn the bootloader" for the 2313. I can also set the fuses with that programmer using the command line. (avrdude -C "..\etc\avrdude.conf" -c usbtiny -p ATtiny85 -U lfuse:w:0xE2:m -U hfuse:w:0xD7:m)

The section of boards.txt for the 85 looks like this:

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

attiny85at8.name=ATtiny85 @ 8 MHz  (internal oscillator; BOD disabled)

# 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=arduino:arduinoisp
# attiny85at8.upload.using=pololu
attiny85at8.upload.using=arduino:usbtinyisp

attiny85at8.upload.maximum_size=8192

# 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

Is it possible I'm getting some kind of "interference" from the MIT core I also have installed? (It's installed in the IDE's hardware folder and not in the sketchbook hardware folder where Ardunio-Tiny is.) Since the MIT core does not include a 2313, it might explain why I can burn that one - just a WAG.

The problem is the AVRDUDE.CONF file. There are a few lines missing for the 85 processor (I think the 84 section is also deficient). The problem is solved by using a newer version of the file.

There is also a bug in the compiler (or linker) that prevents jumps / calls to the entire address range. The symptom is a cryptic message that includes something about "R_AVR_13_PCREL" and a failure to finish the build. This problem is solved by using a newer version of the toolchain.

So you don't have to "upgrade" your toolchain, later tonight I'll diff the old and new AVRDUDE.CONF files and post instructions for updating the file.

Good to hear about AVRDUDE.CONF. I found your post on this previous thread, made the change and now it's working. :D

There is also a bug in the compiler (or linker) that prevents jumps / calls to the entire address range. The symptom is a cryptic message that includes something about "R_AVR_13_PCREL" and a failure to finish the build.

Oh really! You mean something like this ? . . .

c:/program files/arduino-0022/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../
avr/lib/avr25/crttn85.o:(.init9+0x2): relocation truncated to fit: R_AVR_13_PCREL against 
symbol `exit' defined in .fini9 section in c:/program files/arduino-
0022/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/avr25\libgcc.a(_exit.o)

I ruined 3 cups of coffee on that this morning. I'd think I'd have it reduced to the lowest common denominator - and then it would slip away. Let me know if you want examples.

Things are making sense again, and I thank you for that!

BroHogan: Oh really! You mean something like this ? . . .

Yup. That's the nasty thing.

I ruined 3 cups of coffee on that this morning. I'd think I'd have it reduced to the lowest common denominator and then it would slip away.

That's a familiar experience! I would move things around and the error would disappear. Add a single line of code and ... bang ... it would be back.

Would you prefer to "upgrade" to the latest tool-chain? It was fairly easy to do, both bugs have been eliminated, and I haven't had any other problems.

Would you prefer to "upgrade" to the latest tool-chain? It was fairly easy to do, both bugs have been eliminated, and I haven't had any other problems.

gulp, sure! (I've come a long way from being happy with my parallel programmer. Next I'll be on the AVR Freaks forum!)

It's not comfortable to live with a time bomb, so I guess it's the thing to do.

BroHogan:
gulp, sure!

It’s not that bad! You’ll be able to switch back and forth.

Next I’ll be on the AVR Freaks forum!

Bah! They’re kind of rude over there! You’ll be much happier over here.

It’s not comfortable to live with a time bomb, so I guess it’s the thing to do.

Excellent. Let’s get started…

  1. Download the latest WinAVR…
    http://sourceforge.net/projects/winavr/files/
    http://sourceforge.net/projects/winavr/files/WinAVR/20100110/

  2. Install the latest WinAVR to a convenient location. I went with C:\WinAVR.

  3. Ensure the Arduino IDE is not running.

  4. Locate the existing tool-chain directory. It should be in {ArduinoRootFolder}\hardware\tools.

  5. There should be a single sub-directory there named avr. Rename the existing avr sub-directory to something like avr (old).

  6. Create a new sub-directory named avr.

  7. Move the entire contents of your WinAVR directory (C:\WinAVR*) to the newly created avr directory ({ArduinoRootFolder}\hardware\tools\avr*).

  8. Copy avrdude.conf from {ArduinoRootFolder}\hardware\tools\avr\bin to {ArduinoRootFolder}\hardware\tools\avr\etc (you may have to first create etc).

That’s it. You should now be able to run the Arduino IDE and build Sketches. If you have problems, you can switch back to the original tool-chain by renaming avr to avr (new) then renaming avr (old) to avr.

Sweet! The hardest part was downloading the file. Sourceforge doesn't seem to like Chrome.

That took care of the compile problem. I had a collection of sketches with the problem and now they all compile.

The avrdude.conf (Step 8 ) didn't allow me to "Burn Bootloader" however. It still must have the missing lines (although it's bigger than the older one). So I used the one I had modified and it's all good.

I may have started with ruined coffee but I sure am enjoying this scotch. Thanks for your generous help.

For the life of me, I can’t get this to work.

I initially tried both this core as well as the MIT HLT-core, neither worked on my desktop, I assume it’s to do with 64-bit Windows, I’ve had issues with Processing apps using any kind of serial communication on x64. So I tried with my netbook, which has a 32-bit OS. This core didn’t work there either, but the MIT core works as described.

What do I need to do to get this to work? I’ve followed all the instructions in tiny/readme.txt to the letter (unzip core zipfile to the hardware directory inside the sketchbook directory, edit hardware/tiny/boards.txt to upload.using=arduino:arduinoisp for all MCUs, upload ArduinoISP to the arduino, wire the Arduino and ATTiny together, load up a sketch and upload). I’ve now done a fresh reinstall of the Arduino IDE three times now, and whatever I try, I always end up with “avrdude: stk500_getsync(): not in sync: resp=0x15”.

I’m using ArduinoISP and wiring according to the Fritzing-schematics on the MIT HLT core page. Any help would be appreciated…

upload ArduinoISP to the arduino

Which Arduino?

[quote author=Coding Badly link=topic=51984.msg372627#msg372627 date=1297708800]

upload ArduinoISP to the arduino

Which Arduino? [/quote] Arduino Duemilanove. Oh, and the target is a ATTiny85. I actually started again trying to get this to work because I read in another thread that with your core, I could set the fuse bit directly from the IDE, something that I've been unable to do manually with avrdude with the core and wiring from MIT LHT.

Excellent. What I suggest...

  1. Upload ArduinoISP Sketch.

  2. Disable reset.

  3. Run AVRDUDE from the command-line. Something like the following ("COM8" is the serial port for your Arduino)...

C:\Arduino\arduino-0022\hardware/tools/avr/bin/avrdude -CC:\Arduino\arduino-0022\hardware/tools/avr/etc/avrdude.conf -v -v -v -pattiny85 -cavrispv2 -P\\.\COM8

At this point, AVRDUDE should fail with what amounts to a time-out.

  1. Connect the ATtiny85 processor.

  2. Repeat the AVRDUDE command.

Something like this should be displayed at the bottom...

avrdude: Device signature = 0x1e930b
avrdude: safemode read 1, lfuse value: 62
avrdude: safemode read 2, lfuse value: 62
avrdude: safemode read 3, lfuse value: 62
avrdude: safemode: lfuse reads as 62
avrdude: safemode read 1, hfuse value: df
avrdude: safemode read 2, hfuse value: df
avrdude: safemode read 3, hfuse value: df
avrdude: safemode: hfuse reads as DF
avrdude: safemode read 1, efuse value: ff
avrdude: safemode read 2, efuse value: ff
avrdude: safemode read 3, efuse value: ff
avrdude: safemode: efuse reads as FF

If all that works, you have verified that the hardware is ready for business.

shinmai: For the life of me, I can't get this to work.

I've now done a fresh reinstall of the Arduino IDE three times now, and whatever I try, I always end up with "avrdude: stk500_getsync(): not in sync: resp=0x15".

I had the same problem. This posting http://laclefyoshi.blogspot.com/2011/01/note-of-caution-for-arduino-isp.html got me going:

avrdude: stk500_getsync(): not in sync: resp=0x15

This error is because of Auto Reset capabilities of Arduino. This document: MegaISP gave me some details. This error occurs on Mac or Linux. For using Arduino as ISP, I need to disable Auto Reset capabilities. Therefore I inserted 110 ohms (330 ohms / 3) resistor between Reset-pin and 5V-pin. This resistor should be above 110 ohms and below 124 in accordance with this document: DisablingAutoResetOnSerialConnection.

I tried to burn Arduino bootloader onth ATmega 8 again and succeeded in it. I connected 19 pin of ATmega 8 and GND with a LED and it flashed. This behavior proves buring Arduino bootloader in accordance with this document: Bootloader.

Hello,

I'm working to get Arduino-Tiny up and running on an ATtiny85. I think I have gotten as far as Burning the Bootload configuration to the ATtiny85 but am now stuck trying to upload my first sketch. After the patch to AVRDUDE.CONF (see http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1274820597/90 reply #99, noting that reply #8 of this thread did not work for me either), I can successfully burn the bootloader config to the ATTiny85 (I think) with a "Done Burning Bootloader" in the IDE. I am getting errors when I try to upload my first sketch. I can compile my little blink.pde sketch, but when I upload, the errors I get in the IDE are:

Binary sketch size: 694 bytes (of a 8192 byte maximum) java.lang.NullPointerException at processing.app.debug.AvrdudeUploader.getProgrammerCommands(Unknown Source) at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(Unknown Source) at processing.app.Sketch.upload(Unknown Source) at processing.app.Sketch.exportApplet(Unknown Source) at processing.app.Sketch.exportApplet(Unknown Source) at processing.app.Editor$DefaultExportHandler.run(Unknown Source) at java.lang.Thread.run(Thread.java:619)

I am hoping someone here can help me out.

Thanks, George

Extra Background My setup is Arduino-0021 on an Windows XP laptop. I am trying to copy Coding Badly setup exactly so I am using a Pololu USB AVR programmer, which I like so far. The configuration utility for this programmer (pgm03a_config.exe) runs and reports back the programmer serial number, and I get a ready to program status (flashing yellow led) when I have the target board hooked up and powered up so I think the hardware is all working. Programmer shows up fine at COM5, with the optional TTL serial port showing on COM6 in the windows hardware device manager window. My target board has an ATtiny85 installed, with no external crystal/resonator. I wish to use the internal oscillator to clock the ATtiny85 at either 1 or 8 MHz. The board has an LED hooked up to pin 2 of the ATTiny85.

Additional background #1:

C:\Program Files\arduino-0021\hardware\arduino\programmers.txt contents

avrisp.name=AVR ISP
avrisp.communication=serial
avrisp.protocol=stk500v1

avrispmkii.name=AVRISP mkII
avrispmkii.communication=usb
avrispmkii.protocol=stk500v2

usbtinyisp.name=USBtinyISP
usbtinyisp.protocol=usbtiny

parallel.name=Parallel Programmer
parallel.protocol=dapa
parallel.force=true
# parallel.delay=200

arduinoisp.name=Arduino as ISP
arduinoisp.communication=serial
arduinoisp.protocol=stk500v1
arduinoisp.speed=19200

pololu.name=Pololu USB AVR Programmer
pololu.communication=seria
pololu.protocol=avrispv2

Additional Background #2:

excerpt from C:\Documents and Settings\gsmall\My Documents\Arduino\hardware\tiny\boards.txt

###########################################################################
#
# 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
#
###########################################################################

attiny85at16.name=ATtiny85 @ 16 MHz  (external crystal; 4.3 V BOD)

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

# The following DO work (pick one)...
# attiny85at16.upload.protocol=avrispv2
# attiny85at16.upload.using=arduino:arduinoisp
attiny85at16.upload.using=pololu

attiny85at16.upload.maximum_size=8192

# Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms; [CKSEL=1111 SUT=11]
# Brown-out detection level at VCC=4.3 V; [BODLEVEL=100]
# Preserve EEPROM memory through the Chip Erase cycle; [EESAVE=0]
# Serial program downloading (SPI) enabled; [SPIEN=0]

attiny85at16.bootloader.low_fuses=0xFF
attiny85at16.bootloader.high_fuses=0xD4
attiny85at16.bootloader.extended_fuses=0xFF
attiny85at16.bootloader.path=empty
attiny85at16.bootloader.file=empty85at16.hex

attiny85at16.bootloader.unlock_bits=0xFF
attiny85at16.bootloader.lock_bits=0xFF

attiny85at16.build.mcu=attiny85
attiny85at16.build.f_cpu=16000000L
attiny85at16.build.core=tiny
 
###########################################################################

attiny85at8.name=ATtiny85 @ 8 MHz  (internal oscillator; BOD disabled)

# 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=arduino:arduinoisp
attiny85at8.upload.using=pololu

attiny85at8.upload.maximum_size=8192

# 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  (internal oscillator; BOD disabled)

# 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=arduino:arduinoisp
attiny85at1.upload.using=pololu

attiny85at1.upload.maximum_size=8192

# 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=arduino:arduinoisp
attiny45at8.upload.using=pololu

attiny45at8.upload.maximum_size=4096

# 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=arduino:arduinoisp
attiny45at1.upload.using=pololu

attiny45at1.upload.maximum_size=4096

# 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

The entry in programmers.txt is missing a letter...

pololu.name=Pololu USB AVR Programmer
pololu.communication=seria[glow=yellow,2,300]l[/glow]
pololu.protocol=avrispv2

In the "boards.txt" file, change the "upload.using" entries for the ATtiny85 processor to these...

attiny85at16.upload.using=[glow=yellow,2,300]arduino:[/glow]pololu
attiny85at8.upload.using=[glow=yellow,2,300]arduino:[/glow]pololu
attiny85at1.upload.using=[glow=yellow,2,300]arduino:[/glow]pololu

Please let me know if you do or do not get it working. Thanks.