Flash Problem

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

Flash Problem

583 Views
xiaoli
Contributor I

My question is :

1. Why the Y value is 0xFFFF, but not what i write? and the map file is true.

2. Why i can't see the true value when i selected the PPAGE = 0x38, but the addr 0x38xxxx is always 0xFFFF at the memory window.

 

I use MC9s12DG256B IC, and CSW IDE. True-Time Simulator & Real-Time Debugger.

at start file, the source code :

 

PPAGE = 0x38;

...

#define __MMCTL_SET(value) ((...

  __MMCTL1_SET(...

#endif

 

  __asm {

  ldx #$95BA               ; Here the X value = 0x95BA    PPAGE = 0x38

  ldy 2,x+                 ; Here the Y value = 0xFFFF, is wrong.

  ...

  }

 

 

and at the True-Time Simulator & Real-Time Debugger, memory always see 0xFFFF @ addr 0x3895BA.

but at the \bin\PE_Multilink_CyclonePro.map:

  VAR012       3895BA 2 2 0 ROM_38

 

 

Thank you very much.

Labels (1)
0 Kudos
2 Replies

467 Views
iggi
NXP Employee
NXP Employee

Hi,

First of all ensure the CW project you have opened is Banked or Large Memory model. If it would be Small Memory model, then there is access to 64K linear addresses only.

What the LDY instruction does in your case, it loads the Index register Y with the contents of address 2 + 95BA = 95BC.

Now you forgot to put $ string in front of number 2.

Anyways, the content on the memory location 0x3895BC is 0xFFFF.

Try LDX #$8000 to check if it  reads correctly.

You can try this function to read the memory location and ensure it's correct:

-------------------------------------------------------------------------

volatile unsigned int readData;

unsigned int Flash_Read_Word(unsigned long int addr)

{

  return *(unsigned int *far)addr;

}

void main(void) {

  //read word at 0x30_8000

  readData = Flash_Read_Word(0x308000);

  for(;;) {

    _FEED_COP(); /* feeds the dog */

  } /* loop forever */

  /* please make sure that you never leave main */

}

----------------------------------------------------------------------

You can put there any address instead 0x308000.

If you expect other value to be read from that location, then your write function is not good.

Regards,
Ivan

0 Kudos

467 Views
xiaoli
Contributor I

First of all ensure the CW project you have opened is Banked or Large Memory model. If it would be Small Memory model, then there is access to 64K linear addresses only.

As: My CW Project is Banked Memory model.

What the LDY instruction does in your case, it loads the Index register Y with the contents of address 2 + 95BA = 95BC.

Now you forgot to put $ string in front of number 2.

Anyways, the content on the memory location 0x3895BC is 0xFFFF.

Try LDX #$8000 to check if it  reads correctly.

As: I just Wanted to Try to Get a data from addr=0x95BA the Value at addr 0x95Ba = 0x95BC. so, it's no problem.

and also at $8000 , at memory is always 0xFFFF.

pl's see my project and some file , such as : asm_main, prm file, start file. and map file. there is a picture about my project run status.

Thanks for your answer.  your are so nice.

0 Kudos