Writing and Reading From FLASH ROM on Nexys 2 Spartan 3-E FPGA

flashfpgamemoryrom;vhdl

I am a newbie to VHDL and FPGA platform. I have a Nexys-2 Spartan 3E FPGA board which is provided with a 16 MB Flash ROM.I want to preload first 10-20 memory locations of this ROM,each location with some 16 bit data.Once I am done with the writing part I wish to read these memory locations in my VHDL code (which is an another *.bit file).I checked out Digilent website and also checked some reference manuals but I could not get the idea of accessing this ROM.It would be a great help if someone could guide or enlighten me on how should I proceed to implement this.

Best Answer

I do not own a Nexys II board, but a quick look at the user guide and the schematic from the Digilent website and I can see that all the signals needed for programming the flash ROM device are available at the Spartan 3E pins. This is as I would have expected.

To program this device, you can do one of two thing:

1) The first option is a two step process in iteself. You first create the VHDL code for a Flash Programmer, that erases a block and writes your new data to the ROM. You'll need the datasheet for the Intel Flash ROM to do this. Then assign the ROM pins in the UCF file according to the table in the Digilent user guide and upload this .bit file to the platform flash. When it starts, it will execute the flash programmer code and write the ROM for you. The data you want to program is in the VHDL and thus also in the .bit file so the programmer can access the data to write to flash; or

2) the Flash ROM device does not have a JTAG interface and is thus not part of the JTAG chain. However, with a bit of work, you can use a BSDL file (Boundary Scan Description Language), available from Xilinx for FPGA on your board, and using OpenJTAG you can flip bits on the FPGA to program the device.

This "Boundary Scan Programming" of the flash device is quite common in production, however if you don't have a good Boundary Scan flash programmer it an be tedious to do it by hand using OpenJTAG commands.

I recommed option (1) since it's likely the quickest for you to accomplish. You'll need the Intel Datasheet for the StrataFlash ROM and basically send the commands to the the ROM to do an erase cycle and a write cycle for your data.

For the 20 bytes or so you want to program into ROM I'd consider a simple 20 byte flash programmer in VHDL.

However, for something more complete, there is an app note from Xilinx NOR FLASH Programmer for Spartan-3E Starter Kit. That is for another board but can be easily modified for your own board by changing the pin assignments. That appnote presents a design that programs the FPGA with a UART and a Picoblaze MCU to act as a full featured flash ROM programmer.