A92: Flash memory : how to (92+,89)


[Prev][Next][Index][Thread]

A92: Flash memory : how to (92+,89)




a good approche is to consult the documentation of the flash rom that's
uses by TI for the 92+ and 89.
It's a Sharp LH28F016SU  (T-70).
an 32 sectors of 64kb each, accessible individualy for erase,write and
lock.

The 26 first sectors are locked and the 6 last are the archive memory of
the 92+ or 89.

start of flash memory : 0x400000
end : 0x5fffff

so, to erase a sector, then write a sector, use the following code :
; a0.l = @ of start of sector ( from $400000 up to $5f0000 )
; a1.l = @ of start of buffer to fill in sector

        move.w #$2020,(a0)    ; block erase/confirm
        move.w #$d0d0,(a0)    ; confirm erase
@1      move.w (a0),d0            ; get status register
        btst #7,d0
        beq.s @1                                ; end of erase ?
        move.w #$5050,(a0)    ; clear status register
        move.l #$fffe,d0                ;
        adda.l d0,a0                    ; end of sector minus one word
        adda.l d0,a1                    ; end of buffer minus one word
        move.w #$7fff           ; size of sector minus one for dbf
@2      move.w (a1),d1          ; a word from buffer
        move.w #$1010,(a0)      ; alternate word/byte write cmd
        move.w d1,(a0)          ; 2nd cycle : write word in flash sect.
@3      move.w (a0),d1          ; get status register
        btst #7,d1
        beq.s @3                                ; end of write ?
        move.w #$5050,(a0)      ; clear status register
        move.w #$ffff,(a0)      ; return to read mode
        subq.l #2,a0                    ; - one word downto the start
        subq.l #2,a1
        dbf d0,@2                       ; 64KB
        rts

Hope that this helps,
--
phildev

phildev
-------



Follow-Ups: