hi blood:
thanks for your reply!
indeed the rts made it. i've tried jumping to the flash routine and then jump back to a valid label with the same results. one issue was that i didn't have my interrupts stopped and setting the interrupt mask allowed me to program and erase flash.
now with my cyclone pro connected i can run the following routines and have success. if i power the target board off and back on the data shows up correctly, however, if if try to change some data with the power cycled board the flash is just erased. i put a branch always to * at the end of the code to aviod the crash. any suggestions?
MoveFlashVariablesToRam
ldx #FlashOperatingVariables
ldy #RamOperatingVariables
MFVLoop ldaa 1,x+
staa 1,y+
cpx #EndFlashVariables
blo MFVLoop
rts
FlashParameters
movw #RamOperatingVariables,FlashDataStart
movw #FlashOperatingVariables,FlashStart
movw #EndFlashVariables,FlashEnd
MoveFlashCodeToRam
ldx #RamFlashRoutine ;ram area for flash programmer code
ldy #FlashCode ;start of flash program
MoveMoreCode ldaa 1,y+
staa 1,x+
cpy #FlashCodeEnd ;move to ram
blo MoveMoreCode
sei
jmp RamFlashRoutine
FlashReturn cli
rts
FlashCode
ldy FlashDataStart
ldx FlashStart
std 0,x ;write any word to start of flash
movb #EraseFlashSector,FCMD ;
bset FSTAT,#FSTAT_CBEIF ;clear the cbeif flag to start program
brclr FSTAT,#FSTAT_CBEIF,* ;wait for the command buffer to empty
FlashMore ldd 2,y+
std 2,x+ ;move data to valid flash address
movb #ProgramFlashWord,FCMD
bset FSTAT,#FSTAT_CBEIF ;clear the cbeif flag to start program
brclr FSTAT,#FSTAT_CBEIF,* ;wait for the command buffer to empty
cpx FlashEnd ;
blo FlashMore
brclr FSTAT,#FSTAT_CBEIF,* ;wait for last command to complete
bra *
jmp FlashReturn
FlashCodeEnd equ *
is there an app note for the e128 flash that could address my lack of understanding?
thanks in advance