Qns regarding ATtiny

Hi all,

 

I'm considering a low cost solution for my next project & i stumble across the ATtiny.

what I needed to do requires only 3 digital I/Os.

 

I'm new to the ATtiny & it seems that the programmer costs a bomb.relative to the chip.

Any recommendations for the programmer and the IDE?

 

Thanx

I have this one

I have this one http://www.pololu.com/catalog/product/1300 . Should work with all the Attiny and Atmega and it works with the AVR studio IDE. Not to mention its other features you can read up on. I have used it the the AVR Studio IDE and an Attiny85v. AVR studio can be downloaded here: http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2725 dont worry its free.

AVR studio is free; I

AVR studio is free; I downloaded it and installed no problem. I am looking into the same thing myself and have a few watches set on eBay, like this one:

http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=200460739146&ssPageName=STRK:MEWAX:IT

$11.50 US delivered. I don’t have one yet, but the feedback rating says to me they work. The reason I haven’t pulled the trigger yet is that unless actually programming the units is part of your job, you may be better off going with a Teensy or similar unit for development.

AVR Dragon

I use the AVR Dragon which includes Debug Wire, HVP & jtag.  It’s a steal for what you get, but $50 is a decent chunk of change. 

If you’re only doing the project for yourself (and you’re only going to make a few of them), why not use a chip with a bootloader?  Then you can bypass the expense of a programmer altogether. An Arduino is $30 and includes the chip.  Additional chips are 3 or 4 bucks. 

But if you are going to make 20+ units, you’ll want a programmer that has HVP (ICSP is kinda slow), and you’ll save money with a smaller ATTiny.

If my project is approved,

If my project is approved, I’m definitely be looking at >20 sets.

 

I think I’ll be using the Arduino to test out my ideas first. But I’ll definitely want to learn to use these 8-pin mcu, so that I can wire up my room with min consideration for the $$.

 

Any recommendations for AVR programmer from Sparkfun? The 8 Pin AVR Developement Board seems restrictive. Maybe I can get it on Free Day!!!

 

Just wondering, is the AVR syntax exactly the same as the Arduino?

C is C, but…

 

The libraries are what make Arduino coding easy. I have been doing a bunch of Arduino and just getting started with moving one project to straight AVR. The majority of my functions are straight C logic and they compile just fine. Interfacing with hardware is more tedious. It’s not hard if you have experience dealing with registers and bit masks and all that, just more steps. I like the structure that Arduino gives you with the setup() and loop() and will stick with that in straight AVR.

You can also look into making the Arduino libraries work with whatever you choose. If you read this forum thread:

http://forum.pololu.com/viewtopic.php?f=10&t=3230&p=15586

you will get an idea what I mean. The Pololu Orangutan is an ATMega based controller that is not an Arduino per se, but there are libraries out there to make it work. Other ATMega boards also have libraries (I think there is one for the Teensy). Upside is quick development, downside is slight bloat.

what I am using

Should have mentioned that…

http://www.robotsimple.com/Robot_Controller/atmega32u4

I am taking the previously suggested bootloader route for now. The 32u is a good way to go for coding as the USB is separate from the serial port so you can hook up what you want on the serial port and leave it there while programming. My biggest gripe with Arduinos, especially the Pro Mini, is having to free up the serial port to program it. The Teensy is also based on the 32u. Anyway, I am using the breakout board on the breadboard like a chip and should be able to program chips with the hex files when I get to that point.

Here is a better product page:

http://ladyada.net/products/atmega32u4breakout/

including info on how to program it from the Arduino IDE. When you consider that it is nothing but a breakout board, that means you can do “pure” ATMega chip programming in the Arduino IDE.

some options

http://www.adafruit.com/index.php?main_page=index&cPath=16

Recommendations

I recommend the OEM AVRISP mkII programmer for $34  (if that is too expensive take a look at the $20 programmer Patrick suggested from Pololu.com).  These both have USB interface, not serial, which is a plus in my opinion.

Definitely have to suggest you use AVR Studio 4 (free) which can be downloaded from Atmel’s website. This is an easy to use IDE and has worked very well for me under Windows 7 x64.  Also link this with GCC (free C compiler) for the AVR.  If you want a very easy to follow tutorial on setting up the AVR studio environment with GCC and programming an ATtiny microcontroller go HERE.  I suggest getting some long pin dual row headers for breadboarding these as shown in the tutorial.

Tinies are neat

 

I used an Arduino as an ISP at first:

https://www.robotshop.com/letsmakerobots/node/18490

Lately I’ve been using a BusPirate though. The Pololu programmer is neat, but windows only. I tried the AdaFruit ISP, but it died the first time I used it.

Programming with plain AVR-GCC is tricky compared to Arduino. The way the chips work is pretty neat though, and learning to read the data sheet is worth doing for its own sake.

Here is a project that adds

Here is a project that adds Arduino libraries to the ATiny series:

http://code.google.com/p/arduino-tiny/

You would still need a programmer to load the code to the microcontroller. You can get USBtinyISP clones on eBay for around 15 bucks.

A general comment…I sort

A general comment…

I sort of understand wanting to develop using target hardware, but I sort of don’t at the same time. Using Teensy Arduino files and the AdaFruit ATMega32u breakout, I can emulate an AVR family chip (and a little of its support circuitry)  that can be plugged in instead of wiring the breakout from the breadboard until very late in the process. It will operate the same. In the meantime, I will have the easier downloading and the “extra” serial port for diagnostics. I can use conditional compilation to make everything I do with the USB serial port disappear in the final compiles and just download the hex file to a “real” chip instead. They even have a solder bridge on the power from the USB that I can cut. 

I found this info on doing

I found this info on doing it that way:

http://dorkbotpdx.org/blog/feurig/running_paul_stoffregonss_teensy_serial_arduino_core_on_dfu_based_chips

 

Does this apply to ATtinys?

Does this apply to ATtinys?  I have no idea so I was hoping you can clarify.

Yes, but…

 

You can very easily create a program that can be recompiled for ATTiny, and with only a little more effort, you can work with binaries that can be burned to it the whole time. I actually don’t recommend being that restrictive because it makes debugging easier if you take advantage of extra functionality on other chips to help you in development. For example, I have an ATMega32u4 breakout board from AdaFruit and I use the TeensyDuino libraries with it. I can use macros that print to the USB port only if DEBUG is defined, otherwise they equate to nothing. While I am developing I can print stuff to the USB and see it in a terminal session. As an alternative, if I restrict myself to only ATTiny functionality from the start, either by strict adherence or by programmatic restrictions, then the hex file would work on an ATTiny at any point.

There are some funky details you have to learn about TeensyDuino to do this, but it’s not that bad. There are different ways it can set up and use the USB - none (just return on the calls; this is what you would use on the ATTiny), serial, HID and disk. The last three are so you can create things with a Teensy or compatible (like the Ada I use) that can operate as serial device, HID (keyboard/mouse) or disk/storage. Very cool stuff, but yet another cool thing is that if you turn it all off, you are left with raw chip programming. When you press reset, it does kick up a bootloader that surfaces USB functionality for downloading. Then when your code starts to run, it only surfaces what you select.

Oh yeah, as cool as that is, it is a little clunky to switch between them, as in copying files around in cores folders. But it is in a sensible manner; it is clunky but not mysterious.

Cool, it looks like a

Cool, it looks like a bootloader is requried for what you are talking about then.  I take it the bootloader won’t use a significant chunk of an ATtinys skimpy flash memory.  Thanks for the extra words.

I am not quite clear yet…

To do it the way I do, a bootloader is required on the development platform, not on the target platform. My point is that those do not have to be one and the same. Using my ATMega32u4 breakout board and TeensyDuino, I can create a hex file that will download and run on an ATTiny.

Got it, thanks.

Got it, thanks.

Summary

Hi all, thanx for the info. Details are as follows:

Atmega32u4 Breakout Board       AdaFruit            $20

USBtinyISP                                  eBay/AdaFruit    $15-22

BusPirate V3                                Seeed Studio     $27.15

AVRISP MKII Programmer           Atmel                $34

AVR Dragon                                 Atmel                $49

Pololu USB AVR Programmer      Pololu               $19.95

Pocket AVR Programmer             Sparkfun             $14.95

 

Interesting link for AVR programmers

 

I’m considering the Atmega32u4 or the pocket AVR programmer for now, since I’ve to place an order with Sparkfun & AdaFruit soon.

Any feedback/recommendations/objections from the guys using the above programmers?

Even though I have the

Even though I have the AdaFruit board, I suggest you look at their article on choosing between it and the Teensy or Teensy++. They are very similar.