Huriye Nur DEGIRMENCIOGLU

Need Help About MCF51EM256 Flash Programming Routines

Discussion created by Huriye Nur DEGIRMENCIOGLU on Jan 31, 2011
Latest reply on Jan 31, 2011 by Huriye Nur DEGIRMENCIOGLU

Hi all,

 

I have a problem about flash programming for MCF51EM256. I downloaded application note by AN3942 document number and also downloaded software by AN3942SW number. And then I followed the instructions (also set my flash clock).  My erase function is running perfectly but my burst program is not. It is writing my datas to the given address but it can not jump to subroutine. Here are the burst code from AN3942SW;

 

 

/*******************************************************************************/

_Burst_Prog:
             move.l  d0,d4
             move.l  a1,a3
             move.l  a0,d2
             move.l  a0,d6

                  
             cmpi.l   #0x1FFFF,d6
             bgt.s    SEC_ROUT2
                             
             move.l  #(SpSubBurstEnd),a1
             move.l  #(SpSubBurst),a6
            
             bra     DOONSTACK2
            
SEC_ROUT2:   move.l  #(SpSubBurstEnd2),a1
             move.l  #(SpSubBurst2),a6


DOONSTACK2:  bsr     DoOnStack
                         
               cmpi.l   #0x1FFFF,d6
               bgt.s    SECOND_BLOCK2

FIRST_BLOCK2:
               move.l  a0,a1
               move.b  #(mF1STAT_FCCF + mF1STAT_FCBEF),d0            
               move.b  d0,F1STAT
               bra     JMP_STACK2
SECOND_BLOCK2:
               move.l  a0,a1
               move.b  #(mF2STAT_FCCF + mF2STAT_FCBEF),d0
               move.b  d0,F2STAT
JMP_STACK2:
              jsr     (A1)                      //The problem is here
           rts
 
/*******************************************************************************/
DoOnStack:
             move.l  A7,A2       /* save actual address SP */
DoOnStack1:
             suba.l  #2,a7      
            
             move.w  (a1),d0
             move.w  d0,(A7)
            
             cmpa.l  a6,a1       /* SELECTED #(SpSubBurst) or #(SpSub) */          
             suba.l  #2,a1
             bne.s   DoOnStack1

             move.l  A7,A0
             move.l  A2,A7
             rts

 

/*******************************************************************************/

 

What sould I do?

 

Thank you,

Nur

Outcomes