打印

STR710读写39VF1601的程序,读不出,请指教

[复制链接]
1902|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
fmc|  楼主 | 2008-6-20 09:22 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
程序执行EMI_Config(0, j);后EMI_BCON0=0X803D, Check_SST_39VF160X()中ReturnStatus = FALSE;,电路是CS0接FLASH,请问哪里不对??


#define FALSE                   0
#define TRUE                    1

#define SECTOR_SIZE             2048    // Must be 2048 words for 39VF160X
#define BLOCK_SIZE              32768   // Must be 32K words for 39VF160X

#define SST_ID                  0x00BF  // SST Manufacturer's ID code
#define SST_39VF1601            0x234B  // SST39VF1601 device code
#define SST_39VF1602            0x234A  // SST39VF1602 device code

typedef unsigned char           BYTE;     // BYTE is 8-bit in length
typedef unsigned int            WORD;     // WORD is 16-bit in length
typedef unsigned long int       Uint32;   // Uint32 is 32-bit in length

Uint32 system_base = 0x60000000;  // 4GByte System Memory Address.
    // This sample code uses 0xC0000000 as the system_base address.
       // The user should modify this address accordingly.

#define sysAddress(offset) ((volatile WORD *)(system_base + offset))


int Check_SST_39VF160X(void)
{
    WORD SST_id1;
    WORD SST_id2;
    int  ReturnStatus;

    //  Issue the Software Product ID code to 39VF160X
    *sysAddress(0x5555) = 0x00AA;  // write data 0x00AA to device addr 0x5555
    *sysAddress(0x2AAA) = 0x0055;  // write data 0x0055 to device addr 0x2AAA
    *sysAddress(0x5555) = 0x0090;  // write data 0x0090 to device addr 0x5555
    Delay_150_Nano_Seconds();   // Tida Max 150ns for 39VF160X

    // Read the product ID from 39VF160X
    SST_id1  = *sysAddress(0x0000);   // get first ID byte
    SST_id2  = *sysAddress(0x0001);   // get second ID byte

    // ------------------------------------------------------------
    // Determine whether there is a SST 39VF1601 installed or not
    // use the following code:

    if ((SST_id1 == SST_ID) && (SST_id2 == SST_39VF1601))
            ReturnStatus = TRUE;
    else
            ReturnStatus = FALSE;
    // ------------------------------------------------------------
    // Or determine whether there is a SST 39VF1602 installed or not
    // use the following code:
     
    if ((SST_id1 == SST_ID) && (SST_id2 == SST_39VF1602))
            ReturnStatus = TRUE;
    else
            ReturnStatus = FALSE;
    // ------------------------------------------------------------

    // Issue the Software Product ID Exit code, thus returning the
    // 39VF160X to the normal operation.
    *sysAddress(0x5555) = 0x00AA;  // write data 0x00AA to device addr 0x5555
    *sysAddress(0x2AAA) = 0x0055;  // write data 0x0055 to device addr 0x2AAA
    *sysAddress(0x5555) = 0x00F0;  // write data 0x00F0 to device addr 0x5555
    Delay_150_Nano_Seconds();   // Tida Max 150ns for 39VF160X
                                    
    return (ReturnStatus);
}



void __main(void)
{
    int i = 0, j;

   
    j= EMI_WAITSTATE(15);
    j=j| EMI_SIZE_16;
    j=j|EMI_ENABLE;
    EMI_Config(0, j);
         Check_SST_39VF160X();

}

相关帖子

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

本版积分规则

fmc

10

主题

12

帖子

0

粉丝