While developing code for the ADuCM320 I managed to lock myself out of the part.
Why did that happen and what can I do to recover the part?
While developing code for the ADuCM320 and other ADuC parts it's recommended to have a bit of code at the start that just waits for a few seconds before any other code is run.
something to note while writing a software delay is that the compiler might optimise it so it's recommended to read a MMR as the compiler will not optimise that away.
Here is a bit of code that we use in our examples
for (i = 0; i<100; i++)
DioTgl(pADI_GP2, BIT4); // Toggle LED, P2.4
for (j = 0; j<100000; j++) k = pADI_GP2->GPIN;
There are a number of ways that you can lock up a part:
Depending on when the lockup condition happens, it might be possible to generate a reset and then quickly enter debug mode, halt the core and do a mass erase. Another alternative is to try to use the MDIO downloader to perform a mass erase.
If the above two methods do not work a new part would have to be used, and in the future that delay should be added or some debug code that for example checks the status of a pin and stops from exucuting anything else.
Retrieving data ...