How does one get started with Atmel AVRs - Page 1
Forum section: electronics / beginners

author: Ferroto
author_rank: Frequent Contributor
timestamp: May 06, 2010, 03:22:41 pm
content: When I got started with micro controllers I went with microchip because they had a diverse inventory of micro controllers and development kits. I got myself the pickit2 starter kithttp://www.microchipdirect.com/productsearch.aspx?Keywords=DV164120because it was the least confusing introductory product available, the uC was a socketed P-DIP PIC16f690 meaning I could remove it and place it on breadboard, you got the whole package (pickit2, dev board, software) for $49.99, and there site was far less confusing then Atmel's.Now at first I was considering the arduino but got turned off when I found out that it wasn't supported by the Atmel, and I don't like writing code for a 3rd party front end instead of for the uC it's self.The Microchip solution was the best at the time as I could jump right into it, write my code in C using 100% supported tools.The reason I'm posting this is because I want to try out AVR's so I don't get stuck with one manufacturer, but I don't really know where to start. Atmel's site more closely resembles an online brochure then a place to shop. The only place I can find Atmel's products is digikey, or mouser.http://www.digikey.com/ca/en/techzone/microcontroller/category/Atmel.html?tab=0Here's what I'm talking about there are several programmers ranging from $33 CAD to $600 CAD. I'm not sure which programmers are compatible with which MCU's. I could probably find out but then I have to decide which MCU's I'm going to work with, in advance of getting started with Atmel.This is driving me crazy, I want to diversify my skills with regards to MCU's, but my god.

author: andri
author_rank: Contributor
timestamp: May 06, 2010, 04:17:20 pm
content: I can recommend theAVR Dragon. It's cheap(ish) and should support most, if not all of the 8-bit uC's and all three programming modes.One bad thing is that the default Atmel C IDE is rather horrible (why do hardware manufacturers insist people use their sub-par IDE's anyway?), at least if you are used to proper development environments. Luckily, there is aavr-eclipseplugin for Eclipse that integrates nicely with GCC and makes development real breeze.

author: Unknown
author_rank: Unknown
timestamp: May 06, 2010, 04:18:26 pm
content: No one forces you to use their front-end with Arduino, you can also use the boot loader to program binaries you compiled from C or assembler.There are basically three official programmers that are of interest to the hobbyist:AVRISP Mk. II: basic programmer that will do in-circuit programming with any AVR (except Xmega)STK500: This is a development board, but can also do both in-circuit programming and high-voltage programming (useful if you disabled the reset pin to gain an extra pin). It's a bit old (uses RS-232 interface, although a usb-serial cable works fine), but has some useful features as a development board like variable power supply and clock source.Dragon: This is the newest and the most full-featured. It will do programming (both in-circuit and high-voltage) and debugging (jtag and debugWire for the smaller chips). There are reports that it's a bit fragile, but the newer revision (by now a year or so old) is supposed to be better.All are official Atmel products and are supported by AVR studio. There are also clones available of the AVRISP Mk.II, not sure how reliable they are, probably not worth it.I'd stick with the 8-bit versions to start. This means ATtiny or ATmega. An advantage over PIC is that the architecture is basically the same (the ATtiny lacks some instructions like multiplication). The ATtiny is usually <= 20 pins, ATmega 28-64 pins or so. I like the ATmega 48/88/168/328 series, the latter two are also used by the arduino. The difference between them is amount of RAM/ROM/EEPROM, it's available in 28-pins DIP, and large enough for many applications. The ATmega48 is often quite cheap, cheaper than many ATtiny's.I'd highly recommend the avrfreaks forum for any information about AVR. There's a lot of information in the archives.

author: TheDirty
author_rank: Frequent Contributor
timestamp: May 06, 2010, 04:20:51 pm
content: I think you should try looking into ARM chips and Cortex-M3/Cortex-M0. I think moving into AVR's is a sideways move and in terms of expanding your diversity ARM's would be a better direction. I'm only suggesting this, because you are not a beginner. Even the small and cheap Cortex variants are not really for beginners.I'll try to type out some overview of your options with the chips and the development environments later tonight when I have some time.

author: TheDirty
author_rank: Frequent Contributor
timestamp: May 07, 2010, 02:13:27 am
content: This turned into a crazy ass novel. I didn't really read through this or check it, so hope it makes sense.For those that don't know, ARM doesn't make chips, they just design the cores and sell them to other companies to manufacture. The core is the actual processing unit and doesn't include peripherals, so even though many manufacturers make ARM7 chips, you can't just swap code between them, because the peripherals are different; timers, UART, SPI, I2C....all the setup and control registers for these are different. So you generally want to pick a specific manufacturer and stick with them if you can, but changing to another manufacturer is not exceedingly difficult.One of the benefits of working with ARM's is that a JTAG programmer and a development environment will usually work with just about any of the ARM chips from the small low power Cortex-M0 to the ARM9 or C-A8. The JTAG connector is a standard 20 pin IDC connector which can be used for in circuit programming/debugging, just like you would with a PICkit. You can also reduce it to a 14 or 10 pin connector if you want to save space. ARM has started to implement Serial Wire Debug on their smaller chips with reduced pin count. SWD is a two wire debug interface that uses a smaller 1.27mm 10 pin header.I'm just going to focus Cortex-M3. CM3 has come out fairly recently and it's pretty popular. Super cheap 32bit with high clock rates. It's a stripped down ARM core. Your options for Cortex-M3 development kits are:Luminary Micro was the first with CM3 parts and has been bought out by Texas Instruments. They have a nice cheap $50 EKK-LM3S811 development kit with a 64k LM3S811 chip. The devel kit is also a JTAG programmer and supports SWD, so it can program other chips. This is a nice development kit and hard to pass up. LM has a C library called StellarisWare which makes programming pretty easy, but can suck up some memory/performance. Some of the higher chips have the StellarisWare library in ROM.http://www.luminarymicro.com/products/ekk-lm3s811_evaluation_kit.htmlST has the STM32. I don't know much about them. When I first looked at them, the selection was pretty limited and expensive. They still seem expensive, but they have a ton of peripherals. The Primer2 development platform has a big following.http://www.st.com/mcu/inchtml-pages-stm32.htmlhttp://www.stm32circle.com/hom/index.phpNXP just recently released their CM3 line. The LPC17XX are powerful large flash and fast chips with crazy peripherals. Ethernet, CAN, I2C FM+, even USB Host support. LPT13xx are smaller chips, still fast, with a regular peripheral selection. Their development kit is the LPCXpresso for the LPC13xx and it comes with it's own JTAG/SWD programmer that can be snapped off the devel board. It's only $30. The only downside is that the programmer is proprietary and is only supported by the Code Red development environment. MBED is also offered, which has a powerful LPC1768, but it has a Arduino style development environment. The main problem with the LPC13xx chips is that they only support SWD programming and SWD is only supported by a few programmers.http://ics.nxp.com/lpcxpresso/http://mbed.org/?gclid=CIDulOjYvqECFZFV2godFDmjAAOkay, development environment options for C. This is not an exhaustive list.GCC is the free compiler. There are some development packages like YAGARTO that try to pull everything together for you. The IDE (Eclipse), the compiler (GCC), and the programmer (OpenOCD). I found OpenOCD to be difficult to deal with and had problems with it at the time with my 64bit OS, but many people use this successfully and it's had a few releases since I last tried it. Straight Eclipse also has a pretty unintuitive interface.Keil and IAR are professional development tools that offer limited code size versions for free, but don't offer any unlimited hobby versions. If you want to use these over the limited code size, it's thousands of dollars for the full versions.Code Red is a GCC compiler with an Eclipse interface. They do have a lower cost option, $256 for an update 256k limit compiler, $512 for a 512k limit compiler. Works with the LPCXpresso programmer. Says it's limited to NXP chips CM2, ARM7, and ARM9. Not certain if anything else is supported.Rowley Crossworks also uses the GCC compiler, but they have their own IDE and it supports just about every ARM chip out there and many different JTAG programmers. They have an unlimited Personal version available for $100. The IDE is really nice and the setup and use is very easy.My own experience is with Stellaris and LPC1xxx chips. I originally used the Stellaris chips and may go back if they refresh the line a bit, but I'm using the LPC1xxx chips right now. Real nice and the peripherals are similar to the popular LPC2xxx chips. I use the Olimex ARM-USB-TINY which is and FTDI based programmer. $50 from Sparkfun. For the LPC1xxx chips I use an adapter from Rowley that allows SWD. Rowley isn't selling these publically yet. I paid the $150 for the Personal license of Crossworks and consider that it was totally worth it over the Elipse/GCC/OpenOCD combo.I don't really document the projects I work on, but I've taken some pictures of some of the things I've played with:http://www.higginstribe.com/lpc1xxx/http://www.higginstribe.com/stellaris/

author: Mechatrommer
author_rank: Super Contributor
timestamp: May 07, 2010, 12:47:45 pm
content: 1)http://cgi.ebay.com.my/Mini-ATMEL-AVR-ATMEGA-STK500-USB-Programmer-ISP-/110423868577?cmd=ViewItem&pt=LH_DefaultDomain_0&hash=item19b5c684a12)http://cgi.ebay.com.my/Mini-Atmel-XMEGA-ATXMEGA-Development-Evaluation-Board-/260595377832?cmd=ViewItem&pt=LH_DefaultDomain_0&hash=item3cacb1e6a83)http://www.atmel.com/dyn/products/tools_card_v2.asp?tool_id=2725&source=redirecti'm still wondering if this is the right combo? or worth it? anyone?

author: Unknown
author_rank: Unknown
timestamp: May 09, 2010, 02:12:04 pm
content: Just a note, the ebay link to the programmer is not an actual Atmel product, they are unofficial clones. It might use the STK500 v1 protocol (it doesn't explicitly state v2), and the supported devices list doesn't appear to include recent AVRs like ATmega 328p or 1284. The 'development board' (basically a breakout board) contains an Xmega, which can't be programmed with an STK500 (original or clone). The Xmega is a fairly recent 16-bit version, more like the pic24 I believe. The AVRISP mk.II, Dragon and JTAGICE mkII (recent revisions) can program the Xmega (at least the real ones can).

author: charliex
author_rank: Frequent Contributor
timestamp: May 09, 2010, 04:39:45 pm
content: I started off a few months ago with the avr, and i've managed to design my own pcb, and write a firmware for it, reasonably straightforwardly. There is a lot of support out there for them. I didn't really hit any major blocks in the road, pretty much all the questions i could come up with had been answered in one form or another somewhere.I recently picked up a STK600 with adapter boards, i think it was a special from arrow, its listed on the adafruit forums somewhere.I used the olimex avr boards to do some prototyping work, they are available direct and from sparkfun etc.The only problem i ran into was once i'd finished my board i could not source AT90CAN128-16MU's for love nor money, the semiconductor shortage sucks.I'd been considering a switch to ARM, but mostly given that i just couldn't source chips.The AVR studio is a bit painful, it crashes a lot for me, especially in search, i don't much care for eclipse, but since its command line and makefile, pretty much any ide/editor can drive it.

author: allanw
author_rank: Frequent Contributor
timestamp: May 09, 2010, 06:12:29 pm
content: Quote from: shafri on May 09, 2010, 04:49:19 pmI don't think you can program the 32-bit AVR chips with the AVR ISP mk2. So I bought the AVR Dragon, which only cost a little bit more but had plenty more features. Check out this guide too:http://www.instructables.com/id/Help:-An-Absolute-Beginner-s-Guide-to-8-Bit-AVR-Pr/You can buy both at Mouser or Digikey. It's $34 for the AVR ISP mk2 and $50 for the AVR Dragon.

author: Unknown
author_rank: Unknown
timestamp: May 09, 2010, 06:19:00 pm
content: The ICE/Dragon support debugging in addition to programming. Whether you need debugging depends on your development style (I think the pickit also supports debugging). Some people get by with just the simulator, some people can't live without on-chip debugging (eg. JTAG, and debugWire for the smaller chips).The Dragon has (much) more features than the AVRISP Mk.II, but the AVRISP is more robust and comes with a proper case. The Dragon is pretty close to the JTAGICE Mk. II in features, but is more fragile (there are various designs for cases, alternative power supplies and output buffers to make it more robust).

author: charliex
author_rank: Frequent Contributor
timestamp: May 09, 2010, 07:11:01 pm
content: i came across the link i mentioned , while i was loking for something else.http://forums.adafruit.com/viewtopic.php?f=24&t=11901i reckon at $99 the stk600 is a pretty good deal.

author: Unknown
author_rank: Unknown
timestamp: May 09, 2010, 07:19:37 pm
content: Too bad the dip socket kit costs another $99, and that's the cheapest of the socket boards.

author: charliex
author_rank: Frequent Contributor
timestamp: May 10, 2010, 07:45:34 am
content: prices depend on which board and how many sets, some are cheaper, some are ore expensive since the sockets aren't cheap. the $99 set covers nearly all the chips.it has an onboard programmer too, so you get that and all the other junk that comes with it, since its pretty much a complete dev board with nearly all the features the avr supports.

author: Unknown
author_rank: Unknown
timestamp: May 10, 2010, 02:40:14 pm
content: Only the DIP chips IIRC, and DIP sockets aren't that expensive. Last time I looked, it didn't have that many features over the STK500. Mainly support for surface mount AVR's with even more $$$ socket boards (although these sockets are very expensive) and support for the Xmega I think. I found it hard to justify $200 (for an STK600 with support for similar chips as the STK500, i.e. most DIP AVR's) vs. $85 or so for an STK500. But I'm sure it's a great piece of kit, and probably more future-proof.

author: charliex
author_rank: Frequent Contributor
timestamp: May 10, 2010, 03:53:13 pm
content: yep the the TQFP's are expensive, i bought the stk600 because i wanted to program a bunch of at90's, the adapter for my eeprom programmer was more expensive than the board+adapters. some of them are less than $20 for the dips. of course the eprom adapter is a rip off at $400 USD.its a decent board, since it has all the programming features that a ice would have, very useful debugging since its got some breadboard like abilities.i'm just saying that for the price of a decent programmer, breadboard setup and avr, you're not far away from that $200, and still might have less features. there are some good breadboard type boards out there though like the easyavr6 from mE which are cheaper.haven't tried the stk500 but i believe that ones even cheaper still, so might be a good option too.

author: Mechatrommer
author_rank: Super Contributor
timestamp: October 25, 2010, 09:36:55 am
content: well, nothing too fancy. i just want to thank TheDirty for providing info on ARM Cortex here. just ignore this. chaow! see ya!