野火电子论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 26879|回复: 0

fsmc如何驱动 nand flash

[复制链接]
发表于 2021-4-2 09:30:31 | 显示全部楼层 |阅读模式
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要做什么处理                                         

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

联系站长|手机版|野火电子官网|野火淘宝店铺|野火电子论坛 ( 粤ICP备14069197号 ) 大学生ARM嵌入式2群

GMT+8, 2024-9-22 13:30 , Processed in 0.051844 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表