Hi All - I have been trying to implement a very very simple piece of code to program one byte in flash. After I have this functioning, I can take it from there. To make things easy, I located the piece of code in RAM so that I did not have to transfer it from flash to RAM. I simply call this routine with a "jsr" from my normal code. Unfortunately - the Flash never gets updated,...
Here is the assembler code I used:
SpSub: sei
; Write One byte of data to $182C in Flash
lda #(mFPVIOL+mFACCERR)
sta FSTAT
lda #$0A ; Random data to be programmed
sta FLASHStart ; FLASHStart equates to $182C - the firsty byte in flash
lda #mByteProg
sta FCMD
lda #mFCBEF
sta FSTAT
nop
ChkDone2: lda FSTAT
lsla
bpl ChkDone2
cli
SpSubEnd: rts
=====
Note 1: I am running at approx 18Mhz and have set up the FCDIV up to %01001011
Does anyone see any problems with this code?
Thanks in Advance -
John