各位高手:
我在调试AM335X时碰到无法从nandflash启动。
环境:用的SDK6.0 .UBOOT也是里面自带的,UBOOT-2013.CPU为AM3354;NANDFLASH为MT29F2G08ABAGAWP-IT:G (datasheet:MT29F2G08ABAGAWP-ITG.pdf).整个UBOOT启动流程及我的操作步骤如下:
U-Boot 2013.01.01 (Jun 13 2018 – 10:56:58)
I2C: ready
DRAM: 256 MiB
WARNING: Caches not enabled
NAND: 256 MiB
MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
*** Warning – bad CRC, using default environment
musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk split, HB-ISO Rx, HB-ISO Tx, SoftConn)
musb-hdrc: MHDRC RTL version 2.0musb-hdrc: setup fifo_mode 4
musb-hdrc: 28/31 max ep, 16384/16384 memory
USB Peripheral mode controller at 47401000 using PIO, IRQ 0
musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk split, HB-ISO Rx, HB-ISO Tx, SoftConn)
musb-hdrc: MHDRC RTL version 2.0musb-hdrc: setup fifo_mode 4
musb-hdrc: 28/31 max ep, 16384/16384 memory
USB Host mode controller at 47401800 using PIO, IRQ 0
Net: <ethaddr> not set. Validating first E-fuse MAC
cpsw, usb_ether
Hit any key to stop autoboot: 0using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC b0:d5:cc:b3:25:a1
HOST MAC de:ad:be:af:00:00
RNDIS ready
musb-hdrc: peripheral reset irq lost!
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
DHCP client bound to address 192.168.2.3
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC b0:d5:cc:b3:25:a1
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
Using usb_ether device
TFTP from server 192.168.2.1; our IP address is 192.168.2.3
Filename 'debrick.scr'.
Load address: 0x80000000
Loading: TTFTP error: 'File not found or No Access' (1)
Not retrying… –>UBOOT启动完毕
U-Boot# nand erase.chip –>擦除整个NANDFLASH
NAND erase.chip: device 0 whole chip
Skipping bad block at 0x00400000
Erasing at 0xffe0000 — 100% complete.
OK
U-Boot# tftp 0x81000000 MLO –>把MLO文件载入内存
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC b0:d5:cc:b3:25:a1
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
Using usb_ether device
TFTP from server 192.168.2.1; our IP address is 192.168.2.3
Filename 'MLO'.
Load address: 0x81000000
Loading: T #######
18.6 KiB/s
done
Bytes transferred = 100086 (186f6 hex)
U-Boot# cp.b 0x81000000 0x81020000 20000 –>复制第1份MLO 的备份
U-Boot# cp.b 0x81000000 0x81040000 20000 –>复制第2份MLO 的备份U-Boot# cp.b 0x81000000 0x81060000 20000 –>复制第3份MLO 的备份U-Boot# tftp 0x81080000 u-boot.img –>复制u-boot.img到内存
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC b0:d5:cc:b3:25:a1
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
Using usb_ether device
TFTP from server 192.168.2.1; our IP address is 192.168.2.3
Filename 'u-boot.img'.
Load address: 0x81080000
Loading: T #################################
81.1 KiB/s
done
Bytes transferred = 481368 (75858 hex)
U-Boot# nand write 0x81000000 0x0 0x260000 –>把MLO、MLO备份、uboot从内存中写入nandflash
NAND write: device 0 offset 0x0, size 0x260000
2490368 bytes written: OK
U-Boot#U-Boot# nand read 0x82000000 0x0 0x260000 –>再把写入到nand中的内容读到内存中。
NAND read: device 0 offset 0x0, size 0x260000
2490368 bytes read: OK
U-Boot#
重启板板子,发现并没有从nand启动。我的启动配置SYSBOOT[4:0] =10010b,也就是第1启动为nand。在这启动过程,我有量过nandflash的RE# PIN的波形,发现波形是有很多拉低的地方的,也就是说,ROMCODE是有识别到这块nand的。是不是问题出在读取nand的数据的时候校验未过。
uboot中am335x-evm.h中,相关的nand有关的宏如下:
#define CONFIG_SPL_NAND_AM33XX_BCH
#define CONFIG_SPL_NAND_SUPPORT
#define CONFIG_SPL_NAND_BASE
#define CONFIG_SPL_NAND_DRIVERS
#define CONFIG_SPL_NAND_ECC
#endif
#define CONFIG_SYS_NAND_5_ADDR_CYCLE
#define CONFIG_SYS_NAND_PAGE_COUNT (CONFIG_SYS_NAND_BLOCK_SIZE / \
CONFIG_SYS_NAND_PAGE_SIZE)
#define CONFIG_SYS_NAND_PAGE_SIZE 2048
#define CONFIG_SYS_NAND_OOBSIZE 64
#define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024)
#define CONFIG_SYS_NAND_BAD_BLOCK_POS NAND_LARGE_BADBLOCK_POS
#define CONFIG_SYS_NAND_ECCPOS { 2, 3, 4, 5, 6, 7, 8, 9, \
10, 11, 12, 13, 14, 15, 16, 17, \
18, 19, 20, 21, 22, 23, 24, 25, \
26, 27, 28, 29, 30, 31, 32, 33, \
34, 35, 36, 37, 38, 39, 40, 41, \
42, 43, 44, 45, 46, 47, 48, 49, \
50, 51, 52, 53, 54, 55, 56, 57, }
#define CONFIG_SYS_NAND_ECCSIZE 512
#define CONFIG_SYS_NAND_ECCBYTES 14
#define CONFIG_SYS_NAND_ECCSTEPS 4
#define CONFIG_SYS_NAND_ECCTOTAL (CONFIG_SYS_NAND_ECCBYTES * \
CONFIG_SYS_NAND_ECCSTEPS)
#define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE
#define CONFIG_SYS_NAND_U_BOOT_OFFS 0x80000
#define CONFIG_NAND
/* NAND support */
#ifdef CONFIG_NAND
#define CONFIG_CMD_NAND
#define CONFIG_CMD_MTDPARTS
#define MTDIDS_DEFAULT "nand0=omap2-nand.0"
#define MTDPARTS_DEFAULT "mtdparts=omap2-nand.0:128k(SPL)," \
"128k(SPL.backup1)," \
"128k(SPL.backup2)," \
"128k(SPL.backup3),1920k(u-boot)," \
"128k(u-boot-env),5m(kernel),-(rootfs)"
#define CONFIG_NAND_OMAP_GPMC
#define GPMC_NAND_ECC_LP_x16_LAYOUT 1
/*#define GPMC_NAND_ECC_LP_x8_LAYOUT 1*/
#define CONFIG_SYS_NAND_BASE (0x08000000) /* physical address */
/* to access nand at */
/* CS0 */
#define CONFIG_SYS_MAX_NAND_DEVICE 1 /* Max number of NAND
还麻烦各位高手给我点建议,感激不尽!
yongqing wang:
你参考一下这个回答:e2e.ti.com/…/1383950
昨夜无眠:
回复 yongqing wang:
非常感谢您这么晚还来回答我的问题.我查看您给我提供的链接,里面提到的只是用的nand芯片是一同一个,但是不是同样的问题.不过还是谢谢您!
yongqing wang:
回复 昨夜无眠:
配置sysboot从nandflash启动:processors.wiki.ti.com/…/AM335x_U-Boot_User's_Guide
yongqing wang:
回复 yongqing wang:
还有这份对nand的详细指导,eml:processors.wiki.ti.com/…/Linux_Core_NAND_User's_Guide
昨夜无眠:
回复 yongqing wang:
这个我有看过,但是不能解决我的问题,谢谢