Pages: [1] 2 3 ... 22   Go Down
Author Topic: Arduino Tiny  (Read 49843 times)
0 Members and 1 Guest are viewing this topic.
Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
God Member
*****
Karma: 0
Posts: 594
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Freelance engineer, consultant, contractor. Graduated from UW in 2013.

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you for your reply.

Quote
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.

Quote
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.
Logged

Denver
Offline Offline
God Member
*****
Karma: 19
Posts: 778
Inactive - PM
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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.
« Last Edit: February 12, 2011, 04:29:44 pm by BroHogan » Logged

"Data is not information, information is not knowledge, knowledge is not understanding, understanding is not wisdom."
~ Clifford Stoll

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Denver
Offline Offline
God Member
*****
Karma: 19
Posts: 778
Inactive - PM
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Quote
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 ? . . .

Code:
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!
« Last Edit: February 12, 2011, 10:02:27 pm by BroHogan » Logged

"Data is not information, information is not knowledge, knowledge is not understanding, understanding is not wisdom."
~ Clifford Stoll

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Yup.  That's the nasty thing.

Quote
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.
Logged

Denver
Offline Offline
God Member
*****
Karma: 19
Posts: 778
Inactive - PM
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.
Logged

"Data is not information, information is not knowledge, knowledge is not understanding, understanding is not wisdom."
~ Clifford Stoll

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

gulp, sure!

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

Quote
Next I'll be on the AVR Freaks forum!

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

Quote
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.
Logged

Denver
Offline Offline
God Member
*****
Karma: 19
Posts: 778
Inactive - PM
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: February 13, 2011, 01:32:36 am by BroHogan » Logged

"Data is not information, information is not knowledge, knowledge is not understanding, understanding is not wisdom."
~ Clifford Stoll

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
upload ArduinoISP to the arduino

Which Arduino?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
upload ArduinoISP to the arduino
Which Arduino?
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.
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

4. Connect the ATtiny85 processor.

5. Repeat the AVRDUDE command.

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

Code:
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.
« Last Edit: February 14, 2011, 05:25:32 pm by Coding Badly » Logged

Eastern NC, US
Offline Offline
Newbie
*
Karma: 0
Posts: 10
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

Pages: [1] 2 3 ... 22   Go Up
Jump to: