Okay... this may be slightly off topic... I'm suspecting hardware more than software.
Here's the problem... I've done KEIL projects for AT91SAM7S32 and AT91SAM7S64 boards and the hardware has always come out of reset and started to execute code reliably when not using the debugger.
Now I've tried (2) different AT91SAM7S256 designs, and they've both behaved differently in that sometimes the code just doesn't appear to come out of reset reliably. I simplifed both projects to do nothing but configure the H/W reset input and an I/O pin to be a driver, and then toggle that I/O pin in an infinite loop but that code does not run reliably. I am using a 4-layer board with a ground plane, and all the oscillator, reset and JTAG port stuff is a direct cut/paste from my working designs using the S32 & S64 parts.
I added code to enable a ~1 second watchdog timer, and that seems to fix the problem, in that when the I/O pin doesn't toggle after a power up reset or hardware reset it does come to life after ~1 second when the watchdog timer times out.
Does anybody know of anything that could be responsible for this type of symptom...?
Thanks, Dave.
Do you see a problem with that math?
Not now. :-) PLL min/max seem to be okay, now.
BTW, do you wait for the PLL to settle down after programming the MUL and DIV, I suppose you are?
while(!(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_LOCK)); while(!(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY));
Is your AT91C_CKGR_PLLCOUNT sufficient for the setup time?
Then I would re-check the PLL's ext. RC values. There is a new release (v2.31) of the spreadsheet PLL calculator.
Good luck, man! :-)