- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi,
I am new to digital design and FPGAs, and I am having trouble with the flash Memory on the Cyclone II development board. I am playing around with a simple (6502) based cpu core (actually the FPGA64 commodore 64 emulator) and I am trying to use the flashRAM as a ROM. The addresses to the flash are being held steady for over 400ns but all I get back on the flash data lines is $FE, which never changes even when the address changes. I have a simple wave file exported from Signal TapII, along with the vhdl of my memory manger code which I will try to attach as a zip file. I wrote a simple verilog program to increment the memory address of the flash every two clock cycles (using the 27mhz clock), and that seemed to work just fine. I have no idea why this code doesn't work. I would really appreciate some input as I have read plenty but this is my first time using real physical hardware and I am struggling :( Thanks Simon :)Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I guess, that the hardware is Cyclone II Starter Board. In this case, at least the FLASH_CE signal is missing from the SignalTap recording and also from the design. Without asserting CE low, no output from flash can be expected. Another question is which data has been programmed to flash.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes I am using the Cyclone II starter kit.
The flash was 'burned' using their example control panel file that comes with the board. I used this to upload my raw data from my binary dump files, there are 3 images, one from $A000-$BFFF, one from $D000-$DFFF and one from $E000-$FFFF. I have checked the flash data both with the example control panel application and with a simple verilog program I wrote that simply set flash address to $F000 and incremented it every two clock cycles (27mhz clock). I checked the data that I got back from polling the flash data pins using signal tap II. On the cyclone II development board there does not appear to be a pin out for the flash CE signal. The reference documents give no pin number for its connection. Also their example starter file, while it does declare a FLASH_CE signal in the verilog header, has no matching pin assignment in the assignment file. I have not looked at the schematics but am guessing that this is held low all the time. I certainly would be interested if there is indeed a connection for this pin. Simon :)- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I had checked the schematics before my reply. FLASH_CE is at pin AB15.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, thank you, thank you, thank you. I have spent the last week frustrated on this problem!
It is now working. Yeah. I am mystified though why the reference documents are incorrect, and also the example files don't have a pin assignment for flash_ce_n. It always seemed weird to me looking through the docs because there was a ce signal for the other chips. Looking at the schematics it is tied to a pull up resistor, so I don't know why I was able to get my verilog code to work without specifying the flash_ce_n pin. I admit though that sometimes that code would work and sometimes it wouldn't, but I don't know why that would be though, seems like it would always be tri-stated. Anyway thanks again for the help, I am going to go study those schematics now..... Simon- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The Altera documentation shows the flash part number as S29AL032DTFN.
Spansion data sheet shows the S29AL032DTFN only avaliable in the 90ns speed grade. If you are changing the address every 74ns(1/27MHz*2), you will not be meeting the specs of the flash device. Page 30 http://www.altera.com/literature/manual/mnl_cii_starter_board_rm.pdf Page 11 http://www.spansion.com/datasheets/s29al032d_00_a8_e.pdf- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have a problem with the flash, too. I want to write an HEX-Code to the flash and after changing the position of the switch I want to read the code from the flash and give it out at the LED's. It have to be a simple programm for testing how I can work with the flash. I use the DE2-70 board with cyclone II an the flash is: S29GL064A90TFIR4 Here is my code: module TE1 ( Adress, Data, CE, OE, WE, WP, RESET, BYTE, LED, SW_OE, SW_WE, LEDG, LEDG2, LEDG3, CLK_50 ); input CLK_50; output [21:0] Adress; output CE; output OE; output WE; output WP; output RESET; output BYTE; output SW_OE; output SW_WE; output [15:0] LED; output LEDG; output LEDG2; output LEDG3; inout [15:0] Data; reg [15:0] LED; reg LEDG; reg LEDG2; reg LEDG3; reg [15:0] Data; reg OE; reg WE; assign Adress = 22'h000001; assign CE = 0; assign WP = 1; assign RESET = 1; assign BYTE = 1; always @(posedge CLK_50) begin if ((SW_OE == 0)) begin OE <= SW_OE; WE <= !SW_OE; Data <= 16'hBDE7; LEDG <= 1; end else if ((SW_OE == 1)) begin OE <= SW_OE; WE <= !SW_OE; LED <= Data; LEDG2 <= 1; end else LEDG3 <= 1; end endmodule when I load the programm at the board LEDG lights up an after changing the switch position nothing happens. The LEDG's are only to show where the programm stopps. Why did nothing else happen after changing the position of the switch?any idea? I'm from germany so say something if you dont understand what I mean!^^ thanks- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I see several points why your code doesn't work as expected.
As a very general point, you can't write data to a flash memory by simply activating WE. Consult the flash datasheet at the DE2-70 system cd, you'll see that it's a rather complex action to write data to a flash. Basically it can be done in HDL code, but not in a few lines of code. As a more simple point, you're apparently using the flash control signals inverted. They are active low, shown by a# suffix in datasheet, but you set OE=1 and WE=0 and expect data at the data bus. I wonder if DE2-70 has suitable examples to evaluate such basic operations, but I'm not very familiar to the Terasic hardware or software.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yes sure... the flash datasheet says, for the write operation I need to set the pins as follow:
CE->0 OE->1 WE->0 WP->1 because I have nothing to protect RESET->1 for No Reset BYTE->1 for use the DATA -Bits DQ0 to DQ15 an these I have set... or what do you exactly mean? di I forgot something or missunderstand something? ok..."#" mean that they are active low...ok...that was something I don't know... so maybe the other pins are incorrect set...- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- OE->1 WE->0 ... an these I have set --- Quote End --- you set the opposite polarity in the code below --- Quote Start --- if ((SW_OE == 0)) begin OE <= SW_OE; -- oe <= '0' WE <= !SW_OE; -- we <= '1' Data <= 16'hBDE7; --- Quote End --- As I said, this was the simple point. The other point is, that writing to the flash this way doesn't actually store anything in the memory array.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I changed the code completely because I have too much misstakes!^^
now these I have done: module test_veri( SW_OE, SW_WE, CLK_50, LEDG, CE, WP, RESET, BYTE, OE, WE, Adress, Data, LED ); input CLK_50; input SW_OE; input SW_WE; output [2:0] LEDG; output CE; output WP; output RESET; output BYTE; output OE; output WE; output [21:0] Adress; output [15:0] LED; inout [15:0] Data; reg [2:0] LEDG; reg [15:0] LED; reg [15:0] Data; assign CE = 0; assign WP = 1; assign RESET = 1; assign BYTE = 1; assign OE = SW_OE; assign WE = SW_WE; assign Adress = 1; always @(posedge CLK_50) begin if((SW_OE==0)&&(SW_WE==1)) begin LEDG = 3'b100; LED = Data; end else if ((SW_OE==1)&&(SW_WE==0)) begin LEDG = 3'b010; Data = 16'hBDE7; end else begin LEDG = 3'b001; LED = 0; end end endmodule is that what you mean with the OE and the WE? in the datasheet is wrote that for the read-operation for example the CE# has to be at Low, have it to be 1 or 0 ? its a little bit confusing. is it now right?^^ ok...and the other point...why would it not work?I mean...I have the read and write operation in it...what do I need else that it would work?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When you set
data = 16'hbde7;oe = 1;
we = 0;and the other signals to useful fixed levels, what do you expect to happen at the flash device? There is another point, I previously forgot. To read from a bidirectional pin, you have to drive the output to high impedance state, e. g. Data = 16'bz.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I set this:
assign CE = 0; assign WP = 1; assign RESET = 1; assign BYTE = 1; assign Adress = 1; to fixed levels because at the read and write operation they have the same level... If i set the switch SW_OE = 0 and SW_WE =1 i expect that the Data hBDE7 was set at Adress 1 in de flash...when I then pull the switch SW_OE to 1 and the SW_WE to 0 I expect that he gives the Data (hBDE7) to the LED's SW_OE is connected with OE and SW_WE with WE... how would the code looks like, when I want to read it? I mean...when I set at the Data 16'bz how can I read then the data again from Data? I mean...I set it with z...do you know what I mean?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, I think you are operating the flash interface correct now, both for read and write (exept for the missing 16'bz setting, I think).
--- Quote Start --- i expect that the Data hBDE7 was set at Adress 1 in de flash --- Quote End --- But actually nothing happens, as I already told you --- Quote Start --- You can't write data to a flash memory by simply activating WE. Consult the flash datasheet at the DE2-70 system cd, you'll see that it's a rather complex action to write data to a flash. Basically it can be done in HDL code, but not in a few lines of code. --- Quote End --- This didn't mean the bus signals, it's about a complex command sequence.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ok... do you know where I can find a ready written code for that?
I have also a second question...how can I include a VHDL-file in a Verilog code?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't know a HDL code for flash programming. Mostly, this is done from embedded processor, e. g. NIOS II. But as I said, it's surely possible, involving a state machine to step through the various states of unlocking sequence. Also a flash has to be erased before reprogramming.
Including a VHDL component in Verilog is easy, it's actually done in Quartus megafunctions in many places (using both directions). You simply interface a VHDL component as it would be a Verilog module. There is a restriction with ModelSim that you can use old style# ( ) parameter syntax for generics only. In Quartus, you can also use defparam syntax to set VHDL generics. For the opposite direction, you write a component declaration that correspondends to a Verilog module and instantiate it as it would be a VHDL.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I am using cyclone 3 starter kit. I am not able to program my flash memory. when i try to reset the factory settings the loading is stuck at 71% . in the programming window the FPGA name appears as none after 71%. But the same cycloneIII_3c25_noise _standard file, if i loaded it as .sof file it is getting loaded 100%. Looks like i have damaged the flash memory. One another thing is my FPGA is getting heated rapidly. Does anyone have any idea on what the damage to the flash memory would have to do with the heating? Any response will be highly helpful ! thanks :)- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page