|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
我想对flash am29lv040B进行擦除,发了擦除命令后并没有去执行擦除,过来的兄弟看看。代码还有MHS文件,以及am29lv040B的手册我都放在了下面。
//====================================================
#include "xparameters.h"
#include "xcache_l.h"
#include "stdio.h"
#include "xutil.h"
//====================================================
int main (void)
{
int i=0;
int j=0;
char*cmdAddr=
(char*)XPAR_GENERIC_EXTERNAL_MEMORY_MEM0_BASEADDR;
XCache_EnableICache(0x80000000);
XCache_EnableDCache(0x80000000);
print("-- Entering main() --\r\n");
xil_printf("enter erase\n ");
{
cmdAddr[0x555] = 0xaa;
cmdAddr[0x2aa] = 0x55;
cmdAddr[0x555] = 0x80;
cmdAddr[0x555] = 0xaa;
cmdAddr[0x2aa] = 0x55;
cmdAddr[0x555] = 0x10;
xil_printf("%08x \n",cmdAddr); //此处可以正常输出为0x05000000,flash的基址
for(i=0;i<500000000;i++); // 大约20多秒的延时,以便擦除完成
}
for(i=0;i<2*1024;i++) //输出前2K个字节与原来的进行比较,看是否擦除了。 { //事实上并没有擦除。不知为何
xil_printf(" %02x ",cmdAddr);
if((i+1)%16==0)
xil_printf("\n ");
}
print("-- Exiting main() --\r\n");
return 0;
}
//=======================================================
MHS文件:
//=======================================================
//全局端口:
PARAMETER VERSION = 2.1.0
PORT fpga_0_RS232_req_to_send_pin = net_gnd, DIR = O
PORT fpga_0_RS232_RX_pin = fpga_0_RS232_RX, DIR = I
PORT fpga_0_RS232_TX_pin = fpga_0_RS232_TX, DIR = O
PORT fpga_0_Generic_GPIO_GPIO_d_out_pin = fpga_0_Generic_GPIO_GPIO_d_out, DIR = O,
VEC = [0:5]
PORT fpga_0_Generic_GPIO_GPIO_in_pin = fpga_0_Generic_GPIO_GPIO_in, DIR = I, VEC = [0:5]
PORT fpga_0_Generic_GPIO_GPIO_t_out_pin = fpga_0_Generic_GPIO_GPIO_t_out, DIR = O,
VEC = [0:5]
PORT fpga_0_Generic_GPIO_GPIO_IO_pin = fpga_0_Generic_GPIO_GPIO_IO, DIR = IO,
VEC = [0:5]
PORT fpga_0_Generic_SDRAM_SDRAM_DQ_pin = fpga_0_Generic_SDRAM_SDRAM_DQ,
DIR = IO, VEC = [0:63]
PORT fpga_0_Generic_SDRAM_SDRAM_Addr_pin = fpga_0_Generic_SDRAM_SDRAM_Addr,
DIR = O, VEC = [0:11]
PORT fpga_0_Generic_SDRAM_SDRAM_DQM_pin = fpga_0_Generic_SDRAM_SDRAM_DQM,
DIR = O, VEC = [0:7]
PORT fpga_0_Generic_SDRAM_SDRAM_WEn_pin = fpga_0_Generic_SDRAM_SDRAM_WEn,
DIR = O
PORT fpga_0_Generic_SDRAM_SDRAM_CKE_pin = fpga_0_Generic_SDRAM_SDRAM_CKE,
DIR = O
PORT fpga_0_Generic_SDRAM_SDRAM_CSn_pin = fpga_0_Generic_SDRAM_SDRAM_CSn,
DIR = O
PORT fpga_0_Generic_SDRAM_SDRAM_CASn_pin = fpga_0_Generic_SDRAM_SDRAM_CASn,
DIR = O
PORT fpga_0_Generic_SDRAM_SDRAM_RASn_pin = fpga_0_Generic_SDRAM_SDRAM_RASn,
DIR = O
PORT fpga_0_Generic_SDRAM_SDRAM_Clk_pin = fpga_0_Generic_SDRAM_SDRAM_Clk, DIR = O
PORT fpga_0_Generic_SDRAM_SDRAM_BankAddr_pin =
fpga_0_Generic_SDRAM_SDRAM_BankAddr, DIR = O, VEC = [0:1]
PORT fpga_0_Generic_External_Memory_Mem_DQ_pin =
fpga_0_Generic_External_Memory_Mem_DQ, DIR = IO, VEC = [0:7]
PORT fpga_0_Generic_External_Memory_Mem_A_pin =
fpga_0_Generic_External_Memory_Mem_A, DIR = O, VEC = [0:31]
# PORT fpga_0_Generic_External_Memory_Mem_BEN_pin =
# fpga_0_Generic_External_Memory_Mem_BEN, DIR = O, VEC = [0:0]
PORT fpga_0_Generic_External_Memory_Mem_WEN_pin =
fpga_0_Generic_External_Memory_Mem_WEN, DIR = O
PORT fpga_0_Generic_External_Memory_Mem_OEN_pin =
fpga_0_Generic_External_Memory_Mem_OEN, DIR = O, VEC = [0:0]
PORT fpga_0_Generic_External_Memory_Mem_CEN_pin =
fpga_0_Generic_External_Memory_Mem_CEN, DIR = O, VEC = [0:0]
# PORT fpga_0_Generic_External_Memory_flash_csn_dummy_pin = net_vcc, DIR = O
# PORT fpga_0_Generic_External_Memory_Mem_RPN_pin =
#fpga_0_Generic_External_Memory_Mem_RPN, DIR = O
PORT sys_clk_pin = dcm_clk_s, DIR = I, SIGIS = DCMCLK
PORT sys_rst_pin = sys_rst_s, DIR = I
// ppc405
BEGIN ppc405
PARAMETER INSTANCE = ppc405_0
PARAMETER HW_VER = 2.00.c
BUS_INTERFACE JTAGPPC = jtagppc_0_0
BUS_INTERFACE ISOCM = iocm
BUS_INTERFACE DSOCM = docm
BUS_INTERFACE IPLB = plb
BUS_INTERFACE DPLB = plb
PORT PLBCLK = sys_clk_s
PORT C405RSTCHIPRESETREQ = C405RSTCHIPRESETREQ
PORT C405RSTCORERESETREQ = C405RSTCORERESETREQ
PORT C405RSTSYSRESETREQ = C405RSTSYSRESETREQ
PORT RSTC405RESETCHIP = RSTC405RESETCHIP
PORT RSTC405RESETCORE = RSTC405RESETCORE
PORT RSTC405RESETSYS = RSTC405RESETSYS
PORT BRAMISOCMCLK = sys_clk_s
PORT BRAMDSOCMCLK = sys_clk_s
PORT CPMC405CLOCK = proc_clk_s
END
//emc
BEGIN opb_emc
PARAMETER INSTANCE = Generic_External_Memory
PARAMETER HW_VER = 2.00.a
PARAMETER C_MAX_MEM_WIDTH = 8
PARAMETER C_MEM0_WIDTH = 8
PARAMETER C_SYNCH_MEM_0 = 0
PARAMETER C_OPB_CLK_PERIOD_PS = 15151
PARAMETER C_NUM_BANKS_MEM = 1
PARAMETER C_INCLUDE_DATAWIDTH_MATCHING_0 = 1
PARAMETER C_TCEDV_PS_MEM_0 = 150000
PARAMETER C_TWC_PS_MEM_0 = 150000
PARAMETER C_TAVDV_PS_MEM_0 = 150000
PARAMETER C_TWP_PS_MEM_0 = 60000
PARAMETER C_THZCE_PS_MEM_0 = 70000
PARAMETER C_TLZWE_PS_MEM_0 = 0
PARAMETER C_MEM0_BASEADDR = 0x05000000
PARAMETER C_MEM0_HIGHADDR = 0x0507ffff
BUS_INTERFACE SOPB = opb
PORT OPB_Clk = sys_clk_s
PORT Mem_DQ = fpga_0_Generic_External_Memory_Mem_DQ
PORT Mem_A = fpga_0_Generic_External_Memory_Mem_A
# PORT Mem_BEN = fpga_0_Generic_External_Memory_Mem_BEN #datasheet 中没有这一位
PORT Mem_WEN = fpga_0_Generic_External_Memory_Mem_WEN
PORT Mem_OEN = fpga_0_Generic_External_Memory_Mem_OEN
PORT Mem_CEN = fpga_0_Generic_External_Memory_Mem_CEN
# PORT Mem_RPN = fpga_0_Generic_External_Memory_Mem_RPN #不知道这个做什么的 #对读出并没有影响,对擦除呢??
END
am29lv040b 的 data sheet在
http://www.datasheetcatalog.com/ ... /9/AM29LV040B.shtml,选择830K的那个,第16页上是相应的命令,25,26页是时序要求。大家给看看吧。 |
|