Friday, November 20, 2009

How to confirm if NAND Flash has inside wrong data (h/w issue) or s/w issue


I tried to fix a board called avt2 V1.0. It shows "cannot get kernel image" after boot loader finished run. It uses:
a) 2GB Nand flash
b) 64MB SDRAM
c) Ingenic jz4720 CPU

the test s/w is done by Carlos CarmagoXinagFu tought me that the allocation of nand flash is as below,

# 4M            4M         504           1.5G
#|-----------------|-------------|----------------|--------------------------|
#|u-boot       |kernel   |  rootfs    |        data           |

The commands for scripts are:

           KERNEL=./uImage
           sudo usbboot -f ./usbboot_2gb_nand_64M.cfg -c "boot;nprog 0 u-boot-nand.bin 0 0 -n"
           sudo usbboot -f ./usbboot_2gb_nand_64M.cfg -c "nprog 1024 uImage 0 0 -n"

After running scripts, it always shows "cannot get image kernel". This image size is around 1.8MB, we tried to use:

           nand erase 0

but this command didn't find any fault. And reflash avt2 again, it still cannot get kernel. So we firstly thought it was an unstable image kernel to cause that. So we reflashed it by XiangFu's codes. His kernel is around 1.5MB. Then it all worked well. So that was really confused us. Because same board with different image kernel but got different results. Especially XiangFu's kernel worked fine. Also then we thought might be have h/w issue on flash itself but we didn't know exactly. Because stage 1 and stage 2 were working well. This means the address and data bus of nand flash are physically connected to cpu and sdram well. So this must be somewhere inside flash defectively. Then XiangFu suggested me to use another avt2 board with same s/w. Then we found that one was totally work perfect. So he suggested that we needed to try to think that can we just moved image kernel shift move a little bit inside flash to see what will it happen. So we changed command as following:

             sudo usbboot -f ./usbboot_2gb_nand_64M.cfg -c "nprog 512 uImage 0 0 -n"

and set boot evironment args into nand as following:

             setenv bootcmd nand read 0x80600000 0x200000 0x200000\;bootm

Then the root cause was found, it run well and can get kernel image. This approved that there might some pages defective around between 5.5MB and 5.8MB inside of flash.

Also there's an easy way to measure how many resistor between V33 and GND pins, the normal value will be around 170K ohm. But if your this board have defective nand flash, sometimes the value will be very lower than 20K ohm.

No comments:

Post a Comment