Bootloader doesn't run on internal reset?

Hello,

I'm trying to make my own board with a ATmega328P, and I would like to begin as simple as possible. So now I connected only VCC/GND/AVCC/AREF, and a LED on D13. As far as I understand the ATmega328P has an internal reset pull-up, which is quite weak but still usable. I have compiled the bootloader for 8MHz and 38400 baud, and adjusted boards.txt, and everything is running quite well on my Uno board.

But when I put the chip on my perfboard, the bootloader doesn't run, and it goes staright to the application code, thus I can't upload code (without a programmer). If I manually touch RESET to GND, then the bootloader runs after reset. If I manually hold RESET to GND before powering up, then the bootloader runs as well (after I release RESET). But if I power it up without RESET connected to anything then the bootloader doesn't run.

Could anybody give me some help? Thank you very much.

yes on power-on the Optiboot doesn't wait for programming

It doesn't look like the bootloader is running at all? The LED doesnt blink three times.

On the other hand the same chip works on Uno board...

Could you show a photo and/or a schematic ?
Then we can tell to connect both GND pins, not to connect AREF, and ask where your decoupling capacitor are. The decoupling capacitors are important, they really are.

The 'real' Arduino has a 100 nF capacitor between the DTR pin of the USB-to-Serial converter and the Reset pin. Without that you have to do a manual reset to upload.

Correct. The m328p reports "reset cause" to the bootloader.
If the reset cause is "Power On Reset", the bootloader skips everything (including the blinks) and starts the application.

The latest optiboot source actually has an option to supress this behavior, thanks to DrAzzy's work with the ATtiny chips.

make atmega328 BOOT_ON_POR=1

The decoupling caps are 4.7uF + 47nF, I think it's OK.

Why did you say to not connect AREF?

Thanks, but why does it run on the 'real' arduino board?

Does it? I've seen cases where a power-on causes both Power-on AND Reset flags to be set in the cause register. Presumably it's because of the relative timing of the power supply coming on, and the reset waveform (which is getting pulled up by the power supply, after all.)
I'm not sure exactly how the poweron sequence has to go to get ONLY POR.

or because Serial Monitor sends a reset

There is an example that connects AREF to VCC, but that is wrong.