background image

5

6320B–ATARM–05-Nov-07

Application Note

4.

Error Detection and Correction 

NAND Flash/SmartMedia devices contain by default invalid blocks which have one or more
invalid bits. Over the NAND Flash/SmartMedia lifetime, additional invalid blocks may occur
which can be detected/corrected by ECC code. To ensure data read/write integrity, system error
checking and correction (ECC) algorithms should be implemented. The AT91SAM9260/9263
and AT91SAM7SE microcontrollers provide ECC hardware support. The embedded ECC con-
troller is capable of single-bit error correction and 2-bit error detection per  page
(528/1056/2112/4224). When NAND Flash/SmartMedia have more than 2 bits of errors, the data
cannot be corrected.

4.1

ECC Calculation Algorithm

For Single-bit Error Correction and Double bit Error Detection (SEC-DED) hsiao code is used.
32-bit ECC is generated in order to perform one bit correction per 512/1024/2048/4096 8- or 16-
bit words. Of the 32 ECC bits, 26 bits are for line parity and 6 bits are for column parity. They are
generated according to the schemes shown in 

Figure 4-1

 and 

Figure 4-2

.

Figure 4-1.

Parity Generation for 512/1024/2048/4096 8-bit Words1 

Bit7

Bit6

Bit5

Bit4

Bit3

Bit2

Bit1

Bit0

Bit7

Bit6

Bit5

Bit4

Bit3

Bit2

Bit1

Bit0

P8

P8'

Bit7

Bit6

Bit5

Bit4

Bit3

Bit2

Bit1

Bit0

Bit7

Bit6

Bit5

Bit4

Bit3

Bit2

Bit1

Bit0

P8

P8'

P16

P16'

Bit7

Bit6

Bit5

Bit4

Bit3

Bit2

Bit1

Bit0

Bit7

Bit6

Bit5

Bit4

Bit3

Bit2

Bit1

Bit0

P8

P8'

Bit7

Bit6

Bit5

Bit4

Bit3

Bit2

Bit1

Bit0

Bit7

Bit6

Bit5

Bit4

Bit3

Bit2

Bit1

Bit0

P8

P8'

P16

P16'

P32

P32

1st byte

P32

2nd byte

3rd byte

4 th byte

 Page size  th byte

 (page size -1 )th byte

PX

PX'

Page size  =  512    Px =  2048 
Page size  = 1024   Px =  4096
Page size  =  2048  Px = 8192
Page size  =  4096  Px = 16384

 (page size -2 )th byte

 (page size -3 )th byte

P1

P1'

P1'

P1

P1

P1'

P1'

P1

P2

P2'

P2

P2'

P4

P4'

P1=bit7(+)bit5(+)bit3(+)bit1(+)P1 
P2=bit7(+)bit6(+)bit3(+)bit2(+)P2 
P4=bit7(+)bit6(+)bit5(+)bit4(+)P4
P1'=bit6(+)bit4(+)bit2(+)bit0(+)P1'
P2'=bit5(+)bit4(+)bit1(+)bit0(+)P2'
P4'=bit7(+)bit6(+)bit5(+)bit4(+)P4'

Summary of Contents for AT91 ARM Series

Page 1: ...of bad blocks does not affect the good ones because each block is indepen dent and individually isolated from the bit lines by block select transistors Because NAND Flash devices have a finite lifetim...

Page 2: ...in Section 2 1 Internal Array Architecture NAND flash devices contain a certain percentage of invalid blocks at the end of the production process Invalid blocks are defined as blocks that contain one...

Page 3: ...Half Word 7thHalf Word 8thHalf Word BI LSN1 LSN0 LSN2 Reserved Reserved Reserved Reserved Reserved Reserved Reserved ECC0 ECC1 ECC2 S ECC0 S ECC1 Cell Array 512 Bytes Cell Array 512 Bytes Cell Array 5...

Page 4: ...8 bit devices or sixth half word 16 bit devices in the spare area of Small Page devices Manufacturers make sure that every invalid block has non FFh 8 bit devices or non FFFFh 16 bit devices data in...

Page 5: ...e bit correction per 512 1024 2048 4096 8 or 16 bit words Of the 32 ECC bits 26 bits are for line parity and 6 bits are for column parity They are generated according to the schemes shown in Figure 4...

Page 6: ...ARM 05 Nov 07 Application Note Figure 4 2 Parity Generation for 512 1024 2048 4096 16 bit Words 1st word 2nd word 3rd word 4th word Page size 3 th word Page size 2 th word Page size 1 th word Page siz...

Page 7: ...vice type is performed to NAND Flash or the SmartMedia device The ECC is refreshed at each write access of the page until the last byte or half word of the main area is written Once the whole main are...

Page 8: ...CLE 0 the ECC controller ignores any other command which is performed to the NAND Flash or the SmartMedia device The ECC controller performs error detection automatically by applying an XOR operation...

Page 9: ...d Sequence without Random Read Spare Area Main Area Size I Ox Address Read Command 1 Read Command 2 Address Cycles ECC Controller Reset Data Accesses Main Area Read Accesses Accesses allowing ECC calc...

Page 10: ...ytes ECC for 512 bytes of data per page The AT91SAM ECC controller manages ECC as 4 bytes ECC for 512 1024 2048 4096 bytes of data per page Since the ECC offset in the spare area and the number of ECC...

Page 11: ...05 Nov 07 Application Note 7 Revision History Doc Rev Comments Change Request Ref 6320A First issue 6320B Figure 4 3 and Figure 4 4 updated Section 3 2 Spare Area Assignment updated sentence refering...

Page 12: ...ELATING TO ITS PRODUCTS INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTY OF MERCHANTABILITY FITNESS FOR A PARTICULAR PURPOSE OR NON INFRINGEMENT IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT INDIR...

Reviews: