Forum Discussion
Altera_Forum
Honored Contributor
12 years ago --- Quote Start --- Hi.. I am trying to write/ read from the flash. I am working on an Altera DE2 board. I am just trying to write some value (8-bit) in into a fixed memory location in a flash, and am trying to read it. I am able to read values from flash code but not able to write the values I want. i.e The value being read is not the value I wrote in that memory, which shows that 'write' operation is not taking place. Please help me out.. (attached below :code ) module flashcontroller( //REF_CLK, RESET_N, CLK, SW, SWIN, //controller outputs LEDR, FL_ADDR, FL_DQ, FL_CE_N, FL_OE_N, FL_WE_N, FL_RST_N, ); //input REF_CLK; input RESET_N; input CLK; input SW; input [7:0] SWIN; inout [7:0] FL_DQ ; output [21:0] FL_ADDR; output FL_CE_N; output FL_OE_N; output FL_WE_N; output FL_RST_N; output [7:0] LEDR; wire[21:0] rFL_MAX; reg [21:0] rFL_ADDR; reg [7:0] rFL_DQ; reg rFL_RST_N; reg [7:0] rLEDR; reg rFL_WE_N; reg rFL_OE_N; reg rFL_CE_N; // assign rFL_MAX = 22'b1111111111111111111111; // assign FL_DQ = 8'b10000001; // assign FL_WE_N = 1'b1; // assign FL_OE_N = 1'b0; // assign FL_CE_N = 1'b0; assign FL_RST_N = rFL_RST_N; assign FL_ADDR = rFL_ADDR; assign LEDR = rLEDR; assign FL_DQ = rFL_DQ; assign FL_CE_N = rFL_CE_N; assign FL_OE_N = rFL_OE_N; assign FL_WE_N = rFL_WE_N; always@(posedge CLK or negedge RESET_N) begin if (!RESET_N) begin rFL_RST_N <= 0; rFL_ADDR <= 0; end else if (SW == 1) begin rFL_RST_N <= 1; rFL_DQ <= 8'bz; rFL_WE_N <= 1'b1; rFL_OE_N <= 1'b0; rFL_CE_N <= 1'b0; rLEDR <= FL_DQ; end else begin rFL_RST_N <= 1; rFL_WE_N <= 1'b0; rFL_OE_N <= 1'b1; rFL_CE_N <= 1'b0; rFL_DQ <= SWIN; rLEDR <= SWIN; // rFL_RST_N <= 1; // if (rFL_ADDR > rFL_MAX) // begin // rFL_ADDR <= 0; // end // else // begin // rFL_ADDR <= rFL_ADDR+1; // end end end endmodule --- Quote End --- Hi. I sorry because my English is not good. I read at this topic http://www.alteraforum.com/forum/showthread.php?t=2541&page=2 Have done it yet? I'm trying to read data on kit de2 but i'm not success. Please send me your code or some advise. Thank you so much. :D