HC12: Error related to the data loading into the flash

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HC12: Error related to the data loading into the flash

2,195 Views
AjayKadambala
Contributor I
This is the prbloem related to the flash,
 
when the fault occurs then whole data relaed to the error is loaded into the flash and then control is given to handle that fault...
 
while writing the data into the flash into the block 0 (the bksel=0,PPAGE =3E were already set ) it is setting the ACCERR bit ....
 
the same is not happening when the bksel=1and the PPAGE =3E.
 
 
if found any solutions/ or any suggestion please mail me..........
 
Thanking you
 
Ajay Kadambala

Message Edited by CrasyCat on 2007-04-13 11:39 AM

Labels (1)
Tags (1)
0 Kudos
4 Replies

1,071 Views
J2MEJediMaster
Specialist I
What processor are you targeting? It sounds like the HC(S)X12. Are you trying to download a program via the debugger, or is this Flash programming code that you've written that's trying to update the contents of Flash?

---Tom

1,071 Views
AjayKadambala
Contributor I
Mr Tom
 
The microcontroller we are using is HCS12 and we are downloading the code through debugger(True time simulator which is in built in the metrowerks) .
 
Here is the clear description of the problem :
 
1. by using # pragma we made the code to reside in the 3E
2. if the fault occurs the whole status of the project and the 1k of stack data should be stored in stored in the flash(requirement) ..
3.for this we are selecting the Bank 0 (BKSEL=0) and PPAGE=3E, the ACCERR bit sets if attempted to write the data into the flash..
4. for the same data to write , if we are selecting the Bank 1(BKSEL=1) and PPAGE =3E, the ACCERR bit is not setting .
 
if any further doubts regarding the problem please mail me at kadambala.ajay@meddcl-i.com
 
Thanking you,
 
Warm Regards,
Ajay Kadambala..
0 Kudos

1,071 Views
CrasyCat
Specialist III
Hello
 
Not sure I understand here.
First there is no chances that the application can work if you try to allocate the stack in flash.
Stack should be allocated in RAM.
 
Second, are you trying to program some data into flash from your application?
On HCS12, if you are running flash programming code from flash, you can only program banks located in another block. A block is a set of 4 flash pages (or banks).
 
Please refer to your hardware manual to check which pages are in block 0.
Check where the programming algorithm is located and where you are trying to program the code. If the two banks are allocated in the same block, it cannot work.
 
CrasyCat

1,071 Views
rocco
Senior Contributor II
Hi CrazyCat:

CrasyCat wrote:
First there is no chances that the application can work if you try to allocate the stack in flash. Stack should be allocated in RAM.
I think he meant was that, in the case of a firmware failure, the stack should be copied from RAM to Flash. Sort of like a crash dump.