|
发表于 2020-8-6 09:21:08
|
显示全部楼层
本帖最后由 hpdell 于 2020-8-6 09:33 编辑
你好,我移植 nand 貌似没有成功,但是会一直在
貌似程序在上面的函数里面出不来 ??
我使用的 nand 型号是
MT29F16G08ABABA
相关配置:
//#define NAND_PAGE_SIZE ((uint16_t)0x0800) /* 2 * 1024 bytes per page w/o Spare Area */
#define NAND_PAGE_SIZE ((uint16_t)0x1000) /* 4 * 1024 bytes per page w/o Spare Area */
#define BAD_BLOCK_POSITION 0 /* 0 is the bad block byte postion */
#define EXTRA_BYTE_POSITION 2 /* 2 is the extra bytes starting byte postion */
#define ECC_BYTE_POSITION 40 /* 40 is the ECC starting byte position */
#define TOTAL_BLOCKS (512 * 1024 /128) // 这个地方我目前不清楚配置的对不对呀 ??
#define PHYSICAL_PAGES_PER_BLOCK 128 /* Min value of 2 */
#define BYTES_PER_PHYSICAL_PAGE 4096 /* 4096 bytes per page */
#define WORDS_PER_PHYSICAL_PAGE BYTES_PER_PHYSICAL_PAGE/4 /* Words per page */
#define SPARE_BYTES_PER_PAGE 224 /* 224 "spare" bytes per page */
/* For 2048 byte block spare area: */
/* hnand1.Config */
NAND_Handle.Config.PageSize = 4096; //NAND memory page (without spare area) size measured in bytes
//for 8 bits adressing or words for 16 bits addressing
//NAND内存页(无备用区)大小,以字节为单位,用于8位地址或用于16位地址的字
NAND_Handle.Config.SpareAreaSize = 224; //NAND memory spare area size measured in bytes
//for 8 bits adressing or words for 16 bits addressin
//NAND存储器备用区大小(以字节为单位,用于8位寻址或以16字节地址为单位
NAND_Handle.Config.BlockSize = 128; //NAND memory block size measured in number of pages
//NAND存储块大小,以页数为单位
NAND_Handle.Config.BlockNbr = 4096; //NAND memory number of total blocks,NAND存储器总块数
NAND_Handle.Config.PlaneNbr = 2; //NAND memory number of planes,NAND内存层数
NAND_Handle.Config.PlaneSize = 2048; //NAND memory zone size measured in number of blocks,NAND存储区大小以块数为单位
if(IsNandFormate)
{
status = fx_media_format(&nand_disk,
nand_flash_driver, // Driver entry
FX_NULL, // Unused
nand_media_memory, // Media buffer pointer
sizeof(nand_media_memory), // Media buffer size
NAND_FX_NAME, // Volume Name
2, // Number of FATs
32, // Directory Entries
0, // Hidden sectors
(1024*1024*1024*2/512), // Total sectors
512, // Sector size
1, // Sectors per cluster
1, // Heads
1); // Sectors per track
if(status == FX_SUCCESS) nand_init_ok=1;
}
|
|