I've got accassional starup issues on some boards with an ATmega2561. On about 10% (seems to fluctuate a lot!) the Processor does not seem to start on first power on. Only a power cycle lets the MCU start. I've researched online and tried different things. I made several hypothesis and tested them but I have been able to disporove all of them. I've checked the Datasheet several times but could not find any clue as to what I could be doing wrong.
The Problem shows itself in the following way:
- Switch on power
- SW won't start (no communication on UART no LED-Blink (which both should happen when the SW runs))
- Switch power off and wait 10s
- Switch on again
- MCU starts
If I switch off the power for >3 Minutes the problem appears again. If a Board has the problem it's perfectly reproducible. Replacing the MCU solves the problem. I've also checked the Power. MCU runs at 5V. The 5V switches on within a few microseconds and is rock solid stable (checked with Oszilloscope and Multimeter in Min/Max-Setting)
Also: I CAN programm the MCU via ISP if it is in that hung state
External Ceramic Resonator does not start because of wrong fuse settings I could disprove that by measuring the frequency with an oscilloscope and by setting the MCU to use the internal R/C oscillator (which should start)
Something with the external reset circuit Reset/ is high and stable 200ms after power on (that's the time the external reset is pulled low).
The MCU is in some undefined state for some unknown reason after startup Pulling reset low for any amount of time did not get the MCU started
So, it seems I'm out of ideas. What's more: This board has a bootloader which I use to load an application. If there is a valid application the bootloader immediately starts the app in it's first line of code. The problem exists independently of state. It does not start into bootloader nor application. So if it's not a hardware issue it must be software. But the only thing common between application and bootloader is basically one line of C-Code (that calls a few functions to read from EEPROM and FLASH to check if a valid application is installed)...
Anyone has an Idea on how to tackle this problem? Could it be a software issue? Buth than, why does it not happen on all the MCUs?
As suggested in the comments I've measured AVcc in relation to Vcc during Power on. Channel 1 (yellow) is Vcc, Cannel 2 (cyan) is Aref And there seems to be the Problem! Aref (and also AVcc) is rising much faster than Vcc.
SOLVED! (at least it seems) Adding a resistor in front of the LM7805 that creates the Aref and AVcc to limit the current (and therefore charge the capacitors slower) brought the AVcc on after Vcc and now a Board that had the problem boots normally. Thanks everyone!