Optiboot with Power-On Reset

Hi,
I'm trying to run optiboot bootloader on my ATMega328PB with not only external Reset also with Power-On Reset.

I modified the source file like this, and excluded PORF.
Shouldn't start the bootloader now also on POR??
But the bootloader doesn't start with POR, it still starts only with external reset.
Any idea what I am missing ?
Thanks!

int main(void) {
	uint8_t ch;
	register uint16_t address = 0;
	register uint8_t  length;
	asm volatile ("clr __zero_reg__");

	ch = MCUSR;
	MCUSR = 0;
	if (ch & ((1<<WDRF) | (1<<BORF) /*| (1<<PORF)*/))
	appStart(ch);
    ...

Yes, but only if no BOR was detected. Did you ensure in your circuit that this cannot happen?

Yes, you are right, as BOR also seems to happen together with POR, when you disconnect/connect the power supply.
Additionally checking for this, the bootloader works fine now.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.