kef wrote:
At least some QE's have flash protection related erratas. With 0x7F in FPROT and without errata workaround I was unable to program data at 0x1_0000. PVIOL was set.
lda #1
sta LAPAB;<------ Memory map in Debugger does not update
Do you mean here that LAP address doesn't increment? I see LAP is incremented. Are you using simulator?
No, What I meant is in the Debugger MEMORY MAP window, the LAPAB value remains 00. Which I expect to be 1 after stepping through the
sta LAPAB
instruction.
kef wrote:
Your code has some problems
1)
lda #$f0
sta FSTAT;<--- Memory map in Debugger does not update
; value = C0
It is not clear why are you trying simultaneously to clear flash errors and launch new flash command. FCMD is not written yet.
What I am doing with
lda #$f0
sta FSTAT
is simply combining these 2 steps together following the Figure 4-17. Example Program Command Flow on page 81 of the QE128RM
________|__________
| Read: FSTAT register |
___________________
|
^
______/ \______
/ \
< FCBEF set? >
\______ _____ /
\ /
v
|
|
^
_______/ \______
/ FACCERR/FPVIOL \
< set? >
\_______ ______ /
\ /
v
which is also stated on page 78.
4.6.3.1.2 Command Write Sequence
"Before starting a command write sequence, the FACCERR and FPVIOL flags in the FSTAT register must be clear and the FCBEF flag must be set (see Section 4.6.2.5)."
I have tested the code again with all the suggestions you've mentioned, still without sucess. Here is the code, please advise.....
;*************************
;=====<< MAIN code >>=====
;*************************
; =============
;<*=====*< Write_LAP >*=====*>
; =============
;/* Write Linear Address Pointer Registers 2:0 (LAP2:LAP0)*/
mov #1,LAP2 ;PPAGE 4 = 0x10000
clra
sta LAP1
sta LAP0
sta Counter ;clear counter
;/* increment Linear Address Pointer Registers value */
lda #1
sta LAPAB;<------ Memory map in Debugger does not update
;/* No protection for Flash */
lda #$7f
sta FPROT
main_loop:
; ==============
;<*=====*< Flash write >*=====*>
; ==============
;/* FDIV = C9 */
;/* clear FACCERR and FPVIOL flags in the FSTAT*/
lda #$30
sta FSTAT;<--- Memory map in Debugger does not update
; value = C0
;/* Write to Linear Byte Register (LB)*/
lda Counter
sta LB
;/* Write Flash program command to Flash Command Register */
lda #$20
sta FCMD;<--- Memory map in Debugger does not update
; value = 00
;/* writing a 1 to FCBEF to launch the command */
lda #$80
sta FSTAT
;<*============================*>
;/* test for FCCF in the FSTAT*/
again:
lda #$40
bit FSTAT
bne next
bra again
next:
inc Counter
jmp main_loop
When I traced the code, the /* test for FCCF in the FSTAT*/ loop exits straight away, I can not help suspecting that the Flash PROGRAM command was never launched...... Therefore value in FSTAT register remained unchanged....
Thoughts!?