8# 香水城
呵呵,看了。现在sram驱动不起来,请问,我该如何去查?我从网上参考的代码。 不知道是软件问题还是硬件问题。您有什么好的建议?是fsmc复用方式外扩sram的(IS62WV51216BLL)。
#define Bank1_SRAM1_ADDR ((u32)0x60000000)
/*********************************************
* 功能说明:外扩IS62WV5121BLL SRAM端口初始化
* 输入参数:void
* 返回参数:void
*********************************************/
void GPIO_Init_IS(void){
GPIO_InitTypeDef GPIO_InitStructure;
/* 使能 FSMC, GPIOB, GPIOD, GPIOE和AFIO时钟 */
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC | RCC_AHBPeriph_SRAM, ENABLE);
RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE |
RCC_APB2Periph_AFIO, ENABLE);
/* 设置 PB.07(NADV)为复用推挽输出*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(GPIOB, &GPIO_InitStructure);
/* 设置 PD.00(D2), PD.01(D3), PD.04(NOE), PD.05(NWE), PD.07(NE1),PD.08(D13), PD.09(D14),
PD.10(D15), PD.11(A16), PD.12(A17), PD.13(A18), PD.14(D0), PD.15(D1)为复用推挽输出 */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_7 |
GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 |GPIO_Pin_11 | GPIO_Pin_12 |
GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
GPIO_Init(GPIOD, &GPIO_InitStructure);
/* 设置 PE.00(NLB), PE.01(NUB), PE.07(D4), PE.08(D5), PE.09(D6),PE.10(D7), PE.11(D8),
PE.12(D9), PE.13(D10), PE.14(D11), PE.15(D12)为复用推挽输出 */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9 |
GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 |GPIO_Pin_13 | GPIO_Pin_14 |
GPIO_Pin_15;
GPIO_Init(GPIOE, &GPIO_InitStructure);
}
/*********************************************
* 功能说明:外扩IS62WV5121BLL SRAM FSMC配置部分
* 输入参数:void
* 返回参数:void
*********************************************/
void FSMCConfig_IS(void){
FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure;
FSMC_NORSRAMTimingInitTypeDef FSMC_NORSRAMTimingInitStructure;
FSMC_NORSRAMTimingInitStructure.FSMC_AddressSetupTime = 15;
FSMC_NORSRAMTimingInitStructure.FSMC_AddressHoldTime = 15;
FSMC_NORSRAMTimingInitStructure.FSMC_DataSetupTime = 255;
FSMC_NORSRAMTimingInitStructure.FSMC_BusTurnAroundDuration = 15;
FSMC_NORSRAMTimingInitStructure.FSMC_CLKDivision = 15;
FSMC_NORSRAMTimingInitStructure.FSMC_DataLatency = 15;
FSMC_NORSRAMTimingInitStructure.FSMC_AccessMode = F SMC_AccessMode_B;
FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM1;
FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Enable;
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_AsynchronousWait = FSMC_AsynchronousWait_Disable;
FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;
FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &FSMC_NORSRAMTimingInitStructure;
FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &FSMC_NORSRAMTimingInitStructure;
FSMC_NORSRAMInit( &FSMC_NORSRAMInitStructure );
/* - BANK 1 (of NOR/SRAM Bank 1~4) is enabled */
FSMC_NORSRAMCmd( FSMC_Bank1_NORSRAM1, ENABLE );
} |