Rajarathinam Lawrence

Flash program and erase

Discussion created by Rajarathinam Lawrence on Apr 8, 2010
Latest reply on Apr 15, 2010 by Rajarathinam Lawrence

I am working flash program and erase in MC9S12DP256 controller.

 

i am not able write in flash area  , but i am using same command state machine.

 

i have attached my code give below ,i am using code worrier tool.

 

can u give some solution?

 

 progAdr=(unsigned short int *) 0xC000;
   
    bufferPtr=&buffer;
   
    FCLKDIV = 0x49;
   
    FCNFG=3;
    FSTAT_PVIOL=1;
    FSTAT_ACCERR=1;
   
    FCNFG=2;
    FSTAT_PVIOL=1;
    FSTAT_ACCERR=1;
   
    FCNFG=1;
    FSTAT_PVIOL=1;
    FSTAT_ACCERR=1;
   
    FCNFG=0;
    FSTAT_PVIOL=1;
    FSTAT_ACCERR=1;
   
    for(i=0;i<5;i++){
     
       if(FSTAT_CBEIF == 1) {
     
           *progAdr++ = *bufferPtr++;
           FCMD =0x20;
           FSTAT_CBEIF=1;
          
           if((FSTAT_PVIOL==1)||(FSTAT_ACCERR==1)) {
          
           return;
           }
       }
      
       while(FSTAT_CCIF!=1){
       }
      

Outcomes