Confused in my Program

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

Confused in my Program

Jump to solution
1,880 Views
chowjun
Contributor I

 I want to use data flash in s12xs128 

 

void Dflash_Wt(uint paddr,unsigned dat){  while(FSTAT_CCIF == 0);       //Waiting Complete  FSTAT   = 0X30;               //Clear ACC PVI  FCCOBIX = 0;                  //step 0   FCCOBHI = 0X11;               //0X11  FCCOBLO = 0x10;               //D-FLASH block address  FCCOBIX = 1;                  //step 1  FCCOB   = paddr;              //Global Address Of Word To Be Program  FCCOBIX = 2;                  //step 2  FCCOB   = dat;                //Word 0 program value  FSTAT |=0X80;                 //lunch command  while(FSTAT_CCIF == 0);       //Waiting Complete}

paddr = 0;

dat    = 0x55;

 

after functoning this program  , the the word 0x55 can't be written , I look the address 0x100000 ,but it is empty.  I don't know which part of the code is wrong?

thanks!

Labels (1)
0 Kudos
1 Solution
511 Views
nandu
Contributor III

Apart from the points mentioned by James, if you are using Codewarrior Compiler and the debugger is "True-Time Simulator & Real-Time Debugger", then right click on the "Memory" window and select the

"Adress  Space" option to 'Global'. In general this debugger sets this option as 'Logical'. So, this can be reason that you could not see any data at memory location, because debugger shows the logical address when the "Address Space" is selected as 'Logical'.

 

Hopes this helps

View solution in original post

0 Kudos
3 Replies
511 Views
jsmcortina
Contributor III

Is the flash erased?

Have you initialised FCLKDIV ?

 

What bitsize is "unsigned" ?

 

Have you checked the assembly output?

 

James

0 Kudos
512 Views
nandu
Contributor III

Apart from the points mentioned by James, if you are using Codewarrior Compiler and the debugger is "True-Time Simulator & Real-Time Debugger", then right click on the "Memory" window and select the

"Adress  Space" option to 'Global'. In general this debugger sets this option as 'Logical'. So, this can be reason that you could not see any data at memory location, because debugger shows the logical address when the "Address Space" is selected as 'Logical'.

 

Hopes this helps

0 Kudos
511 Views
chowjun
Contributor I

Thanks for James and Nandu, I confiuse Logical with Global Space.

 

 

thanks

chowjun 

0 Kudos