Author Topic: Programming an AVR using the official AVR ICSP on linux  (Read 3156 times)

0 Members and 1 Guest are viewing this topic.

Offline Kdog44Topic starter

  • Contributor
  • Posts: 39
Programming an AVR using the official AVR ICSP on linux
« on: July 26, 2014, 09:06:52 am »
I want to program using the ICSP from AVR on linux using the terminal. I have installed the AVR tool chain. My target is an ATMEGA328 chip. I made the assumption that the AVR tool chain comes with drivers for the ICSP. I went through the cd that came with the programmer and did not find any driver software. The circuit I was using was basic. Just a capacitor to smooth out the input voltage, an LED indicating there is power, and the ATMEGA328 chip (with power and ground connections) connected to the ICSP header. Nothing much at all, just a standard test circuit. The command that I ran in the terminal was:

Code: [Select]
 sudo avrdude -p m328 -c avrispmkII   

The message I got back was:

Code: [Select]
 avrdude: stk500v2_command(): command failed
avrdude: stk500v2_program_enable(): bad AVRISPmkII connection status: Target not detected
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

The status LED on the programmer was green when power was connected to board, so I believe it identified the target. Do i need some special driver software for the programmer? What is the next step?

 
 

Offline Bored@Work

  • Super Contributor
  • ***
  • Posts: 3932
  • Country: 00
Re: Programming an AVR using the official AVR ICSP on linux
« Reply #1 on: July 26, 2014, 10:48:40 am »
There is no such thing as ICSP for AVRs (the Arduino people get that constantly wrong). So in reality, what is that "official AVR ICSP" hardware thingy you are using?
I delete PMs unread. If you have something to say, say it in public.
For all else: Profile->[Modify Profile]Buddies/Ignore List->Edit Ignore List
 

Offline firewalker

  • Super Contributor
  • ***
  • Posts: 2452
  • Country: gr
Re: Programming an AVR using the official AVR ICSP on linux
« Reply #2 on: July 26, 2014, 11:56:56 am »
I guess you are using a cheap usb ISP. The most common error is bad wiring. From the header to MISO, MOSI, SCK, RESET pins.

Alexander.
Become a realist, stay a dreamer.

 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3322
  • Country: gb
Re: Programming an AVR using the official AVR ICSP on linux
« Reply #3 on: July 26, 2014, 01:17:41 pm »
There is no such thing as ICSP for AVRs (the Arduino people get that constantly wrong). So in reality, what is that "official AVR ICSP" hardware thingy you are using?

If you can't perform In Circuit Serial Programming on AVR's then I have apparently been performing the impossible for many years.  Or are you trying to point out that Atmel's own name for this method is "In System Programming"?

The 'official tool' for AVRs that support the ISP interface would be the AVRISP.
 

Offline Bored@Work

  • Super Contributor
  • ***
  • Posts: 3932
  • Country: 00
Re: Programming an AVR using the official AVR ICSP on linux
« Reply #4 on: July 26, 2014, 01:28:45 pm »
If you can't perform In Circuit Serial Programming on AVR's then I have apparently been performing the impossible for many years.

No, you have decided to adapt Arduino idiot-speak, that's all.
I delete PMs unread. If you have something to say, say it in public.
For all else: Profile->[Modify Profile]Buddies/Ignore List->Edit Ignore List
 

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6289
  • Country: 00
Re: Programming an AVR using the official AVR ICSP on linux
« Reply #5 on: July 26, 2014, 02:17:26 pm »
This is the script I used to program boards with blank atmega328p using AVRICSP MKII.  This is for Mac OS but should be similar for Linux.

https://github.com/zapta/power-monitors/blob/master/pmon_3v8/firmware/icsp_program_all.sh

Notice the -B 4 flag, it reduce the bit rate of the programmer. The blank atmega328p comes stock configured for 1Mhz clock and the ICSP speed should not be faster than 0.25% of that.

The avrdude on my machine was installed as part of the Arduino IDE. I am not sure if it also installed any AVRICSP MKII specific drivers.

As others said earlier, verify your wiring and also make sure you don't overload those signals with LEDs etc (if you have an oscilloscope, look at the signals and verify that they are clean).
 

Offline Kdog44Topic starter

  • Contributor
  • Posts: 39
Re: Programming an AVR using the official AVR ICSP on linux
« Reply #6 on: July 26, 2014, 07:17:29 pm »
I am using the AVRICSP MKII.
 

Offline radioFlash

  • Regular Contributor
  • *
  • Posts: 163
  • Country: us
Re: Programming an AVR using the official AVR ICSP on linux
« Reply #7 on: July 26, 2014, 10:10:38 pm »
I am using the AVRICSP MKII.

To be precise, it's the "AVRISP MKII" and should look like this : http://www.atmel.com/tools/avrispmkii.aspx. One thing about this programmer: it doesn't provide power to the device being programmed, so you need to provide that separately. I was getting nowhere, until I watched Dave's video in which he talks about a mod that provides power from the USB pin. You need to either provide power to the device you're programming, or you could mod the programmer as Dave describes:

http://www.eevblog.com/2011/03/25/eevblog-158-avr-isp-mk2-lm317-regulator-tutorial/
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf