HC12: Error related to the data loading into the flash

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

HC12: Error related to the data loading into the flash

3,159 次查看
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

标签 (1)
标记 (1)
0 项奖励
回复
4 回复数

2,035 次查看
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

2,035 次查看
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 项奖励
回复

2,035 次查看
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

2,035 次查看
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.