本帖最后由 cornrn 于 2018-12-14 14:50 编辑
阿波罗F429核心板改nand flash 原子原来是MT29F4G08ABADA改成MT29F4G08ABAEA固件 nand.h.c做些许修改。买MT29F4G08时候没太关心尾缀,没晓得区别挺大。买了个MT29F4G08ABAEA焊接上去发现不行,自己看datasheet发现真不一样
修改固件如下:
//NAND FLASH型号和对应的ID号
#define MT29F4G08ABADA 0XDC909556 //MT29F4G08ABADA
#define MT29F4G08ABAEA 0XDC90A654 //MT29F4G08ABAEA
#define MT29F16G08ABABA 0X48002689 //MT29F16G08ABABA
if(nand_dev.id==MT29F16G08ABABA) //NAND为MT29F16G08ABABA
{
nand_dev.page_totalsize=4320; //nand一个page的总大小(包括spare区)
nand_dev.page_mainsize=4096; //nand一个page的有效数据区大小
nand_dev.page_sparesize=224; //nand一个page的spare区大小
nand_dev.block_pagenum=128; //nand一个block所包含的page数目
nand_dev.plane_blocknum=2048; //nand一个plane所包含的block数目
nand_dev.block_totalnum=4096; //nand的总block数目
}
else if(nand_dev.id==MT29F4G08ABADA)//NAND为MT29F4G08ABADA
{
nand_dev.page_totalsize=2112; //nand一个page的总大小(包括spare区)
nand_dev.page_mainsize=2048; //nand一个page的有效数据区大小
nand_dev.page_sparesize=64; //nand一个page的spare区大小
nand_dev.block_pagenum=64; //nand一个block所包含的page数目
nand_dev.plane_blocknum=2048; //nand一个plane所包含的block数目
nand_dev.block_totalnum=4096; //nand的总block数目
}
else if(nand_dev.id==MT29F4G08ABAEA)//NAND为MT29F4G08ABAEA
{
nand_dev.page_totalsize=4320; //nand一个page的总大小(包括spare区)
nand_dev.page_mainsize=4096; //nand一个page的有效数据区大小
nand_dev.page_sparesize=224; //nand一个page的spare区大小
nand_dev.block_pagenum=64; //nand一个block所包含的page数目
nand_dev.plane_blocknum=1024; //nand一个plane所包含的block数目
nand_dev.block_totalnum=2048; //nand的总block数目
}else return 1; //错误,返回
return 0;
u8 NAND_EraseBlock(u32 BlockNum)
{
if(nand_dev.id==MT29F16G08ABABA)BlockNum<<=7; //将块地址转换为页地址
else if(nand_dev.id==MT29F4G08ABADA)BlockNum<<=6;
*(vu8*)(NAND_ADDRESS|NAND_CMD)=NAND_ERASE0;
//发送块地址
*(vu8*)(NAND_ADDRESS|NAND_ADDR)=(u8)BlockNum;
*(vu8*)(NAND_ADDRESS|NAND_ADDR)=(u8)(BlockNum>>8);
*(vu8*)(NAND_ADDRESS|NAND_ADDR)=(u8)(BlockNum>>16);
*(vu8*)(NAND_ADDRESS|NAND_CMD)=NAND_ERASE1;
if(NAND_WaitForReady()!=NSTA_READY)return NSTA_ERROR;//失败
return 0; //成功
这个函数没改,格式化NAND会出错,改为:
if(nand_dev.id==MT29F16G08ABABA)BlockNum<<=7; //将块地址转换为页地址
else if(nand_dev.id==MT29F4G08ABADA)BlockNum<<=6;
else if(nand_dev.id==MT29F4G08ABAEA)BlockNum<<=6;
一周热门 更多>