初中生
最后登录1970-1-1
在线时间 小时
注册时间2016-12-20
|
楼主 |
发表于 2016-12-21 09:09:10
|
显示全部楼层
我参考例程写的fsmc 有问题吗?
- GPIO_InitTypeDef GPIO_InitStructure;
-
- /* 使能FSMC时钟*/
- RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE);
-
- /* 使能FSMC对应相应管脚时钟*/
- RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE | RCC_APB2Periph_AFIO,ENABLE);
-
- /* 配置FSMC相对应的数据线,*/
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;//复用推挽
- /* PD 9 11*/
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_9;
- GPIO_Init(GPIOD, &GPIO_InitStructure);
- /* PE 10 11 12 13 14 15*/
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13 |
- GPIO_Pin_14 | GPIO_Pin_15;
- GPIO_Init(GPIOE, &GPIO_InitStructure);
-
- /* 配置FSMC相对应的控制线
- * PD4-FSMC_NOE :LCD-RD
- * PD5-FSMC_NWE :LCD-WR
- * PD7-FSMC_NE1 :LCD-CS
- * PD11-FSMC_A16 :LCD-DC
- */
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;
- GPIO_Init(GPIOD, &GPIO_InitStructure);
-
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;
- GPIO_Init(GPIOD, &GPIO_InitStructure);
-
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7;
- GPIO_Init(GPIOD, &GPIO_InitStructure);
-
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
- GPIO_Init(GPIOD, &GPIO_InitStructure);
- FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure;
- FSMC_NORSRAMTimingInitTypeDef p;
-
-
- p.FSMC_AddressSetupTime = 0x02; //地址建立时间
- p.FSMC_AddressHoldTime = 0x00; //地址保持时间
- p.FSMC_DataSetupTime = 0x05; //数据建立时间
- p.FSMC_BusTurnAroundDuration = 0x00;
- p.FSMC_CLKDivision = 0x00;
- p.FSMC_DataLatency = 0x00;
- p.FSMC_AccessMode = FSMC_AccessMode_B;
-
- FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM1;
- FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable;
- FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_NOR;
- FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b;
- FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable;
- FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;
- FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable;
- FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState;
- FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable;
- FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable;
- FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable;
- FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;
- FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p;
- FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p;
-
- FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure);
-
- /* 使能 FSMC Bank1_SRAM Bank */
- FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM1, ENABLE);
复制代码
|
|