打印

7se512外挂sram,读sram报"data abort"

[复制链接]
1863|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
mytempid|  楼主 | 2007-11-29 12:26 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
请教各位,可能是什么原因导致这种错误?
现在时钟是11.0592MHz,没有使用PLL

SMC接口初始化代码如下:
void init_io(void)
{
    AT91S_SMC2 *pSMC = AT91C_BASE_SMC;

    //---------------------------------------------
    // 禁止下列PIOA I/O功能
    *AT91C_PIOA_PDR = AT91C_PA0_A0_NBS0 |
                      AT91C_PA1_A1_NBS2 |
                      AT91C_PA2_A2 |
                      AT91C_PA3_A3 |
                      AT91C_PA4_A4 |
                      AT91C_PA5_A5 |
                      AT91C_PA6_A6 |
                      AT91C_PA7_A7 |
                      AT91C_PA8_A8 |
                      AT91C_PA9_A9 |
                      AT91C_PA10_A10 |
                      AT91C_PA11_A11 |
                      AT91C_PA12_A12 |
                      AT91C_PA13_A13 |
                      AT91C_PA14_A14 |
                      AT91C_PA15_A15 |
                      AT91C_PA22_NCS5_CFCE1;
    
    // PIOA选择B外设功能
    // PIOA0~PIOA15为外部总线地址线
    *AT91C_PIOA_BSR = AT91C_PA0_A0_NBS0 |
                      AT91C_PA1_A1_NBS2 |
                      AT91C_PA2_A2 |
                      AT91C_PA3_A3 |
                      AT91C_PA4_A4 |
                      AT91C_PA5_A5 |
                      AT91C_PA6_A6 |
                      AT91C_PA7_A7 |
                      AT91C_PA8_A8 |
                      AT91C_PA9_A9 |
                      AT91C_PA10_A10 |
                      AT91C_PA11_A11 |
                      AT91C_PA12_A12 |
                      AT91C_PA13_A13 |
                      AT91C_PA14_A14 |
                      AT91C_PA15_A15 |
                      AT91C_PA22_NCS5_CFCE1;



    // 禁止下列PIOB I/O功能
    *AT91C_PIOB_PDR = AT91C_PB20_IRQ0;

    // PIOB选择A外设功能
    *AT91C_PIOB_BSR = AT91C_PB20_IRQ0;

    // 禁止下列PIOC I/O功能
    *AT91C_PIOC_PDR = AT91C_PC0_D0 |
                      AT91C_PC1_D1 |
                      AT91C_PC2_D2 |
                      AT91C_PC3_D3 |
                      AT91C_PC4_D4 |
                      AT91C_PC5_D5 |
                      AT91C_PC6_D6 |
                      AT91C_PC7_D7 |
                      AT91C_PC8_D8 |
                      AT91C_PC9_D9 |
                      AT91C_PC10_D10 |
                      AT91C_PC11_D11 |
                      AT91C_PC12_D12 |
                      AT91C_PC13_D13 |
                      AT91C_PC14_D14 |
                      AT91C_PC15_D15 |
                      AT91C_PC16_NWAIT |
                      AT91C_PC21_NWR0_NWE_CFWE |
                      AT91C_PC22_NRD_CFOE;

    // PIOC选择A外设功能
    // PIOC0~PIOC15为外部总线数据线
    *AT91C_PIOC_ASR = AT91C_PC0_D0 |
                      AT91C_PC1_D1 |
                      AT91C_PC2_D2 |
                      AT91C_PC3_D3 |
                      AT91C_PC4_D4 |
                      AT91C_PC5_D5 |
                      AT91C_PC6_D6 |
                      AT91C_PC7_D7 |
                      AT91C_PC8_D8 |
                      AT91C_PC9_D9 |
                      AT91C_PC10_D10 |
                      AT91C_PC11_D11 |
                      AT91C_PC12_D12 |
                      AT91C_PC13_D13 |
                      AT91C_PC14_D14 |
                      AT91C_PC15_D15;

    // PIOC选择B外设功能
    // PIOC21,PIOC22分别是外部总线写,读信号
    *AT91C_PIOC_BSR = AT91C_PC16_NWAIT |
                      AT91C_PC21_NWR0_NWE_CFWE |
                      AT91C_PC22_NRD_CFOE;

    pSMC->SMC2_CSR[5] = AT91C_SMC2_BAT;

}

程序中没有除了运行PIT中断没有执行其它功能。

相关帖子

沙发
mytempid|  楼主 | 2007-11-29 13:54 | 只看该作者

我使用keil环境

keil如何设置外部ram空间?
外部sram的基址是0x60000000,只要访问这个地址,就会报"DATA ABORT"

使用特权

评论回复
板凳
mytempid|  楼主 | 2007-11-30 17:28 | 只看该作者

解决了



现在改用片选0,设置如下:
    pSMC->SMC2_CSR[0] = AT91C_SMC2_NWS & 0x10 |
                        AT91C_SMC2_WSEN |
                        AT91C_SMC2_TDF |
                        AT91C_SMC2_BAT |
                        AT91C_SMC2_DBW_16 |
                        AT91C_SMC2_ACSS_3_CYCLES |
                        AT91C_SMC2_RWSETUP |
                        AT91C_SMC2_RWHOLD;

实际读写外部sram正常,但keil软仿真报错。
 
还没空恢复成NCS5再次测试:)。
 

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

28

主题

388

帖子

1

粉丝