AnsweredAssumed Answered

Runtime FLASH erase issue (9S08DZ60A)

Question asked by Chris Belsky on Jul 28, 2009
Latest reply on Mar 11, 2010 by kef

Hello,

I'm working on an application using the MC9S08DZ60ACLH where I'd like to store the "factory configuration" into a block of FLASH to be used later for a "restore to factory defaults" reset service routine.  I currently have successful EEPROM erase/write routines, so my first impression was to adapt these to a FLASH erase/write routine.  I've investigated the forums on FLASH erasing/writing and have started by implementing the common CopyToRAM() function in order to execute the FLASH erase/write from RAM.  This CopyToRAM() executes fine.  The problem is after executing the Erase_FLASH() function during runtime from RAM, my controller UUT gets 'lost', resets a few times (assuming due to the COP) and then finally locks up.  A curious symptom is that if I step through the Erase_FLASH() function using the CodeWarrior Real-Time Debugger, then the UUT will NOT lock up and a 256-byte block of FLASH will successfully erase, but if I simply start the firmware from the beginning running real-time the UUT operates OK until it executes the Erase_FLASH after which it resests then locks up.  I've attached my implementation.  A couple questions:

 

1)  Has anyone seen this symptom before?

2)  After examining my code, can anyone see where I'm going wrong?

3)  Does anybody know where I can find exactly the addresses of the FLASH blocks?  Perhaps I'm erasing a block containing code (even though I believe I have my PRM file setup correctly and the MAP file seems to verify this).

4)  The DZ60A data sheet says the FLASH block size is 768 bytes, why would the Real-Time Debugger Memory window only show a 256-byte block erased?  I'm wondering if this is real or if the Real-Time Debugger is giving me bogus data. 

 

Thanks very much for your input.

~

 

Copy_of_IFC_DZ60.prm

Copy_of_RAM_Funcs.c

Copy_of_Main.c

Message Edited by belskyc on 2009-07-28 04:25 PM
Message Edited by t.dowe on 2009-09-04 02:06 PM

Outcomes