2008-12-16 05:27 AM
2008-12-16 05:27 AM
I need to address the ext. memory (21e00000) in ST91x. I have configured the EMI as follow but still failed~ can you help me?
GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 | GPIO_Pin_5 |GPIO_Pin_6 | GPIO_Pin_7; GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ; GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt3; GPIO_InitStructure.GPIO_IPInputConnected = GPIO_IPInputConnected_Disable; GPIO_Init (GPIO5, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All; GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ; GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt2; GPIO_InitStructure.GPIO_IPInputConnected = GPIO_IPInputConnected_Disable; GPIO_Init (GPIO7, &GPIO_InitStructure); GPIO_Init (GPIO8, &GPIO_InitStructure); GPIO_Init (GPIO9, &GPIO_InitStructure); // those bastards. this one pin out of 24 is on a different alt bus GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7; GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt3; GPIO_Init (GPIO7, &GPIO_InitStructure); // configure SCU SCU_EMIModeConfig(SCU_EMI_DEMUX); SCU_EMIBCLKDivisorConfig(SCU_EMIBCLK_Div1); // or SCU_EMIBCLK_Div1; SCU->GPIOEMI = 1; // enable ports 8 & 9 for EMI GPIO_EMIConfig( ENABLE ); /* Enable EMI clock */ EMI_DeInit(); EMI_StructInit( &eMI_InitStruct ); eMI_InitStruct.EMI_Bank_MemWidth = EMI_Width_HalfWord; eMI_InitStruct.EMI_Bank_IDCY =0x6; eMI_InitStruct.EMI_Bank_WSTRD =0x6; eMI_InitStruct.EMI_Bank_WSTWR =0x6; eMI_InitStruct.EMI_Bank_WSTROEN=0x6; eMI_InitStruct.EMI_Bank_WSTWEN=0x08; eMI_InitStruct.EMI_Bank_MemWidth=EMI_Width_HalfWord; EMI_Init( EMI_Bank1, &eMI_InitStruct );