Max Yang

A batch of Flash writing

Discussion created by Max Yang on Jun 6, 2007
Latest reply on Jun 18, 2007 by Diego Nunes

Hi all,
I implemented a Flash driver for E64.
The functionalilty of driver have Flash erasing, Flash writing...etc.

But there is a situation very strange when doing a batch of Flash writing.(See following pseudo code)
It will run very smoothly in debug mode(Use BDM and press debug button on Metrowerks IDE),
every word(0x1111) you programmed is correct, but in free running mode(Turn off EVB power then turn on EVB power) you'll see there are a lot of word incorrect. (How can I see the word is incorrect? Because I didn't disconnect BDM from MCU, if you wanna see the Flash, you just need to press reset button on Hi-Wave. Remember to set the mode of memory window as periodical then double click any memory.)

Pseudo code:
INT32U StartAddress = 0x003C8000;
INT16U Word = 0x1111;
for(; StartAddress<0x003CBFFF; StartAddress+=2)
    Flash_WriteWord(StartAddress, Word);



Attached file, TestFlashProg.rar can be opened by Metrowerks CW3.1.
If you do not have E64 EVB, you just change header file usage, <MC9S12E64.h>.
First, you have to select target, Flash RAM Func in Metrowerks and make it.
Second, open Hyper-Terminal set baudrate as 19200bps.
Third, select target, Bootloader and build then you can start to run this project.

-----------------------------------
Thanks for looking.
TestFlashProg.zip

Correct5.jpg

Error2.jpg

Message Edited by t.dowe on 2009-10-21 12:46 AM

Outcomes