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!
Solved! Go to Solution.
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
Is the flash erased?
Have you initialised FCLKDIV ?
What bitsize is "unsigned" ?
Have you checked the assembly output?
James
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
Thanks for James and Nandu, I confiuse Logical with Global Space.
thanks
chowjun