初中生
最后登录1970-1-1
在线时间 小时
注册时间2020-12-29
|
static void NAND_GPIO_Config(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
FSMC_NAND_PCCARDTimingInitTypeDef p;
FSMC_NANDInitTypeDef FSMC_NANDInitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE
| RCC_APB2Periph_GPIOG, ENABLE);
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC,ENABLE);
/*pd11-cle pd12-ale ce-pd7 pd5-we pd4-re*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_14 | GPIO_Pin_15 | GPIO_Pin_0 | GPIO_Pin_1 |
GPIO_Pin_11|GPIO_Pin_12|GPIO_Pin_7|GPIO_Pin_4|GPIO_Pin_5;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(GPIOD, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10;
GPIO_Init(GPIOE, &GPIO_InitStructure);
/*RBbusyout nint pg6*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
GPIO_Init(GPIOG, &GPIO_InitStructure);
p.FSMC_SetupTime = 0x1;
p.FSMC_WaitSetupTime = 0x3;
p.FSMC_HoldSetupTime = 0x2;
p.FSMC_HiZSetupTime = 0x1;
FSMC_NANDInitStructure.FSMC_Bank = FSMC_Bank2_NAND; //Ñ¡Ôñnand¿é2
FSMC_NANDInitStructure.FSMC_Waitfeature = FSMC_Waitfeature_Enable; //??FSMC?????
FSMC_NANDInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_8b; //NAND Flash??????8?
FSMC_NANDInitStructure.FSMC_ECC = FSMC_ECC_Enable; //??ECC??
FSMC_NANDInitStructure.FSMC_ECCPageSize = FSMC_ECCPageSize_2048Bytes; //ECC???2048
FSMC_NANDInitStructure.FSMC_TCLRSetupTime = 0x00;
FSMC_NANDInitStructure.FSMC_TARSetupTime = 0x00;
FSMC_NANDInitStructure.FSMC_CommonSpaceTimingStruct = &p;
FSMC_NANDInitStructure.FSMC_AttributeSpaceTimingStruct = &p;
FSMC_NANDInit(&FSMC_NANDInitStructure);
/*!??FSMC BANK2 */
FSMC_NANDCmd(FSMC_Bank2_NAND, ENABLE);
}
我的板子pg6引脚连得R/B,即FSMC_INT与nand flash相连、我看网上的资料还初始化了PD6即FSMC_NWAIT引脚 。
FSMC_NWAIT和fsmc_int选 用上有什么不同,使用FSMC_INT要做什么处理
|
|