Confused in my Program

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

Confused in my Program

跳至解决方案
2,486 次查看
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!

标签 (1)
0 项奖励
回复
1 解答
1,117 次查看
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 项奖励
回复
3 回复数
1,117 次查看
jsmcortina
Contributor III

Is the flash erased?

Have you initialised FCLKDIV ?

 

What bitsize is "unsigned" ?

 

Have you checked the assembly output?

 

James

0 项奖励
回复
1,118 次查看
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 项奖励
回复
1,117 次查看
chowjun
Contributor I

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

 

 

thanks

chowjun 

0 项奖励
回复