hello again:
i'm using some tried and true code (that works on an 9s12e128) to erase sectors in the xdp512. it was working and then started to hang at the exit of the routine where the code waits for the last command to complete. the code is loaded into and runs from ram. the fclk settings are from the book (16mhz xtal and 40mhz bus). i'm setting ppage to $fd and using an address of $8000 for the window. the sector does get erased, but the command flag does not set. what have i done wrong here?
EraseSector sei
brset FCLKDIV,#mFCLKDIV_FDIVLD,CheckFSTAT
movb #%01001010,FCLKDIV ;divider clock 190 khz
CheckFSTAT brclr FSTAT,#mFSTAT_CBEIF,*
brclr FSTAT,#mFSTAT_ACCERR+mFSTAT_PVIOL,WriteDummy
movb #mFSTAT_ACCERR+mFSTAT_PVIOL,FSTAT
WriteDummy ldx FlashStart
std 0,x ;write any word to start of flash
movb #EraseFlashSector,FCMD ;
movb #mFSTAT_CBEIF,FSTAT ;clear the cbeif flag to start program
brclr FSTAT,#mFSTAT_CCIF,* ;wait for the command buffer to empty
cli
rts
EraseSectorEnd
thanks!!
ed
Solved! Go to Solution.
oops!
sorry to waste anybody's time. i was trying to pare down the code and hazed out with the
movw #$8000,FlashStart
to save some space. oh well, another donation to the vetrans fund for me.
thanks again!
ed
oops!
sorry to waste anybody's time. i was trying to pare down the code and hazed out with the
movw #$8000,FlashStart
to save some space. oh well, another donation to the vetrans fund for me.
thanks again!
ed