|
其他的FSMC 的控制线已经用满了,设计用FSMC和CPLD通信,STM32F103的NCE4_2,NWE,NOW,A[0..8],D[0..15]都和CPLD连接,程序上模拟PCCARD,主要程序如下:
#define Bank_PCCARD_ADDR Bank4_PCCARD_ADDR
#define Bank4_PCCARD_ADDR ((uint32_t)0x90000000)
void PCCARD_Init(void)
{
FSMC_PCCARDInitTypeDef FSMC_PCCADRInitStructure;
FSMC_NAND_PCCARDTimingInitTypeDef p;
p.FSMC_SetupTime = 3;
p.FSMC_WaitSetupTime = 3;
p.FSMC_HoldSetupTime = 3;
p.FSMC_HiZSetupTime = 0;
FSMC_PCCADRInitStructure;.FSMC_Waitfeature = FSMC_Waitfeature_Disable; //禁止等待
FSMC_PCCADRInitStructure;.FSMC_TCLRSetupTime = 0x0;
FSMC_PCCADRInitStructure;e.FSMC_TARSetupTime = 0x0;
FSMC_PCCADRInitStructure;e.FSMC_CommonSpaceTimingStruct = &p;
FSMC_PCCADRInitStructure;.FSMC_AttributeSpaceTimingStruct = &p;
FSMC_PCCADRInitStructure;.FSMC_IOSpaceTimingStruct = &p;
FSMC_PCCARDInit(&FSMC_CPLDInitStructure);
FSMC_PCCARDCmd(ENABLE);
}
void PCCARD_WriteReg(uint16_t PCCARD_Reg, uint16_t PCCARD_RegValue)
{
/* Write 16-bit Index, then Write Reg */
*(__IO uint16_t *)(Bank4_PCCARD_ADDR) = PCCARD_Reg;
/* Write 16-bit Reg */
*(__IO uint16_t *)(Bank4_PCCARD_ADDR) = PCCARD_RegValue;
}
在主程序中调用 PCCARD_WriteReg(0x0008,0x0000);之前已经做好管脚配置和时钟开启的工作了。
使用示波器监控NCE4_2和NWE的波形, 管脚配置和时钟开启后,NCE4_2和NWE都是高电平,这是正常的。但是执行PCCARD_WriteReg(0x0008,0x0000)时,NCE4_2和NWE都没有电平变化,请问哪位大侠能指教是何原因呢?另外前面的地址定位(#define Bank4_PCCARD_ADDR ((uint32_t)0x90000000)
)正确么?
谢谢!
|
|