AnsweredAssumed Answered

Problem of writting PPAGE

Question asked by Jason Cui on May 9, 2016
Latest reply on May 11, 2016 by Radek Sestak

Hi, all

 

I have an application that's reading data back from programmed flash. I'm using the CW of version 5.9.0, and the chip

is MC9S12XEP100. The application code is stored in $C0 page, and the programmed flash is $C1, before read data, I assign the 0xC1 to PPAGE, but the assignment can result in program run away. I can't find what's wrong with PPAGE assignment, can't PPAGE be accessed directly, or I miss something? Does anybody else has the same situation?  The code I pasted below. Any help would be greatly appreciated!

..........................................

U8 temp_data[32];

U8 * ptr;

U8 page;

U8 page_backup;

U32 addr;

 

addr = 0xC18560;

ptr = (U8 *)(addr & 0xFFFF);

page = (U8)(addr >> 16);

             

if (page)

{

   page_backup = PPAGE;

   PPAGE = page;

}

.................................................

PS:

The same code is run ok in MC9S12G128. In this application, code is placed in 0 page.

Outcomes