Need advice to buy an AVR  Isp programmer Please! - Page 1
Forum section: electronics / general

author: kgavionics
author_rank: Regular Contributor
timestamp: January 13, 2021, 02:58:32 pm
content: HelloI'm used to programming Microchip MCU's with assembler and C using a PICKIT3 under Linux. Lately, I wanted to know about AVR MCU's, so I started to look for an ISP for AVR, but all my search requests online return "Arduino", I'm not looking for an Arduino as I want to understand how the MCU works. Can someone recommend a good a relatively cheap ISP programmer for AVR microcontrollers to use under Linux.Thank you in advance!

author: JPortici
author_rank: Super Contributor
timestamp: January 13, 2021, 03:07:34 pm
content: PICKIT 4?

author: Doctorandus_P
author_rank: Super Contributor
timestamp: January 13, 2021, 03:12:53 pm
content: Atmel / Microchip tends to change programming protocols every 3 years or so.My first programmer was based on AN910, and I was tempted to buy a "dragon", but that last one had a strong tendency to blow itself up.For a long time I've used: "USBasp" which is an open soucre project that can be burned into a ATMEGA8.A similar popular programmer is "USBtinyISP".For a more generic overview, then have a look at the "avrdude" project, which supports a lot of different programmers. AVRdude is PC software to talk to AVR programmers, and if you have a PC that still has a parallel port, then you can even use that to program your uC. Later (at least on linux) support has been added for any linux board with GPIO pins.I would not recommend something based on bitbanging GPIO pins for regular use, but it still is a valid way to get yourself bootstrapped for programming AVR's.

author: NivagSwerdna
author_rank: Super Contributor
timestamp: January 13, 2021, 03:15:58 pm
content: I have a SNAP which I enjoy for ATSAM... not sure about how many parts it covers...http://www.farnell.com/datasheets/2642855.pdfI think it does some AVR at least... check your device is supported.The SNAP cost very little and works pretty well for me. (I still use my PICKit out of habit for PIC32)

author: ledtester
author_rank: Super Contributor
timestamp: January 13, 2021, 05:11:25 pm
content: You can also use an Arduino as an AVR programmer:https://hackaday.com/2009/07/15/avr-isp-programming-via-arduino/

author: RoGeorge
author_rank: Super Contributor
timestamp: January 13, 2021, 05:37:14 pm
content: Quote from: kgavionics on January 13, 2021, 02:58:32 pmAFAIK, PicKit is now supported as a programmer byavrdude(avrdudeis the default programming software in the GCC AVR toolchain). I don't have a PicKit 3, byut I have a PicKit 2, and it used it a few times to program AVR microcontrollers.I've even used PicKit 2 with Windows long before PicKit 2 was supported by avrdude.(e.g. avrdude with PicKit 2 -https://hackaday.io/project/7061-microchips-pickit-2-as-an-atmel-stk500-programmer)Keep in mind there is a confusion in terms:- there is "Arduino boards", which is a hardware PCB with a microcontroller on it (MCU can be an AVR, Pic, STM, MSP430, ESP32, etc.).- then, there is "Arduino IDE", the toolchain/software to write Arduino programs. The IDE is nothing but avr-gcc as a C/C++ compiler and avrdude to write the microcontrollers, all packed together with an IDE and a boilerplate that saves C/C++ files as .ino sketches for Arduino boards.I'm sure an Arduino board can be loaded with the proper software to become an Arduino programmer in order to program other AVR microcontrollers. An Arduino board can be loaded with any program without a dedicated programmer using the Arduino IDE (the programmer is onboard, so only a normal USB cable is needed).Also, be careful the Arduino Uno are running with 5V I/O, while other manufacturers might have 3.3V only I/O microcontrollers.Another advice, if you have the skills, try to stay away of the Arduino world of software, most are very badly written.

author: kgavionics
author_rank: Regular Contributor
timestamp: January 13, 2021, 05:38:45 pm
content: Thank you guys for your inputs!The Pickit 4 is too expensive(110 CAD) and I already have a pickit3" it would be a waste of money.I already have an Arduino Uno, it would be great if I can use it as a programmer.

author: kgavionics
author_rank: Regular Contributor
timestamp: January 13, 2021, 05:47:44 pm
content: As I stated before, I don't want to use Arduino IDE, I want to use the Atmel IDE.what I love with the Pic uC is I have full control on the registers and I want to try that on Atmel Avr.I already have an Arduino uno which I never used and I'm not interested to learn, I want to understand how to program it the way I program the pic uC.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: January 13, 2021, 05:48:45 pm
content: Heh... I'm happy enough with my AVRISPMKII, but it's a rather old (obsolete?) solution these days, probably not very helpful.On the upside, there are clones and relatives of it; the circuit itself doesn't look to be much: a USB interface, a ATmega32 I think, and some interface (PMIC and comparators) to manage the potentially miswired programming port side.So, one could probably glean some ideas from whatever the latest version flash update is, if one were so inclined to dig into an AVR binary. (Did they ever release the source to that, actually? Hmm, never looked it up.)The protocol itself (SPI or PDI) is documented in the datasheet or in appnotes, and yeah, someone must've written an Arduino sketch for it or something. I haven't used the Arduino version, or clones, but for that, see above.Regarding alternative IDEs -- AVR Studio is a bloated pile, but I suppose if you are familiar with / prefer the Visual Studio style, that's fine. I don't know how the Microchip tools compare (or how thoroughly integrated they are with the AVR family; probably fine these days?). I personally use Code::Blocks with avr-gcc + libc: it's only a few hundred megs download, easy to use, only took a hour or two to set up and get working. I did have to add a custom command to flash via avrdude, and add a few global and project variables to support that (like project CPU type, which both GCC and avrdude need to know, but Code::Blocks doesn't necessarily know/care about). (Looking up the docs on how to do that, or figuring it out, was included in that hour or two of setup time.)Tim

author: RoGeorge
author_rank: Super Contributor
timestamp: January 13, 2021, 05:48:54 pm
content: Both Pickit 3 and Arduino UNO can be used as programmers to program other Atmel chips.Arduino UNO has an onboard programmer already, so just plug an USB cable and open Arduino IDE. Then, from the Arduino IDE "Tools" menu, select the type of board "Arduino UNO" and the port where you plugged the board (/dev/ttySn for Linux, COMn for Windows), press run and the C/C++ ino sketch will be loaded and run on the Arduino board.

author: westfw
author_rank: Super Contributor
timestamp: January 15, 2021, 01:43:44 am
content: QuoteThe current "official" low-cost programmer for AVRs is the Microchip SNAP:https://www.microchip.com/developmenttools/ProductDetails/PartNO/PG164100It handles pretty much ALL of the Microchip micros, including PICs, SAM, and the wide variety of AVRs (ISP, TPI, UPDI, PDI, JTAG.) It also supports debugging, and will interface to MPLABX on linux. I'm not sure about the status of support for 3rd-party tools like AVRDUDE.Pololu has what looks like a nice AVR programmer:https://www.pololu.com/product/3172No debugger support.The "USBASP" programmers - widely cloned and available "very cheap" from China, based onhttps://www.fischl.de/usbasp/are popular, but the software USB is apparently getting "risky" when you try to use it with newer PC chipsets and software.I have an Atmel ICE, a PICKit4, and several SNAPs, but I mostly run the "Arduino as ISP sketch" on a spare Arduino compatible board I have sitting in front of me. It has the "warm and fuzzy" feeling that I can go in and FIX the programming algorithms if something isn't quite woring right. Also no debug support, though.None of these support the high-voltage tweaks necessary for re-using the debug/reset pin as GPIO (esp useful on very-low pin-count chips.)You might also want to look at the low-end "development boards" available from Microchip. Both the "Xplained Mini" and "Curiosity Nano" boards run less than $15, and include an on-board programmer/debugger chip as well as whatever target you pick. An Xplained Mini 328p, for example, has Arduino Uno compatibility, mostly, plus the built-in debugger, and costs $10. At least In theory, you can disconnect the debugger from the target and use it to program other chips.QuoteNo, it doesn't. The Uno has an onboard USB to Serial adapter, and uses a bootloader to suppory programming over the serial port.You can, incidentally, use that bootloader to program code that wasn't written using the Arduino IDE...QuoteQuoteYour rejection of "Arduino" is overly vehement. Using Arduino doesn't PREVENT you from "understanding the MCU" or "having full control over registers." It mearly prevents that from being necessary.You can turn off and undo any code that the Arduio IDE and "core" sets up for you.You can write pure C or C++ programs (or even ASM) using the Arduino IDE, completely bypassing the Arduino functions.The Arduino abstractions are so high-level that they don't support many of the features of the chips, so if you want to use them you'll have to write your own code anyway (or, I guess, hunt down code that does it that has already been published.)

author: magic
author_rank: Super Contributor
timestamp: January 15, 2021, 10:36:26 am
content: If you don't need fuse access, get yourself a mega32U4 with Atmel's DFU bootloader on some breakout board (or DIY a board), and you can upload hex files over USB. That's how I test my AVR codes when I'm feeling lazy, which is most of the time.BTW, isn't it possible to burn non-Arduino hex files into Arduino boards? I would expect that Arduino's bootloader and PC tools just doesn't care.

author: Jmellipse
author_rank: Newbie
timestamp: January 15, 2021, 06:57:05 pm
content: I bought 2 mySmartUSB mk3’s. They support a lot of programming modes as well as i2c and other goodies.https://shop.myavr.com/index.php?sp=article.sp.php&artID=100058

author: steerex
author_rank: Newbie
timestamp: January 17, 2021, 01:02:11 am
content: I do my programming in C using Notepad++, compile with avr-gcc, upload using avrdude to a STK500. I don't care for AStudio so only use it for setting the fuses. The STK500 has an ICSP connection for programming devices outside the development board which I find useful.Generally when building projects, I will include a ICSP port in the design so changes can be made to the software even after a project is "complete".

author: S. Petrukhin
author_rank: Super Contributor
timestamp: January 17, 2021, 09:12:56 pm
content: One day I accidentally saw a promo and was able to buy Atmel-Ice for half the price from microchip. For many years I have been using this programmer (recently rarely, Atmel is out of my use) never had any problems. But before that, I used a cheap chinese usbasap - it also coped with all the tasks, but only on the ISP, it does not support other protocols for the CHIP.

author: rfclown
author_rank: Frequent Contributor
timestamp: January 17, 2021, 09:52:57 pm
content: I use a USBisp that I got off eBay for less than $5 US. I use it with avrdude. Don't be turned off just because something says Arduino. So many people are looking for Arduino, that if it can be used in any way with an Arduino, they'll put that in the title to sell more. The USBisp is like that. You can select "Sketch>Upload Using Programmer" in the Arduino environment and use the USBisp instead of the Arduino bootloader. You can use the Arduino IDE without really doing anything the Arduino way. I often start out with the Arduino IDE just to get started, then later switch to gcc on the command line and avrdude to program. But with both I use the USBisp and don't use a bootloader.

author: radar_macgyver
author_rank: Frequent Contributor
timestamp: January 17, 2021, 10:12:58 pm
content: As mentioned above, the AVR USB ISP v2, many clones exist. For example:https://www.ebay.com/itm/Aluminum-shell-USB-ISP-USBISP-USBASP-ASP-Programmer-for-51-ATMEL-AVR-928/254379049961They're much cheaper than the 'official' AVRISPMKII, and work with avrdude.

author: Renate
author_rank: Super Contributor
timestamp: January 17, 2021, 11:49:37 pm
content: I had an Atmel ISPMKIII that I ended up getting for free.I read about DGI, the Data Gateway Interface (which is halfway implemented in the MKIII but not working).I ended up buying an AtmelICE which is the successor to the MKIII.It has the DGI implemented.Ok, DGI is not rocket science, it's only a way to use the SPI (ISP) interface separately from programming.If you're using a 6 pin ISP adapter, you'll have to bodge in the CS (chip select).The good point is that you can program a device then seamlessly switch over to the DGI interface to see all your debug print() come out at 8Mb/sI've never been much of a gdb/trace/breakpoint debugger, I'm more LED or print().I'm not sure if any clones support DGI.The AtmelICE (AFAIK) is still going for ~$120 US, BUT, you can buy just the circuit board (without case or cables) for ~$60 US.Code:atmelice atmega328p /e /p /v /b250 blinky.hexAtmel-ICE CMSIS-DAP J42700031415 01.26.0081Loaded blinky.hexProgram succeededdgimonHi, I am blinky coming to you over the SPI interface at 8Mb/sec!Hi, I am blinky coming to you over the SPI interface at 8Mb/sec!

author: poorchava
author_rank: Super Contributor
timestamp: January 18, 2021, 07:52:58 pm
content: For strictly AVR ISP protocol old-school USB-ASP works well. The smallest stuff (like ATTiny 5) uses something called TPI. You need a clone of AVR ISP MKII. Atmel original programmers are priced ridiculously. Besides, there is 0 reason to use AVRs that have more than 6 pins. Some STM32s can be had for like 0.5€ offering much higher performance.Also, IIRC Atmel programmers have a monstrous mess when it comes to drivers. I've had a customer, who gave up after half a year of trying to cobble together a batch file for flashing some small AVRs. They ended up using Atmel Studio in production...

author: Renate
author_rank: Super Contributor
timestamp: January 18, 2021, 11:43:03 pm
content: Quote from: poorchava on January 18, 2021, 07:52:58 pmUgh. Atmel used some bogus half-baked server/client architecture for programmers that was a disaster.And I don't much like Atmel Studio either.Even in the 21st century a good command line utility has its place.The previous example had two of mine.

author: fchk
author_rank: Frequent Contributor
timestamp: January 20, 2021, 03:43:34 pm
content: Quote from: kgavionics on January 13, 2021, 05:38:45 pmSorry, PICKIT3 won't work for any AVR - it has not enough IO pins. PICKIT4 has two additional pins in order to speak ISP, SPI, JTAG, and the other pins are more flexible in order to provide PDI, UPDI and TPI.The other well supported alternative is ATMEL ICE. Also not a cheap solution at all.Quote from: kgavionics on January 13, 2021, 05:38:45 pmhttps://www.instructables.com/Arduino-AVR-Progamming-Shield/You will loose debugging capabilities, though. ISP is only good for loading code into the flash. No breakpoints, no singlestep, no peek into registers - nothing. Just fire-and-forget.If you want debugging capabilities as you know it from PIC then you absolutely MUST spend the money for either PICKIT4, ICD4, or ATMEl ICE. You will need either dW or JTAG support for debugging - ISP won't work.If you want really cheap debuggers, choose ARM.