ArduinoISP to program an atmega328p without bootloader?

I want to program an atmega328p without the use of a bootloader. I was thinking that I could just connect MISO, MOSI, SCK and RST on the stand-alone atmega to the corresponding pins on the arduino just like when burning a bootloader, but this doesn't quite work. Choosing the board to be Arduino UNO and programmer to be "arduino as ISP" after uploading the ArduinoISP scetch makes it upload my code, but it uploads it to itself thus overwriting the arduinoISP scetch.

(deleted)

I am using "Arduino as ISP", it isn't working.

(deleted)

Oh I see. I have a little bit of trouble understand what the difference between setting the programmer to "arduino as ISP" and pressing "upload using programmer". Does the latter mean to use the programmer that is on the arduino board? When doing as you said I get the error message "avrdude: stk500_getsync(): not in sync: resp=0xe0", but I'm thinking that something is wrong here because I can't upload the bootloader either (which I have done successfully several times in the past).

Now it seems to work. This is what I find the most frustrating about dealing with MCUs, they suddenly do what I ask even though I changed nothing :@

Another question though. If I have a bootloader already on the chip and then simply program a blink scetch using Ctrl+Shift+U, will it then overwrite the bootloader? From the microcontrollers perspective, there is no difference between a bootloader and a normal program, right? There's no special place in the flash memory for bootloaders or anything of that kind?

About changing the fuses. Is changing the board.txt file, then uploading a new bootloader follow by uploading my scetch using Ctrl+Shift+U a decent way of doing it?

(deleted)

Yeah alright :slight_smile: I still have an issue with setting the fuses though. If I've understood it correctly, I can't use the atmega328p with the arduino bootloader with anything but an external crystal clock source. This means that I can't set the fuses by re-uploading the bootloader (I've tried this and I'm getting an error message). I know that it's possible to set the fuses directly using AVRdude, but I have no idea of how to do this using ArduinoISP (or with any other programmer for that matter).

(deleted)