Hello All
I decided to buy the Pololu USB AVR Programmer and am now trying to load the bootloader onto my Atmega328P chip.
I have put the chip on a breadboard and am powering the chip from the VBus(+5) and GND on the programmer itself.
Problem is when I try use the arduino environment to program it I get the following error...
avrdude: usbdev_open(): did not find any USB device "usb"
I have set my com port to 5 (which the USB programmer shows up on using the windows device manager), select the board as 'Arduino Duemilanove or Nano w/ ATMega328' and then select to burn bootloade using w/ AVR ISP mkII.
Why am I getting this problem?
I thought I would alternatively use avrdude directly, but I am unclear as to which bootload HEX to use and whether or not I need to mess with fuses??? The documentation that comes with the programmer gives a single line which looks something like
avrdude -p m328p -P COM5 -c avrispv2 -e -U flash:w:optiboot_atmega328.hex
(although the example is loading a blink program not the bootloader)
Do I write the bootloader to flash or EPROM and do I need to mess with fuses? Perhaps since I have a programmer I don't need a bootloader?
Anyway, the above command results in
avrdude: ser_open(): can't open device "\.\COM5": Access is denied.
I am on Windows Vista 32 bit??
Any assistance would be much appreciated
Hi Aeturnalus
Thanks for that.
I found the reason I was not getting a connection when trying to use avrdude directly was that the arduino environment was still open and holding the COM port open already.
I got it to program, but now it is taking a long time to verify... I keep getting timeouts such as the following...
Reading | ############### | 29% 561.43savrdud
e: stk500_2_ReceiveMessage(): timeout
Reading | ############### | 30% 576.47savrdud
e: stk500_2_ReceiveMessage(): timeout
Reading | ################ | 31% 591.51savrdud
e: stk500_2_ReceiveMessage(): timeout
Reading | ################ | 32% 606.55s
As for setting up the arduino environment for AVR ISP V2 - Thanks for the link. I will do as suggested. I will also add the 16MHz crystal and see what happens.
For anyone following these steps, the link given above is slightly dodgy as it contains quotes - use this instead.
Thanks to Aeturnalus I have managed to use the Arduino IDE to make and load sketches onto my breadboard ATMega328.
Note that this link tells you to add a number of entries to your boards.text file. These entries are fine if you are in fact using the pololu boards as mentioned, but be aware those boards are using a 20MKz crystal.
I added the following two entries to the boards.txt file which I then use to make and upload programs to my chip.
##############################################################
atmega328p16.name=16MHz ATmega328p via Programmer
atmega328p16.upload.using=avrispv2
atmega328p16.upload.maximum_size=32768
atmega328p16.build.mcu=atmega328p
atmega328p16.build.f_cpu=16000000L
atmega328p16.build.core=arduino
##############################################################
atmega328p8.name=8MHz ATmega328p via Programmer
atmega328p8.upload.using=avrispv2
atmega328p8.upload.maximum_size=32768
atmega328p8.build.mcu=atmega328p
atmega328p8.build.f_cpu=8000000L
atmega328p8.build.core=arduino
FWIW I am not bothering using a bootloader as I now have a programmer and don't need the bootloader 
Glad it worked out for you - the Pololu programmer is cheap and very capable for its price, but the Arduino environment tends to trick many people by listing the AVR ISP Mk2 on its options list, which is easily confused with the AVR ISPv2. Also - the extra usb-serial port on the programmer is quite useful - solder up the pins and use it for debugging.
- the Arduino bootloader expects an external clock at 16MHz, unless you've changed the defaults - the flashing process will set the ATMega328P to expect this external crystal, ...
Be careful, these are not the same. An external clock is a square wave, frequently provided by an external oscillator in a four pin metal can. The Arduino uses an external crystal which is in a small two pin metal can accompanied by two capacitors.
Don