I teach in Montpellier University and we use Arduino kits for data acquisition and for the generation of PWM signals. It works well, however students are inexperienced (of course) and use to destroy the analog inputs and outputs of the microcontroller due to external connections.
So I wanted to flash myself Atmega328P chips to insert them again in my Arduino boards. I bought an AVRISP MKII for this purpose, it seemed to be the easyiest way. I installed the free AvrStudio 5 software, connected the AVRISP MKII to USB port and to the Arduino board, powered the Arduino board with a new Atmega328P chip and started to flash bootloader hex files found in the Arduino package. Once done, I tried to use the Arduino IDE for compiling and loading a scheme into the board : this last step doesn't work, whereas it works with all the Atmega328 which were factory-flashed.
It tried a last thing : I thought problems came from the fact that I was not sure which bootloader hex file I should flash. So I downloaded from an "original" arduino board the bootloader and tried to flash it again to a new Atmega chip. This does not work, the Arduino IDE cannot load a scheme.
I noticed however something surprising, perhaps is it normal, perhaps not : the AvrStudio says the voltage of the chip is 3.3 volts and not 5 volts. Is this normal ? Is there some kind of specific parameters I should give to the AvrStudio environment ?
The Arduino-IDE has tools to flash the bootloader for different µCs. So there is no need to use AvrStudio.
If you have an ISP programmer (like the AVTISP AVRISP) it is easy. I have done bootloading several times and these 2 sites did help a lot with the first steps:
"connected the AVRISP MKII to USB port and to the Arduino board, powered the Arduino board with a new Atmega328P chip and started to flash bootloader hex files found in the Arduino package. "
You are plugging the new chips onto an Uno or equivalent? Then just select Tools:Board:Uno, connect AVR ISP MKiit to the ICSP header (redwire goes on Pin 1 end), select Tools:Programmer:AVR ISP MKii, then select Tools:Burn Bootloader
When it's done, power down, pop out the chip, pop in a new one. Power up, select Tools:Burn Bootloader, and start the next one.
Atmel Studio may have loaded Jungo driver. The IDE can't use that. Uninstall Jungo and make sure the avrisp2.inf driver is installed.
You can find it in the Arduino/hardware/tools/avr/utils/libusb/bin folder. Or just search for it.
The IDE will also set the High, Low, and Extended fuse bytes for you. You have to do that as separate step in Atmel Studio, which may be part of the problem.
started to flash bootloader hex files found in the Arduino package.
Exactly WHICH bootloader .hex files? There are several in the distribution, and it's important to install the correct bootloader for the "board" type. (This is one of the things that the "burn bootloader" command will get right automatically.)