Skip to contentSkip to conversation

NAND flash - bad blocks

U-Boot Dimitar Penev 2 participants 6 messages Jan 10, 2013 – Jan 15, 2013

lore
Share & tools
lore
#0 lore raw

Hello,

First of all sorry if this question was already answered here.

We are sourcing some K9F8G08U0M-PIB0 NAND flash devices.
On the first erase in uboot 2011.09 I got bunch of mostly consecutive bad blocks.
According to the datasheet we should get not more then 80 bad blocks for our chip
but I get something like 240 bad blocks for most of the NAND chips.

I seems to be able to fix this using the following procedure:

In uboot
uboot>nand scrub.chip

In uboot
uboot>nand erase.chip clean
at this point I get usually 1,2 bad blocks which looks normal to me.

In Linux we have few mtd partitions on this NAND chip. Unmount all of them and for all of them :
linux>nandtest -m /dev/mtdx
Usually this doesn't add any new badblocks on top of what I get on nand erase in uboot,
but I really haven't tested that much device to say.

After this procedure the NAND flash seems to work fine. Do you think this is reliable way?
Is there something better I can do?

Has anyone got NAND component batch having more bad blocks then datasheet allows.
Should we consider the provider unreliable?

Thank you
Dimitar

#1 lore raw
Quoted 4 lines · Dimitar Penev

Hello,

First of all sorry if this question was already answered here.

Quoted 8 lines

We are sourcing some K9F8G08U0M-PIB0 NAND flash devices. On the first erase in uboot 2011.09 I got bunch of mostly consecutive bad blocks.
According to the datasheet we should get not more then 80 bad blocks for our chip
but I get something like 240 bad blocks for most of the NAND chips.

I seems to be able to fix this using the following procedure:

Call your NAND vendor and complain?

After making sure that there's nothing wrong with your NAND driver or controller that causes the OOB to be read incorrectly. Did you do anything to the NAND chip prior to this "first erase"? In particular, did you write to the OOB?

Quoted 6 lines

In uboot
uboot>nand scrub.chip

In uboot
uboot>nand erase.chip clean
at this point I get usually 1,2 bad blocks which looks normal to me.

You're not fixing anything -- you're wiping out all bad block information. Those "1,2 bad blocks" are not actually bad blocks, but are the bad block table which appears "bad" to reserve it. These should be at the end of flash. Or, possibly, they're blocks that happen to be damaged in a way that prevents the bad block marker from becoming 0xff.

Quoted 9 lines

In Linux we have few mtd partitions on this NAND chip. Unmount all of them and for all of them :
linux>nandtest -m /dev/mtdx
Usually this doesn't add any new badblocks on top of what I get on nand erase in uboot,
but I really haven't tested that much device to say.

After this procedure the NAND flash seems to work fine. Do you think this is reliable way?

No.

-Scott

#2 lore raw

Hi Scott,

Quoted 12 lines · Dimitar Penev
Quoted 11 lines

Hello,

First of all sorry if this question was already answered here.

We are sourcing some K9F8G08U0M-PIB0 NAND flash devices.
On the first erase in uboot 2011.09 I got bunch of mostly consecutive bad blocks.
According to the datasheet we should get not more then 80 bad blocks for our chip
but I get something like 240 bad blocks for most of the NAND chips.

Quoted 4 lines
Quoted 1 line

I seems to be able to fix this using the following procedure:

Call your NAND vendor and complain?

Well we did but we didn't got something from them which could explain what we observe.

Quoted 2 lines

After making sure that there's nothing wrong with your NAND driver or controller that causes the OOB to be read incorrectly.

We are using nand_plat driver provide by ADI without any customization.

Quoted 2 lines

Did you do anything to the NAND chip prior to this "first erase"? In particular, did you write to the OOB?

For boards coming out of the assembly house:
I load uboot in SPI flash, boot from SPI and get the NAND chip recognized properly.
On 'nand erase.chip' command I get bunch of bad blocks.
So I guess we haven't even touched OOB before 'nand erase'

Assuming the components are OK the only possible explanation could be overheating
of the chips in the assembly house. Does anybody get something similar?

Quoted 8 lines
Quoted 7 lines

In uboot
uboot>nand scrub.chip

In uboot
uboot>nand erase.chip clean
at this point I get usually 1,2 bad blocks which looks normal to me.

Quoted 5 lines

You're not fixing anything -- you're wiping out all bad block information. Those "1,2 bad blocks" are not actually bad blocks, but are the bad block table which appears "bad" to reserve it. These should be at the end of flash. Or, possibly, they're blocks that happen to be damaged in a way that prevents the bad block marker from becoming 0xff.

Oh Really?
What about 'nandtest -m' in Linux ? I was hoping it does a check of the erase blocks.

Quoted 8 lines
Quoted 8 lines

In Linux we have few mtd partitions on this NAND chip. Unmount all of them and for all of them :
linux>nandtest -m /dev/mtdx
Usually this doesn't add any new badblocks on top of what I get on nand erase in uboot,
but I really haven't tested that much device to say.

Quoted 4 lines
Quoted 2 lines

After this procedure the NAND flash seems to work fine. Do you think this is reliable way?

No.

Thanks Scott.
Is there any procedure to analyze the nand flash for bad blocks?

Quoted 2 lines

-Scott

Best Regards
Dimitar

#3 lore raw
Quoted 19 lines · Dimitar Penev

Hi Scott,

Quoted 12 lines · Dimitar Penev
Quoted 11 lines

Hello,

First of all sorry if this question was already answered here.

We are sourcing some K9F8G08U0M-PIB0 NAND flash devices. On the first erase in uboot 2011.09 I got bunch of mostly consecutive bad blocks.
According to the datasheet we should get not more then 80 bad blocks for our chip
but I get something like 240 bad blocks for most of the NAND chips.

Quoted 4 lines
Quoted 1 line

I seems to be able to fix this using the following procedure:

Call your NAND vendor and complain?

Quoted 8 lines

Well we did but we didn't got something from them which could explain what we observe.

Quoted 2 lines

After making sure that there's nothing wrong with your NAND driver or controller that causes the OOB to be read incorrectly.

We are using nand_plat driver provide by ADI without any customization.

Still, do some investigation to see whether it seems to be working. Dump the raw data that you read -- is it mostly 0xff with some bad block markers set, or is it returning garbage? Do any of the blocks that are not marked bad have non-0xff data? If you do a scrub of the entire NAND chip, then write to one block, does the write show up anywhere else on the NAND chip?

Quoted 14 lines
Quoted 7 lines
Quoted 6 lines

In uboot
uboot>nand scrub.chip

In uboot
uboot>nand erase.chip clean
at this point I get usually 1,2 bad blocks which looks normal to me.

Quoted 6 lines

You're not fixing anything -- you're wiping out all bad block information. Those "1,2 bad blocks" are not actually bad blocks, but are the bad block table which appears "bad" to reserve it. These should be at the end of flash. Or, possibly, they're blocks that happen to be damaged in a way that prevents the bad block marker from becoming 0xff.

Quoted 3 lines

Oh Really?
What about 'nandtest -m' in Linux ? I was hoping it does a check of the erase blocks.

That's no substitute for having the factory bad block markers. Nandtest doesn't look very rigorous at all -- and only seems to mark bad blocks if the erase or write operations return failure, not if it sees an uncorrectable error on readback.

Quoted 2 lines

Thanks Scott.
Is there any procedure to analyze the nand flash for bad blocks?

Yes, and it's done by the flash manufacturer to produce bad block markers. :-P

-Scott

#4 lore raw

Hi Scott,

I have tried to do some more tests on the board with the NAND chip I have scrub-ed

-I have done 'nand erase.chip clean' and tried to probe different nand regions
(I have 128MB RAM and 1GB NAND and I am not sure how I could dump the whole NAND at once)
It seems the whole NAND is 0xFF

After that I have written 10MB at the beginning of the NAND and those data was verified to be written OK
Outside of the 10MB region the NAND stays 0xFF

in Linux 'nandtest' doesn't report any issue.

So I tend to think that nand scrub did a good think for me.

Best Regards
Dimitar

----- Original Message -----
From: "Scott Wood" <[email protected]>
To: "Dimitar Penev" <[email protected]>
Cc: <[email protected]>
Sent: Friday, January 11, 2013 10:21 PM
Subject: Re: [U-Boot] NAND flash - bad blocks

Quoted 19 lines · Dimitar Penev

Hi Scott,

Quoted 12 lines · Dimitar Penev
Quoted 11 lines

Hello,

First of all sorry if this question was already answered here.

We are sourcing some K9F8G08U0M-PIB0 NAND flash devices.
On the first erase in uboot 2011.09 I got bunch of mostly consecutive bad blocks.
According to the datasheet we should get not more then 80 bad blocks for our chip
but I get something like 240 bad blocks for most of the NAND chips.

Quoted 4 lines
Quoted 1 line

I seems to be able to fix this using the following procedure:

Call your NAND vendor and complain?

Quoted 7 lines

Well we did but we didn't got something from them which could explain what we observe.

Quoted 2 lines

After making sure that there's nothing wrong with your NAND driver or controller that causes the OOB to be read incorrectly.

We are using nand_plat driver provide by ADI without any customization.

Still, do some investigation to see whether it seems to be working. Dump the raw data that you read -- is it mostly 0xff with some bad block markers set, or is it returning garbage? Do any of the blocks that are not marked bad have non-0xff data? If you do a scrub of the entire NAND chip, then write to one block, does the write show up anywhere else on the NAND chip?

Quoted 14 lines
Quoted 7 lines
Quoted 6 lines

In uboot
uboot>nand scrub.chip

In uboot
uboot>nand erase.chip clean
at this point I get usually 1,2 bad blocks which looks normal to me.

Quoted 6 lines

You're not fixing anything -- you're wiping out all bad block information. Those "1,2 bad blocks" are not actually bad blocks, but
are the bad block table which appears "bad" to reserve it. These
should be at the end of flash. Or, possibly, they're blocks that happen to be damaged in a way that prevents the bad block marker from becoming 0xff.

Quoted 3 lines

Oh Really?
What about 'nandtest -m' in Linux ? I was hoping it does a check of the erase blocks.

That's no substitute for having the factory bad block markers. Nandtest doesn't look very rigorous at all -- and only seems to mark bad blocks if the erase or write operations return failure, not if it sees an uncorrectable error on readback.

Quoted 2 lines

Thanks Scott.
Is there any procedure to analyze the nand flash for bad blocks?

Yes, and it's done by the flash manufacturer to produce bad block markers. :-P

-Scott

#5 lore raw
Quoted 6 lines · Dimitar Penev

Hi Scott,

I have tried to do some more tests on the board with the NAND chip I have scrub-ed

-I have done 'nand erase.chip clean'

Don't specify "clean". That will cause jffs2 cleanmarkers to be written. Not all NAND chips can handle partial programming, and in any case it's an unnecessary variable for figuring out the bad block situation.

Quoted 4 lines

and tried to probe different nand regions
(I have 128MB RAM and 1GB NAND and I am not sure how I could dump the whole NAND at once)
It seems the whole NAND is 0xFF

Including OOB?

Quoted 1 line

So I tend to think that nand scrub did a good think for me.

No, it didn't. You are ignoring the problem.

-Scott