求助,关于nandflash
时间:10-02
整理:3721RD
点击:
我用9200的A21和A22接nand flash(k9f1208)的ALE和CLE,往nandflash里写命令和地址用的是一下代码
#define AT91_SMARTMEDIA_BASE 40000000
#define AT91_SMART_MEDIA_ALE (1 << 22) /* our ALE is AD22 */
#define AT91_SMART_MEDIA_CLE (1 << 21) /* our CLE is AD21 */
#define FLASH_COMMAND (AT91_SMARTMEDIA_BASE+AT91_SMART_MEDIA_CLE )
#define FLASH_ADDRESS (AT91_SMARTMEDIA_BASE+AT91_SMART_MEDIA_ALE )
#define WRITE_ADDRESS(val) (*(volatile char *) FLASH_ADDRESS = (char)(val))
#define WRITE_COMMAND(val) (*(volatile char *) FLASH_COMMAND = (char)(val))
可是总是写不进去,哪位能指点一下,感激不尽
#define AT91_SMARTMEDIA_BASE 40000000
#define AT91_SMART_MEDIA_ALE (1 << 22) /* our ALE is AD22 */
#define AT91_SMART_MEDIA_CLE (1 << 21) /* our CLE is AD21 */
#define FLASH_COMMAND (AT91_SMARTMEDIA_BASE+AT91_SMART_MEDIA_CLE )
#define FLASH_ADDRESS (AT91_SMARTMEDIA_BASE+AT91_SMART_MEDIA_ALE )
#define WRITE_ADDRESS(val) (*(volatile char *) FLASH_ADDRESS = (char)(val))
#define WRITE_COMMAND(val) (*(volatile char *) FLASH_COMMAND = (char)(val))
可是总是写不进去,哪位能指点一下,感激不尽
哪位大哥指点一下啊,上面写错了,4000 0000应该是0x40000000
要寫入資料前,先將ALE,CLE,CE,拉為低電位,WE,RE昇為高電位,將寫入命令(80h,10h)前把CLE(Command Latch Enable)拉為高電位,每輸入一個Byte時,將WE拉至低電位,再回到高電位,命令輸入完後,就是輸入位址,輸入位址時要將CLE拉低,ALE(Address Latch Enable)拉高,地址輸入完後就是輸入資料,查command sets有讀取的命令,寫完資料後再讀取出來比對看看資料對不對。