not possible to install bootloader on a new atmega328P in an Arduino?

Is it possible to use avrdude to set up a brand-new atmega328P with the arduino bootloader using a USB programmer (e.g. AVR ISPmkII)? I want to just plug new chip into socked on Arduino to program.

I had the idea that this was possible and thought I'd done it in the past. The AVRISPmkII shows two green LEDs which is usually a good sign. But when I try this command to get the fuses set up:

avrdude -c avrispmkII -p m328p -P usb -e -u -U lock:w:0xFF:m -U lfuse:w:0xFF:m -U hfuse:w:0xDA:m -U efuse:w:0xFD:m

It complains that the device signature is wrong (log below). If I try -F option to override the force operation despite wrong signature I get "verification error, first mismatch at byte 0x0000 0x00 != 0xff"

I see a number of tutorials on web that don't describe programming this way, but instead put chip on a separate breadboard first, so maybe it just isn't possible?

Here is what avrdude says to the above command:

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x000000 (retrying)

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x000000 (retrying)

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x000001
avrdude: Expected signature for ATmega328P is 1E 95 0F
Double check chip, or use -F to override this check.

Is it possible to use avrdude to set up a brand-new atmega328P with the arduino bootloader using a USB programmer (e.g. AVR ISPmkII)? I want to just plug new chip into socked on Arduino to program.

Of course, it is possible.

If I try -F option...

Don't.

Zeros in response points to unreachable target. Something with your circuit, connection etc. Make sure that the target is powered, because I think, AVRISPmkII does not provide the power.

BTW, for testing purpose, it is better to use avrdude command without write operation. Use read instead or just with -v (up to -vvvv).

I thought it was. But maybe we have a misunderstanding, because there isn't anything to my circuit to be connected wrong: it's just an arduino with a virgin chip in it's socket, a power supply, and a AVRISPmkII connected. But it doesn't work as reported above.

I suspect the problem is with the AVRISPmkII itself. Apparently the AVRISPmkII caches some state, and I tried the baudrate configuration file option to avrdude (to try to get fastser programming). That made all programming of all chips not work for the remainder of that session, but now following a reboot I find that programming of an already-programmed chip is now screaming fast, but programming of virgin chips still doesn't work at all (as described).

So my current theory is that my AVRISPmkII now has a really high ISP frequency setting. So now my goal is to figure out how to read settings off it, which sounds like it might be possible only with AVR Studio, and I'm on linux so that's not an option :frowning:

Ok, if it is the issue try it with -B parameter. I found this: "8.0 is a good conservative choice". You can find some older discussions
around AVRISPmkII here on the forum.

Post the whole log not only snippet.