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?
movb #%01001010,FCLKDIV ;divider clock 190 khz
CheckFSTAT brclr FSTAT,#mFSTAT_CBEIF,*
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