SAMA5D2: NAND flash issue in AT91bootstrap

For SAMA5D2 Xplained, SAMA5D3 Xplained and SAMA5D4 Xplained

Moderator: nferre

ganesha.ld
Posts: 32
Joined: Mon Dec 19, 2011 7:01 pm

SAMA5D2: NAND flash issue in AT91bootstrap

Wed Oct 11, 2017 4:45 pm

Hi,
I'm trying to boot up u-boot using AT91Bootstrap (3.8.9) SAMA5D28 based custom board.

I have an Issue with booting u-boot in AT91Bootstrap.
Seems that bootstrap tries copy the code, but fails. (But reads all the ONFI parameters of nandflash)

Here are the brief specs of NAND flash we are using:
Part: Micron MT29F8G08ABABAWP
Type: SLC Nand
– Page size x8: 4320 bytes (4096 + 224 bytes)
– Block size: 128 pages (512K +28 K bytes)
– Plane size: 2 planes x 1024 blocks per plane
– Device size: 8Gb: 2048 blocks

Please refer the attached schematic for the connections.

I have setup the appropriate connections in board/sama5d2_explained/sama5d2_xplained.c:
void nandflash_hw_init(void)
{
const struct pio_desc nand_pins[] = {
{"NANDOE", CONFIG_SYS_NAND_OE_PIN, 0, PIO_PULLUP, PIO_PERIPH_F},
{"NANDWE", CONFIG_SYS_NAND_WE_PIN, 0, PIO_PULLUP, PIO_PERIPH_F},
{"NANDALE", CONFIG_SYS_NAND_ALE_PIN, 0, PIO_PULLUP, PIO_PERIPH_F},
{"NANDCLE", CONFIG_SYS_NAND_CLE_PIN, 0, PIO_PULLUP, PIO_PERIPH_F},
{"NANDCS", CONFIG_SYS_NAND_ENABLE_PIN, 1, PIO_DEFAULT, PIO_OUTPUT},
{"D0", AT91C_PIN_PA(0), 0, PIO_PULLUP, PIO_PERIPH_F},
{"D1", AT91C_PIN_PA(1), 0, PIO_PULLUP, PIO_PERIPH_F},
{"D2", AT91C_PIN_PA(2), 0, PIO_PULLUP, PIO_PERIPH_F},
{"D3", AT91C_PIN_PA(3), 0, PIO_PULLUP, PIO_PERIPH_F},
{"D4", AT91C_PIN_PA(4), 0, PIO_PULLUP, PIO_PERIPH_F},
{"D5", AT91C_PIN_PA(5), 0, PIO_PULLUP, PIO_PERIPH_F},
{"D6", AT91C_PIN_PA(6), 0, PIO_PULLUP, PIO_PERIPH_F},
{"D7", AT91C_PIN_PA(7), 0, PIO_PULLUP, PIO_PERIPH_F},
{(char *)0, 0, 0, PIO_DEFAULT, PIO_PERIPH_A},
};

pio_configure(nand_pins);
pmc_sam9x5_enable_periph_clk(AT91C_ID_HSMC);

/* EBI Configuration Register */
writel((AT91C_EBICFG_DRIVE0_HIGH |
AT91C_EBICFG_PULL0_NONE |
AT91C_EBICFG_DRIVE1_HIGH |
AT91C_EBICFG_PULL1_NONE), SFR_EBICFG + AT91C_BASE_SFR);

/* Configure SMC CS3 for NAND/SmartMedia */
writel(AT91C_SMC_SETUP_NWE(1) |
AT91C_SMC_SETUP_NCS_WR(1) |
AT91C_SMC_SETUP_NRD(1) |
AT91C_SMC_SETUP_NCS_RD(1), (ATMEL_BASE_SMC + SMC_SETUP3));

writel(AT91C_SMC_PULSE_NWE(2) |
AT91C_SMC_PULSE_NCS_WR(3) |
AT91C_SMC_PULSE_NRD(2) |
AT91C_SMC_PULSE_NCS_RD(3), (ATMEL_BASE_SMC + SMC_PULSE3));

writel(AT91C_SMC_CYCLE_NWE(5) |
AT91C_SMC_CYCLE_NRD(5), (ATMEL_BASE_SMC + SMC_CYCLE3));

writel(AT91C_SMC_TIMINGS_TCLR(2) |
AT91C_SMC_TIMINGS_TADL(7) |
AT91C_SMC_TIMINGS_TAR(2) |
AT91C_SMC_TIMINGS_TRR(3) |
AT91C_SMC_TIMINGS_TWB(7) |
AT91C_SMC_TIMINGS_RBNSEL(2) |
AT91C_SMC_TIMINGS_NFSEL, (ATMEL_BASE_SMC + SMC_TIMINGS3));

writel(AT91C_SMC_MODE_READMODE_NRD_CTRL |
AT91C_SMC_MODE_WRITEMODE_NWE_CTRL |
AT91C_SMC_MODE_DBW_8 |
AT91C_SMC_MODE_TDF_CYCLES(1), (ATMEL_BASE_SMC + SMC_MODE3));
}



NandFlash build configuration for AT91Bootstrap is something like this :
CONFIG_NANDFLASH=y
CONFIG_USE_PMECC=y
CONFIG_PMECC_AUTO_DETECT=y
CONFIG_ONFI_DETECT_SUPPORT=y
CONFIG_USE_ON_DIE_ECC_SUPPORT=y

Here is the bootup log from AT91Bootstrap (Even Lodger Debug info option):
RomBOOT
ba_offset = 0xb ...

Dump DDRAMC Registers:
@address: 0x0 0x4 0x8 0xc
0xf000c000: 0x10 0x300511 0xd0035d 0x44439436
0xf000c010: 0x3001d1b 0x74000 0x33338 0x10000
0xf000c020: 0x14 0x50008 0x0 0xc852
0xf000c030: 0x40 0x646404 0x0 0x0
0xf000c040: 0x0 0x0 0x0 0x0
0xf000c050: 0x0 0x0 0x0 0x2
0xf000c060: 0x0 0x0 0x0 0x0
0xf000c070: 0x0 0x0 0x0 0x0
0xf000c080: 0x0 0x0 0x0 0x0
0xf000c090: 0x0 0x0 0x0 0x0
0xf000c0a0: 0x0 0x0 0x0 0x0
0xf000c0b0: 0x0 0x0 0x1 0x0
0xf000c0c0: 0x0 0x0 0x0 0x0
0xf000c0d0: 0x0 0x0 0x0 0x0
0xf000c0e0: 0x0 0x0 0x0 0x4000
0xf000c0f0: 0x484d5044 0x44524320 0x0 0x20301
0xf000c100: 0x0 0x0 0x4040404 0x3030303
0xf000c110: 0x0 0x1 0x3a03a01 0x0
0xf000c120: 0x0 0x0 0xa00 0xa00
0xf000c130: 0xa00 0xa00 0xb00 0xb00
0xf000c140: 0xb00 0xb00 0xe 0xe
0xf000c150: 0xe 0xe 0xd 0x0


AT91Bootstrap 3.8.9-dirty (Wed Oct 11 19:11:44 IST 2017) SemaConnect

All interrupts redirected to AIC
Auto-Config the TWI Bus by the board
NAND: ONFI flash detected
NAND: Manufacturer ID: 0x2c Chip ID: 0x38
NAND: Page Bytes: 4096, Spare Bytes: 224
NAND: ECC Correctability Bits: 4, ECC Sector Bytes: 512
NAND: Disable On-Die ECC
PMECC: version is: 0x0
PMECC: page_size: 4096, oob_size: 224, pmecc_cap: 4, sector_size: 512
NAND: Initialize PMECC params, cap: 4, sector: 512
NAND: Image: Copy 0xa0000 bytes from 0x40000 to 0x26f00000
PMECC: sector bits = 255, bit 1 means corrupted sector, Now correcting...
PMECC: failed to correct corrupted bits!
Dump Error Page: Data:

190 0 0 234 20 240 159 229 20 240 159 229 20 240 159 229
20 240 159 229 20 240 159 229 20 240 159 229 20 240 159 229
96 0 240 38 192 0 240 38 32 1 240 38 128 1 240 38
224 1 240 38 64 2 240 38 160 2 240 38 239 190 173 222
222 192 173 11 0 240 32 227 0 240 32 227 0 240 32 227
0 240 32 227 0 240 32 227 0 240 32 227 0 240 32 227
40 208 31 229 0 224 141 229 0 224 79 225 4 224 141 229
19 208 160 227 13 240 105 225 15 224 160 225 14 240 176 225
72 208 77 226 255 31 141 232 80 32 31 229 12 0 146 232
72 0 141 226 52 80 141 226 14 16 160 225 15 0 133 232
13 0 160 225 248 3 0 235 0 240 32 227 0 240 32 227
0 240 32 227 0 240 32 227 0 240 32 227 0 240 32 227
136 208 31 229 0 224 141 229 0 224 79 225 4 224 141 229
19 208 160 227 13 240 105 225 15 224 160 225 14 240 176 225
72 208 77 226 255 31 141 232 176 32 31 229 12 0 146 232
72 0 141 226 52 80 141 226 14 16 160 225 15 0 133 232
13 0 160 225 233 3 0 235 0 240 32 227 0 240 32 227
0 240 32 227 0 240 32 227 0 240 32 227 0 240 32 227
232 208 31 229 0 224 141 229 0 224 79 225 4 224 141 229
19 208 160 227 13 240 105 225 15 224 160 225 14 240 176 225
72 208 77 226 255 31 141 232 16 33 31 229 12 0 146 232
72 0 141 226 52 80 141 226 14 16 160 225 15 0 133 232
13 0 160 225 218 3 0 235 0 240 32 227 0 240 32 227
0 240 32 227 0 240 32 227 0 240 32 227 0 240 32 227
72 209 31 229 0 224 141 229 0 224 79 225 4 224 141 229
19 208 160 227 13 240 105 225 15 224 160 225 14 240 176 225
72 208 77 226 255 31 141 232 112 33 31 229 12 0 146 232
72 0 141 226 52 80 141 226 14 16 160 225 15 0 133 232
13 0 160 225 203 3 0 235 0 240 32 227 0 240 32 227
0 240 32 227 0 240 32 227 0 240 32 227 0 240 32 227
168 209 31 229 0 224 141 229 0 224 79 225 4 224 141 229
19 208 160 227 13 240 105 225 15 224 160 225 14 240 176 225
72 208 77 226 255 31 141 232 208 33 31 229 12 0 146 232
72 0 141 226 52 80 141 226 14 16 160 225 15 0 133 232
13 0 160 225 188 3 0 235 0 240 32 227 0 240 32 227
0 240 32 227 0 240 32 227 0 240 32 227 0 240 32 227
8 210 31 229 0 224 141 229 0 224 79 225 4 224 141 229
19 208 160 227 13 240 105 225 15 224 160 225 14 240 176 225
72 208 77 226 255 31 141 232 48 34 31 229 12 0 146 232
72 0 141 226 52 80 141 226 14 16 160 225 15 0 133 232
13 0 160 225 182 3 0 235 0 240 32 227 0 240 32 227
0 240 32 227 0 240 32 227 0 240 32 227 0 240 32 227
104 210 31 229 0 224 141 229 0 224 79 225 4 224 141 229
19 208 160 227 13 240 105 225 15 224 160 225 14 240 176 225
72 208 77 226 255 31 141 232 144 34 31 229 12 0 146 232
72 0 141 226 52 80 141 226 14 16 160 225 15 0 133 232
13 0 160 225 149 3 0 235 0 240 32 227 0 240 32 227
0 240 32 227 0 240 32 227 0 240 32 227 0 240 32 227
16 0 0 234 0 0 15 225 31 16 0 226 26 0 49 227
31 0 192 19 19 0 128 19 192 0 128 227 0 240 41 225
16 15 17 238 2 10 192 227 16 15 1 238 108 0 159 229
16 15 12 238 209 0 0 235 21 15 7 238 154 15 7 238
149 15 7 238 30 255 47 225 237 255 255 234 0 0 160 227
23 15 8 238 21 15 7 238 213 15 7 238 154 15 7 238
149 15 7 238 16 15 17 238 2 10 192 227 7 0 192 227
2 0 128 227 2 11 128 227 1 10 128 227 16 15 1 238
14 80 160 225 16 31 16 238 33 58 160 225 15 48 3 226
15 64 1 226 3 34 160 225 2 32 132 225 5 240 160 225
0 0 240 38 95 240 127 245 48 15 48 238 160 59 160 225
14 48 19 226 26 0 0 10 0 160 160 227 170 32 138 224
48 18 160 225 7 16 1 226 2 0 81 227 17 0 0 186
16 175 64 238 111 240 127 245 16 31 48 238 7 32 1 226
4 32 130 226 255 67 0 227 161 65 20 224 20 95 111 225
255 127 7 227 161 118 23 224 7 144 160 225 20 181 138 225
25 178 139 225 94 191 7 238 1 144 89 226 250 255 255 170
1 64 84 226 247 255 255 170 2 160 138 226 10 0 83 225
229 255 255 202 0 160 160 227 16 175 64 238 78 240 127 245
111 240 127 245 30 255 47 225 176 78 45 233 216 255 255 235
176 78 189 232 30 255 47 225 95 240 127 245 48 15 48 238
160 59 160 225 14 48 19 226 26 0 0 10 0 160 160 227
170 32 138 224 48 18 160 225 7 16 1 226 2 0 81 227
17 0 0 186 16 175 64 238 111 240 127 245 16 31 48 238
7 32 1 226 4 32 130 226 255 67 0 227 161 65 20 224
20 95 111 225 255 127 7 227 161 118 23 224 7 144 160 225
20 181 138 225 25 178 139 225 86 191 7 238 1 144 89 226
250 255 255 170 1 64 84 226 247 255 255 170 2 160 138 226
10 0 83 225 229 255 255 202 0 160 160 227 16 175 64 238
78 240 127 245 111 240 127 245 30 255 47 225 176 78 45 233
216 255 255 235 176 78 189 232 30 255 47 225 0 48 160 227
21 63 7 238 213 63 7 238 79 240 127 245 111 240 127 245
30 255 47 225 30 255 47 225 30 255 47 225 30 255 47 225
8 64 45 233 199 255 255 235 8 64 189 232 250 255 255 234
30 255 47 225 8 64 45 233 235 255 255 235 8 64 189 232
250 255 255 234 8 64 45 233 241 255 255 235 248 255 255 235
0 48 160 227 23 63 8 238 22 63 8 238 21 63 8 238
79 240 127 245 111 240 127 245 8 128 189 232 30 255 47 225
56 64 45 233 0 80 160 225 1 64 160 225 20 3 0 235
16 63 48 238 7 48 3 226 1 32 160 227 4 48 131 226
18 35 160 225 0 48 98 226 5 48 3 224 4 0 83 225
2 0 0 42 62 63 7 238 2 48 131 224 250 255 255 234
79 240 127 245 5 0 160 225 4 16 160 225 56 64 189 232
233 255 255 234 30 255 47 225 112 64 45 233 0 96 160 225
1 80 160 225 254 2 0 235 16 79 48 238 6 0 160 225
5 16 160 225 250 2 0 235 0 0 80 227 9 0 0 10
7 64 4 226 1 48 160 227 4 64 132 226 19 68 160 225
6 48 160 225 5 0 83 225 2 0 0 42 54 63 7 238
4 48 131 224 250 255 255 234 79 240 127 245 6 0 160 225
5 16 160 225 112 64 189 232 229 255 255 234 30 255 47 225
16 64 45 233 0 64 160 225 52 2 0 235 1 0 20 227
5 0 0 10 78 3 0 235 178 255 255 235 184 255 255 235
41 3 0 235 168 255 255 235 4 0 0 234 38 3 0 235
165 255 255 235 173 255 255 235 163 255 255 235 27 3 0 235
237 255 255 235 0 0 160 227 16 128 189 232 3 0 160 227
234 255 255 234 0 0 0 0 0 0 0 0 0 0 0 0
112 208 159 229 7 208 205 227 13 0 160 225 128 42 0 235
0 208 160 225 0 144 160 225 129 42 0 235 0 0 160 227
255 52 0 235 60 208 153 229 7 208 205 227 0 144 153 229
216 144 73 226 12 224 143 226 64 0 153 229 0 224 142 224
44 0 153 229 59 1 0 234 55 1 0 235 25 255 255 235
36 0 159 229 36 48 159 229 0 16 160 227 0 32 83 224
14 0 0 235 177 52 0 235 177 52 0 235 9 0 160 225
44 16 153 229 8 240 159 229 32 63 0 32 232 41 245 38
16 137 248 38 176 220 240 38 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3 48 16 226 0 192 160 225 43 0 0 26 1 20 129 225
1 24 129 225 1 48 160 225 16 0 82 227 28 0 0 186
240 65 45 233 1 64 160 225 1 80 160 225 1 96 160 225
1 112 160 225 1 128 160 225 1 224 160 225 96 0 82 227
31 0 28 195 8 0 0 218 31 128 12 226 32 128 104 226
8 32 66 224 8 142 176 225 240 0 172 40 48 0 172 72
1 1 24 227 1 128 160 225 4 16 140 20 64 32 82 226
250 65 172 168 250 65 172 168 251 255 255 202 240 129 189 8
32 0 18 227 250 65 172 24 16 0 18 227 240 0 172 24
240 65 189 232 8 0 18 227 10 0 172 24 4 0 18 227
4 16 140 20 2 0 18 227 1 16 204 20 1 16 204 20
1 0 18 227 1 16 204 20 30 255 47 225 4 32 82 226
247 255 255 186 2 0 83 227 1 16 204 180 1 16 204 212
1 16 204 228 3 32 130 224 203 255 255 234 0 240 32 227
1 0 80 225 14 240 160 1 17 64 45 233 4 32 82 226
51 0 0 186 3 192 16 226 0 240 209 245 56 0 0 26
3 192 17 226 66 0 0 26 28 32 82 226 224 1 45 233
19 0 0 186 31 192 16 226 32 48 108 226 2 64 211 16
3 0 0 42 72 64 143 226 3 32 82 224 12 240 132 224
0 240 209 245 96 32 82 226 28 240 209 245 2 0 0 186
60 240 209 245 92 240 209 245 124 240 209 245 248 81 177 232
32 32 82 226 248 81 160 232 250 255 255 170 96 0 114 227
249 255 255 170 28 192 18 226 32 192 108 226 12 240 143 16
18 0 0 234 0 240 32 227 4 48 145 228 4 64 145 228
4 80 145 228 4 96 145 228 4 112 145 228 4 128 145 228
4 224 145 228 12 240 143 224 0 240 32 227 0 240 32 227
4 48 128 228 4 64 128 228 4 80 128 228 4 96 128 228
4 112 128 228 4 128 128 228 4 224 128 228 220 255 255 42
224 1 189 232 130 47 176 225 1 48 209 20 1 64 209 36
1 192 209 36 1 48 192 20 1 64 192 36 1 192 192 36
17 128 189 232 4 192 108 226 2 0 92 227 1 48 209 196
1 64 209 164 1 224 209 228 1 48 192 196 1 64 192 164
12 32 82 224 1 224 192 228 237 255 255 186 3 192 17 226
188 255 255 10 3 16 193 227 2 0 92 227 4 224 145 228
51 0 0 10 101 0 0 202 28 32 82 226 36 0 0 186
31 192 16 226 32 192 108 226 2 64 220 16 12 32 66 48
33 0 0 58 224 3 45 233 0 240 209 245 96 32 82 226
28 240 209 245 2 0 0 186 60 240 209 245 92 240 209 245
124 240 209 245 240 0 177 232 46 52 160 225 32 32 82 226
0 83 177 232 4 60 131 225 36 68 160 225 5 76 132 225
37 84 160 225 6 92 133 225 38 100 160 225 7 108 134 225
39 116 160 225 8 124 135 225 40 132 160 225 9 140 136 225
41 148 160 225 12 156 137 225 44 196 160 225 14 204 140 225
248 19 160 232 233 255 255 170 96 0 114 227 232 255 255 170
224 3 189 232 28 192 18 226 7 0 0 10 46 52 160 225
4 224 145 228 4 192 92 226 14 60 131 225 4 48 128 228
249 255 255 202 0 0 82 227 213 255 255 170 3 16 65 226
179 255 255 234 28 32 82 226 36 0 0 186 31 192 16 226
32 192 108 226 2 64 220 16 12 32 66 48 33 0 0 58
224 3 45 233 0 240 209 245 96 32 82 226 28 240 209 245
2 0 0 186 60 240 209 245 92 240 209 245 124 240 209 245
240 0 177 232 46 56 160 225 32 32 82 226 0 83 177 232
4 56 131 225 36 72 160 225 5 72 132 225 37 88 160 225
6 88 133 225 38 104 160 225 7 104 134 225 39 120 160 225
8 120 135 225 40 136 160 225 9 136 136 225 41 152 160 225
12 152 137 225 44 200 160 225 14 200 140 225 248 19 160 232
233 255 255 170 96 0 114 227 232 255 255 170 224 3 189 232
28 192 18 226 7 0 0 10 46 56 160 225 4 224 145 228
4 192 92 226 14 56 131 225 4 48 128 228 249 255 255 202
0 0 82 227 213 255 255 170 2 16 65 226 128 255 255 234
28 32 82 226 36 0 0 186 31 192 16 226 32 192 108 226
2 64 220 16 12 32 66 48 33 0 0 58 224 3 45 233
0 240 209 245 96 32 82 226 28 240 209 245 2 0 0 186
60 240 209 245 92 240 209 245 124 240 209 245 240 0 177 232
46 60 160 225 32 32 82 226 0 83 177 232 4 52 131 225
36 76 160 225 5 68 132 225 37 92 160 225 6 84 133 225
38 108 160 225 7 100 134 225 39 124 160 225 8 116 135 225
40 140 160 225 9 132 136 225 41 156 160 225 12 148 137 225
44 204 160 225 14 196 140 225 248 19 160 232 233 255 255 170
96 0 114 227 232 255 255 170 224 3 189 232 28 192 18 226
7 0 0 10 46 60 160 225 4 224 145 228 4 192 92 226
14 52 131 225 4 48 128 228 249 255 255 202 0 0 82 227
213 255 255 170 1 16 65 226 77 255 255 234 44 0 153 229
16 15 12 238 30 255 47 225 76 16 159 229 1 64 80 224
16 0 0 10 68 32 159 229 0 12 177 232 0 12 160 232
2 0 81 225 251 255 255 58 52 32 159 229 52 48 159 229
3 0 178 232 255 16 1 226 23 0 81 227 3 0 0 26
4 0 128 224 0 16 144 229 4 16 129 224 0 16 128 229
3 0 82 225 245 255 255 58 30 255 47 225 0 0 240 38
232 41 245 38 232 41 245 38 120 181 245 38 31 64 45 233
0 48 160 227 0 32 153 229 12 48 141 229 72 16 146 229
76 32 146 229 10 0 141 232 13 16 160 225 8 32 141 229
1 48 160 227 8 32 141 226 248 60 0 235 20 208 141 226
4 240 157 228 16 64 45 233 0 64 160 225 48 0 159 229
159 40 0 235 164 48 148 229 0 0 83 227 5 0 0 10
4 0 160 225 42 84 0 235 0 0 80 227 20 0 159 21
16 128 189 8 0 0 0 234 12 0 159 229 228 237 0 235
45 230 0 235 238 71 244 38 15 57 244 38 47 57 244 38
0 32 153 229 0 48 153 229 13 16 160 225 72 32 146 229
1 26 65 226 76 48 147 229 2 32 131 224 2 32 97 224
50 203 0 234 30 255 47 225 0 48 153 229 115 64 45 233
0 80 160 225 64 48 147 229 1 64 160 225 148 96 144 229
148 0 159 229 4 48 141 229 125 40 0 235 0 0 80 227
7 0 0 10 16 16 160 227 4 32 141 226 79 238 0 235
0 0 80 227 26 0 0 186 112 0 159 229 4 16 157 229
195 237 0 235 15 0 160 227 2 76 4 226 232 40 0 235
92 48 159 229 0 0 84 227 88 16 159 229 88 0 159 229
3 16 160 1 186 237 0 235 170 0 160 227 224 40 0 235
223 255 255 235 72 254 255 235 164 48 149 229 0 0 83 227
160 32 149 21 9 48 160 1 0 48 147 5 68 32 147 5
0 0 84 227 2 0 0 26 4 0 160 225 4 16 157 229
54 255 47 225 8 208 141 226 112 128 189 232 119 57 244 38
126 57 244 38 115 234 244 38 96 57 244 38 163 57 244 38
248 64 45 233 192 80 16 226 0 80 224 19 16 0 0 26
0 64 160 225 1 124 20 226 3 96 160 225 3 0 160 225
1 0 0 10 166 255 255 235 9 0 0 234 6 92 20 226
3 0 0 10 4 16 160 225 7 80 160 225 189 255 255 235
3 0 0 234 158 255 255 235 6 0 160 225 4 16 160 225
184 255 255 235 5 0 160 225 248 128 189 232 160 48 144 229
0 0 83 227 13 0 0 10 16 64 45 233 0 64 160 225
44 16 159 229 3 0 160 225 146 196 0 235 0 0 80 227
5 0 0 170 160 0 148 229 127 255 255 235 0 0 80 227
1 0 0 10 12 0 159 229 75 75 0 235 16 64 189 232
13 254 255 234 188 57 244 38 196 57 244 38 148 48 144 229
160 0 144 229 19 255 47 225 37 192 208 229 36 48 208 229
12 52 131 225 38 192 208 229 12 56 131 225 39 192 208 229
12 60 131 225 84 192 159 229 12 0 83 225 17 0 0 26
41 192 208 229 40 48 208 229 12 52 131 225 42 192 208 229
12 56 131 225 43 192 208 229 12 60 131 225 0 48 129 229
45 16 208 229 44 48 208 229 1 52 131 225 46 16 208 229
1 56 131 225 47 16 208 229 0 0 160 227 1 60 131 225
0 48 130 229 30 255 47 225 1 0 160 227 30 255 47 225
24 40 111 1 60 32 153 229 0 0 160 227 56 32 137 229
60 48 153 229 16 48 67 226 60 48 137 229 30 255 47 225
16 32 159 229 0 0 160 227 56 48 153 229 8 48 131 226
0 48 130 229 30 255 47 225 64 0 240 38 30 255 47 225
0 0 160 227 30 255 47 225 8 64 45 233 0 0 159 229
149 237 0 235 230 57 244 38 112 64 45 233 136 208 77 226
0 64 160 225 48 17 159 229 128 32 160 227 8 0 141 226
50 254 255 235 56 32 148 229 32 1 159 229 60 16 148 229
64 80 148 229 54 237 0 235 15 98 5 226 4 32 153 229
1 0 18 227 7 0 0 10 64 16 153 229 60 192 148 229
64 48 153 229 56 32 148 229 12 16 97 224 240 0 159 229
2 32 99 224 42 237 0 235 52 16 148 229 48 32 148 229
44 48 148 229 220 0 159 229 37 237 0 235 40 16 148 229
36 32 148 229 32 48 148 229 204 0 159 229 32 237 0 235
16 48 148 229 28 16 148 229 24 32 148 229 0 48 141 229
184 0 159 229 20 48 148 229 25 237 0 235 0 48 148 229
12 16 148 229 8 32 148 229 0 48 141 229 160 0 159 229
4 48 148 229 18 237 0 235 0 0 86 227 78 16 160 179
110 16 160 163 1 1 21 227 90 32 160 19 122 32 160 3
2 2 21 227 67 48 160 19 99 48 160 3 1 2 21 227
OOB:

255 255 111 224 111 57 74 209 40 68 134 197 175 80 74 40
1 50 89 124 248 103 157 38 61 66 197 152 65 132 167 44
61 230 31 0 245 104 122 125 79 214 121 48 132 129 114 41
251 147 154 200 196 106 239 0 107 218 213 110 194 38 58 100
224 184 68 198 163 69 107 91 215 169 27 28 145 225 36 183
133 19 47 57 239 23 87 211 202 154 21 172 224 75 168 146
120 147 145 251 113 185 236 106 242 229 203 36 133 83 237 50
101 210 118 125 220 145 43 113 69 248 115 22 104 135 208 112
78 181 171 85 251 5 66 100 123 89 140 10 228 23 180 190
253 226 140 118 61 224 34 191 224 198 248 176 2 17 109 92
200 136 19 173 244 61 219 235 210 203 129 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
NAND: Failed to load image


Please help...
Thanks,
-Ganesh
blue_z
Location: USA
Posts: 1504
Joined: Thu Apr 19, 2007 10:15 pm

Re: SAMA5D2: NAND flash issue in AT91bootstrap

Thu Oct 12, 2017 1:08 am

ganesha.ld wrote:
Wed Oct 11, 2017 4:45 pm
I'm trying to boot up u-boot using AT91Bootstrap (3.8.9) SAMA5D28 based custom board.
Since you have a custom board, then why post in a forum for Atmel SAMA5 Xplained boards?

ganesha.ld wrote:I have an Issue with booting u-boot in AT91Bootstrap.
Seems that bootstrap tries copy the code, but fails. (But reads all the ONFI parameters of nandflash)
Backup, how did you write these images to NAND flash?
How did you verify that the images were written correctly?

What value did you use for the NAND parameter header?

ganesha.ld wrote:I have setup the appropriate connections in board/sama5d2_explained/sama5d2_xplained.c:
Since you have a custom board, then why are you using the wrong directory and files?

BTW learn how to use the Code tag instead of using bold and color fonts. The Code selector is on the same menu line as the bold & color selectors.

Regards
ganesha.ld
Posts: 32
Joined: Mon Dec 19, 2011 7:01 pm

Re: SAMA5D2: NAND flash issue in AT91bootstrap

Mon Oct 16, 2017 9:29 am

Hi blue_z,
blue_z wrote: Since you have a custom board, then why post in a forum for Atmel SAMA5 Xplained boards?
I apologize for posting a custom board query in Sama5d2_Xplained category. Henceforward would post my queries on custom board on appropriate category.
blue_z wrote: Since you have a custom board, then why are you using the wrong directory and files?
As our custom board is based on the Sama5d2_xplained (XULT) board design (except nand flash), I thought this would be quick (and dirty) way to get the board up in first place..
blue_z wrote: Backup, how did you write these images to NAND flash?
How did you verify that the images were written correctly?
What value did you use for the NAND parameter header?
I used sam-ba_3.2.0 to program the images to nandflash.
I also used "verify" command of nandflash applet in sam-ba to verify the image.
I used 0xc0098da5 first (which is a default one given in sam-ba_3.2.0, in sama5d2 examples), which is a wrong value.. I did not get any result.
Then I used "0xc0082e07", got the u-boot loaded and running...

This 0xc0082e07 corresponds to the values in PMECC header:
usePmecc = 1, (0x1) - use in-built Pmecc engine in the processor
nbSectorPerPage = 3, (0x3) - "2^x" number of sectors per page, where x= "nbSectorPerPage"
spareSize = 224, (0xe0)
eccBitReq = 1, (0x1) - 4 bits ECC minimum
sectorSize = 0, (0x0) - 512 bytes sector consideration
eccOffset = 2, (0x2) - minimum offset
sig_key = 12, (0xc)

Please correct me if I'm wrong in above interpretation.

Now, I got error again in u-boot environment saveenv command, which I will post in separate topic.
Thanks agian!!,
blue_z
Location: USA
Posts: 1504
Joined: Thu Apr 19, 2007 10:15 pm

Re: SAMA5D2: NAND flash issue in AT91bootstrap

Tue Oct 17, 2017 12:35 am

ganesha.ld wrote: Then I used "0xc0082e07", got the u-boot loaded and running...

This 0xc0082e07 corresponds to the values in PMECC header:
usePmecc = 1, (0x1) - use in-built Pmecc engine in the processor
nbSectorPerPage = 3, (0x3) - "2^x" number of sectors per page, where x= "nbSectorPerPage"
spareSize = 224, (0xe0)
eccBitReq = 1, (0x1) - 4 bits ECC minimum
sectorSize = 0, (0x0) - 512 bytes sector consideration
eccOffset = 2, (0x2) - minimum offset
sig_key = 12, (0xc)
I'm not an expert on this, but I get the impression (from every working example) that the eccOffset should be specified to locate the ECC data at the (very) end of the OOB area.
So your specification of the minimum offset is probably wrong.
For an OOB size of 224 bytes, 8 sectors per page, and 4 bits of ECC (which requires a code word of 7 bytes), the eccOffset should probably be 168 (224 - 8 * 7) or 0xA8.

Study Enable and Configure PMECC

You can use the U-Boot command `nand dump.oob <offset_of_page>` to view the OOB areas.

Regards

Return to “SAMA5 Xplained”

Who is online

Users browsing this forum: No registered users and 1 guest