Let's Make Robots!

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

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

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. 

This is something I am doing as I adjust my code for one device to work with an ATTiny...

I picked up a large breadboard and I have my AdaFruit 32u breakout mounted at one end. I am wiring a "virtual chip" right below it by bringing down the relevant pins to the imitate the DIP package for the ATTiny we plan to use. All other components will be wired to the "virtual chip". I will probably use a couple of short pin header blocks so it is easy to unplug. That way I can do the occasional "sanity check" by using an actual ATTiny in place of the virtual one, compiling my code with no USB diagnostics and programming the ATTiny with it.

My justification for this is that high speed diagnostic output has always been the easiest way for me to debug something that runs in real time. An ICE is helpful of course, but breakpoints only stop the processor and not external events. I used traces a lot when I programmed in assembly, but that is a really tedious way to debug and I am not sure how easy it is to get a trace that correlates to compiled source. Testing for and logging events of interest just works better for me. YMMV...

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

 

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

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.

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 AdaFruit board, I suggest you look at their article on choosing between it and the Teensy or Teensy++. They are very similar.