用以下代码做初始化 void LCD_FSMCConfig(void) { FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure; FSMC_NORSRAMTimingInitTypeDef p; /* FSMC_Bank1_NORSRAM1 timing configuration */ p.FSMC_AddressSetupTime = 0; p.FSMC_AddressHoldTime = 0; p.FSMC_DataSetupTime = 1; p.FSMC_BusTurnAroundDuration = 0; p.FSMC_CLKDivision = 0; p.FSMC_DataLatency = 0; p.FSMC_AccessMode = FSMC_AccessMode_B; /* FSMC_Bank1_NORSRAM4 configured as follows: - Data/Address MUX = Disable - Memory Type = SRAM - Data Width = 16bit - Write Operation = Enable - Extended Mode = Disable - Asynchronous Wait = Disable */ FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM1; FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable; FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_SRAM; 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); /* Enable FSMC_Bank1_NORSRAM1 */ FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM1, ENABLE); } 定义一个操作地址 #define FSMC (*(u16*)((u32)0x60000000))
然后在主程序中 while(1) { FSMC =0xFFFF; FSMC = 0x0000; } 再用示波器观察D0~D15端口上的波形,观测都周期大约是0.4微秒左右,也就是最高3MHZ的速度。比想象的要低得多得多啊,本来以为72MHZ主频下FSMC最高时钟是36MHZ,再加上一些等待周期什么的怎么着也不会太低吧,这里的p.FSMC_DataSetupTime = 1;其他的都是设置成了0,为什么速度还是这么低呢。这样折算起来操作外部SRAM的时候带宽也就最高6MB/S啊,实在是可怜的很。 疏忽了,从0XFFFF 到0X00,实际是一个波形周期对应的是2个FSMC操作,就是实际一个FSMC操作周期是0.2微秒,5MHZ左右,不过也是比想象的慢很多 |