在线时间4 小时
UID291152
ST金币0
蝴蝶豆0
注册时间2011-5-15
初级会员
- 最后登录
- 2019-5-27
|
a0a.1 0b0c
写个程序控制PCCARD, 使用nCE4_2,看资料上其地址为0x900000000,根据固件库写代码如下(主要部分):
#define Bank4_NAND_ADDR ((uint32_t)0x90000000)
void PCCARD_Init(void)
{
FSMC_PCCARDInitTypeDef FSMC_PCCARDInitStructure;
FSMC_NAND_PCCARDTimingInitTypeDef p;
FSMC_PCCARDDeInit();
p.FSMC_SetupTime = 3;
p.FSMC_WaitSetupTime = 3;
p.FSMC_HoldSetupTime = 3;
p.FSMC_HiZSetupTime = 0;
FSMC_PCCARDInitStructure.FSMC_Waitfeature = FSMC_Waitfeature_Disable; //禁止等待
FSMC_PCCARDInitStructure.FSMC_TCLRSetupTime = 0x0;
FSMC_PCCARDInitStructure.FSMC_TARSetupTime = 0x0;
FSMC_PCCARDInitStructure.FSMC_CommonSpaceTimingStruct = &p;
FSMC_PCCARDInitStructure.FSMC_AttributeSpaceTimingStruct = &p;
FSMC_PCCARDInitStructure.FSMC_IOSpaceTimingStruct = &p;
FSMC_PCCARDInit(&FSMC_PCCARDInitStructure);
FSMC_PCCARDCmd(ENABLE);
}
void PCCARD_WriteReg(uint16_t CPLD_Reg, uint16_t CPLD_RegValue)
{
*(__IO uint16_t *)(Bank4_NAND_ADDR ) = CPLD_RegValue;
}
在此不考虑能否实现读写PCCARD,只讨论控制线。
用示波器监控nCE4_2(用于控制PCCARD)和NE3(控制SRAM),我测试只读写SRAM,发现NE3控制得很好,nCE4_2不会有变化。但是发现只要调用PCCARD_WriteReg这个函数,那么nCE4_2和NE3就会同时产生下降沿。如果我把地址从0x90000000调整为0x98000000,结果就更加奇怪了,NE3会产生下降沿,反而nCE4_2没有任何反应了。请问这是不是STM32F103的BUG还是什么问题造成的呢?请高手指教啊! |
|