SPRUI30H November 2015 – May 2024 DRA745 , DRA746 , DRA750 , DRA756
In this example, the ELM is programmed for an 8-bit error-correction capability in continuous mode (see Table 15-517). After reading a 528-byte NAND flash sector (512B data plus 16B spare area) with a 16-bit interface, a nonzero polynomial syndrome is reported from the GPMC (polynomial syndrome 0 is used in the ELM):
Step | Register/Bit Field/Programming Model | Value |
---|---|---|
Resets the module | ELM_SYSCONFIG[1] SOFTRESET | 0x1 |
Wait until reset is done. | ELM_SYSSTATUS[0] RESETDONE | 0x1 |
Configure the slave interface power management: Smart idle is used. | ELM_SYSCONFIG[4:3] SIDLEMODE | 0x2 |
Defines the error-correction level used: 8 bits | ELM_LOCATION_CONFIG[1:0] ECC_BCH_LEVEL | 0x1 |
Defines the maximum buffer length: 528 bytes (2 × 528 = 1056) | ELM_LOCATION_CONFIG[26:16] ECC_SIZE | 0x420 |
Sets the ELM in continuous mode | ELM_PAGE_CTRL | 0 |
Enables interrupt for syndrome polynomial 0 | ELM_IRQENABLE[0] LOCATION_MASK_0 | 0x1 |
Set the input syndrome polynomial 0. | ELM_SYNDROME_FRAGMENT_0_i (where i = 0) | 0xFB0D0980 |
ELM_SYNDROME_FRAGMENT_1_i (where i = 0) | 0xE44F767B | |
ELM_SYNDROME_FRAGMENT_2_i (where i = 0) | 0x16ABE115 | |
ELM_SYNDROME_FRAGMENT_3_i (where i = 0) | 0x0000000A | |
Initiates the computation process | ELM_SYNDROME_FRAGMENT_6_i[16] SYNDROME_VALID (where i = 0) | 0x1 |
Wait until process is complete for syndrome polynomial 0: IRQ_ELM is generated or poll the status register. | ||
Read that error-location process is complete for syndrome polynomial 0. | ELM_IRQSTATUS[0] LOC_VALID_0 | 0x1 |
Read the process exit status: All errors were successfully located. | ELM_LOCATION_STATUS_i[8] ECC_CORRECTABLE (where i = 0) | 0x1 |
Read the number of errors: Four errors detected. | ELM_LOCATION_STATUS_i[4:0] ECC_NB_ERRORS (where i = 0) | 0x4 |
Read the error-location bit addresses for syndrome polynomial 0 of the first four registers: Errors are located in the data buffer at decimal addresses 431, 1062, 1909, 3452. | ELM_ERROR_LOCATION_0_i (where i = 0) | 0x1AF |
ELM_ERROR_LOCATION_1_i (where i = 0) | 0x426 | |
ELM_ERROR_LOCATION_2_i (where i = 0) | 0x775 | |
ELM_ERROR_LOCATION_3_i (where i = 0) | 0xD7C | |
Clear the corresponding interrupt for polynomial 0. | ELM_IRQSTATUS[0] LOC_VALID_0 | 0x1 |
The NAND flash data in the sector are seen as a polynomial of degree 4223 (number of bits in a 528 byte buffer minus 1), with each data bit being a coefficient in the polynomial. When reading from a NAND flash using the GPMC module, computation of the polynomial syndrome assumes that the first NAND word read at address 0x0 contains the highest-order coefficient in the message. Furthermore, in the 16-bit NAND word, bits are ordered from bit 7 to bit 0, and then from bit 15 to bit 8. Based on this convention, an address table of the data buffer can be built. NAND memory addresses in Table 15-518 are given in decimal format.
NAND Memory Address | Message Bit Addresses in Memory Word | |||||||||||||||
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | |
0 | 4215 | 4214 | 4213 | 4212 | 4211 | 4210 | 4209 | 4208 | 4223 | 4222 | 4221 | 4220 | 4219 | 4218 | 4217 | 4216 |
1 | 4175 | 4174 | 4173 | 4172 | 4171 | 4170 | 4169 | 4168 | 4183 | 4182 | 4181 | 4180 | 4179 | 4178 | 4177 | 4176 |
... | ||||||||||||||||
47 | 3463 | 3462 | 3461 | 3460 | 3459 | 3458 | 3457 | 3456 | 3471 | 3470 | 3469 | 3468 | 3467 | 3466 | 3465 | 3464 |
48 | 3447 | 3446 | 3445 | 3444 | 3443 | 3442 | 3441 | 3440 | 3455 | 3454 | 3453 | 3452 | 3451 | 3450 | 3449 | 3448 |
49 | 3431 | 3430 | 3429 | 3428 | 3427 | 3426 | 3425 | 3424 | 3439 | 3438 | 3437 | 3436 | 3435 | 3434 | 3433 | 3432 |
50 | 3415 | 3414 | 3413 | 3412 | 3411 | 3410 | 3409 | 3408 | 3423 | 3422 | 3421 | 3420 | 3419 | 3418 | 3417 | 3416 |
... | ||||||||||||||||
255 | 135 | 134 | 133 | 132 | 131 | 130 | 129 | 128 | 143 | 142 | 141 | 140 | 139 | 138 | 137 | 136 |
256 | 119 | 118 | 117 | 116 | 115 | 114 | 113 | 112 | 127 | 126 | 125 | 124 | 123 | 122 | 121 | 120 |
257 | 103 | 102 | 101 | 100 | 99 | 98 | 97 | 96 | 111 | 110 | 109 | 108 | 107 | 106 | 105 | 104 |
258 | 87 | 86 | 85 | 84 | 83 | 82 | 81 | 80 | 95 | 94 | 93 | 92 | 91 | 90 | 89 | 88 |
259 | 71 | 70 | 69 | 68 | 67 | 66 | 65 | 64 | 79 | 78 | 77 | 76 | 75 | 74 | 73 | 72 |
260 | 55 | 54 | 53 | 52 | 51 | 50 | 49 | 48 | 63 | 62 | 61 | 60 | 59 | 58 | 57 | 56 |
261 | 39 | 38 | 37 | 36 | 35 | 34 | 33 | 32 | 47 | 46 | 45 | 44 | 43 | 42 | 41 | 40 |
262 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 |
263 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 |
The table can now be used to determine which bits in the buffer were incorrect and must be flipped. In this example, the first bit to be flipped is bit 4 from the 49th byte read from memory. It is up to the processor to correctly map this word to the copied buffer and flip this bit. The same process must be repeated for all detected errors.