TMP92CZ26A
92CZ26A-257
3.11.5 An Example of Accessing NAND Flash of SLC Type
1. Initialization
;
; ***** Initialize NDFC *****
; Conditions: 8-bit bus, CE0, SLC, 512 (528) bytes/page, Hamming codes
;
ld (ndfmcr1),0001h ; 8-bit bus, Hamming ECC, SYSCK-ON
ld (ndfmcr0),2000h ; SPLW1:0=0, SPHW1:0=2
2. Write
Writing valid data
; ***** Write valid data*****
;
ldw (ndfmcr0),2010h ; CE0 enable
ldw (ndfmcr0),20B0h ; WE enable, CLE enable
ld (ndfdtr0),80h ; Serial input command
ldw (ndfmcr0),20D0h ; ALE enable
ld (ndfdtr0),xxh ; Address write (3 or 4 times)
ldw (ndfmcr0),2095h ; Reset ECC, ECCE enable, CE0 enable
ld (ndfdtr0),xxh ; Data write (512 times)
Generating ECC Reading ECC
; ***** Read ECC *****
;
ldw (ndfmcr0),2010h ; ECC circuit disable
ldw xxxx,(ndeccrd0) ; Read ECC from internal circuit
; 1’st Read: D15-0 > LPR15:0 For first 256 bytes
ldw xxxx,(ndeccrd1) ; Read ECC from internal circuit
; 2’nd Read: D15-0 > FFh+CPR5:0+11b For first 256 bytes
ldw xxxx,(ndeccrd0) ; Read ECC from internal circuit
; 3’rd Read: D15-0 > LPR15:0 For second 256 bytes
ldw xxxx,(ndeccrd1) ; Read ECC from internal circuit
; 4’th Read: D15-0 > FFh+CPR5:0+11b For second 256 bytes
Writing ECC to NAND Flash
; ***** Write dummy data & ECC*****
;
ldw (ndfmcr0),2090h ; ECC circuit disable, data write mode
ld (ndfdtr0),xxh ; Redundancy area data write (16 times)
; Write to D520: LPR7:0 > D7-0 For second 256 bytes
; Write to D521: LPR15:8 > D7-0 For second 256 bytes
; Write to D522: CPR5:0+11b > D7-0 For second 256 bytes
; Write to D525: LPR7:0 > D7-0 For first 256 bytes
; Write to D526: LPR15:8 > D7-0 For first 256 bytes
; Write to D527: CPR5:0+11b > D7-0 For first 256 bytes