Architecture
867
SPRUH82C – April 2013 – Revised September 2016
Copyright © 2013–2016, Texas Instruments Incorporated
External Memory Interface A (EMIFA)
At the end of the syndrome calculation after read, the error address and the error value can be calculated
by setting the address and error value calculation start bit (4BITECC_ADD_CALC_START) in the NAND
Flash control register (NANDFCR). The end of address calculation is flagged by the 4-bit ECC correction
state field (ECC_STATE) in the NAND Flash status register (NANDFSR). The number of errors can be
read from the 4-bit number of errors field (ECC_ERRNUM) in the NAND Flash status register
(NANDFSR). The error address value can be read from the NAND Flash error address 1-2 registers
(NANDERRADD[2:1]). The error value can be read from the NAND Flash error value 1-2 registers
(NANDERRVAL[2:1]). The address and error value start bit (4BITECC_ADD_CALC_START) is cleared
upon reading any of the NAND Flash error address 1-2 registers (NANDERRADD[2:1]) or the NAND Flash
error value 1-2 registers (NANDERRVAL[2:1]). The EMIFA registers the syndrome value internally before
the error address and error value calculation. Therefore, a new read operation can be performed
simultaneously with the error address calculation.
The EMIFA supports 4-bit ECC calculation up to 518 bytes. The software needs to follow the following
procedure for 4-bit ECC calculation:
For writes:
1. Set the 4BITECC_START bit in the NAND Flash control register (NANDFCR) to 1.
2. Write 518 bytes of data to the NAND Flash.
3. Read the parity from the NAND Flash 4-Bit ECC 1-4 registers (NAND4BITECC[4:1]).
4. Convert the 10-bit parity values to 8-bits. All 10-bit parity values can be concatenated together with
ECC value 1 (4BITECCVAL1) as LSB and ECC value 8 (4BITECCVAL8) as MSB. Then the
concatenated value can be broken down into ten 8-bit values.
5. Store the parity to spare location in the NAND Flash.
For reads:
1. Set the 4BITECC_START bit in the NAND Flash control register (NANDFCR ) to 1.
2. Read 518 bytes of data from the NAND Flash.
3. Clear the 4BITECC_START bit in NANDFCR by reading any of the NAND Flash 4-bit ECC registers.
4. Read the parity stored in the spare location in the NAND Flash.
5. Convert the 8-bit parity values to 10-bits. Reverse of the conversion that was done during writes.
6. Write the parity values in the NAND Flash 4-bit ECC load register (NAND4BITECCLOAD). Write each
parity value one at a time starting from 4BITECCVAL8 down to 4BITECCVAL1.
7. Perform a dummy read to the NAND Flash status register (NANDFSR). This is only required to ensure
time for syndrome calculation after writing the ECC values in step 6.
8. Read the syndrome from the NAND Flash 4-bit ECC 1-4 registers (NAND4BITECC[4:1]). A syndrome
value of 0 means no bit errors. If the syndrome is non-zero, continue with step 9.
9. Set the 4BITECC_ADD_CALC_START bit in the NAND Flash control register (NANDFCR) to 1.
10. Perform a dummy read to any EMIFA registers except the NAND Flash error address 1-2 registers
(NANDERRADD[2:1]) or the NAND Flash error value 1-2 registers (NANDERRVAL[2:1]).
11. Start another read from NAND, if required (a new thread from step 1).
12. Wait for the 4-bit ECC correction state field (ECC_STATE) in the NAND Flash status register
(NANDFSR) to be equal to 1, 2h, or 3h.
13. The number of errors can be read from the 4-bit number of errors field (ECC_ERRNUM) in the NAND
Flash status register (NANDFSR).
14. Read the error address from the NAND Flash error address 1-2 registers (NANDERRADD[2:1]).
Address for the error word is equal to (total_word 7 - address_value). For 518 bytes, the
address will be equal to (525 - address_value).
15. Read the error value from the NAND Flash error value 1-2 registers (NANDERRVAL[2:1]). Errors can
be corrected by XORing the error word with the error value from the NAND Flash error value 1-2
registers (NANDERRVAL[2:1]).