Successfully reported this slideshow.

Using Flash Memory for embedded storage


Published on

  • Be the first to comment

  • Be the first to like this

Using Flash Memory for embedded storage

  1. 1. Utilizing the NanoBoard Flash Memory Summary This application note describes how the serial Flash Memory on the NanoBoard can be used as embedded Application Note Flash RAM within an FPGA design. AP0114 (v1.0) January 20, 2004 The NanoBoard provides serial Flash RAM for use as embedded memory in an FPGA design, enabling you to load and store an embedded software file that will be used when the target design is running. One example of where such functionality would prove useful, is in a design that takes, as input, an audio data file and subsequently processes the data from that file. The audio file would be just the candidate for storage in the memory provided by the NanoBoard. Using Flash Memory for embedded storage An 8Mbit Flash RAM device (M25P80) is used to provide embedded memory functionality within an FPGA design. This device is component U7 on the NanoBoard. Wiring the Flash RAM into the FPGA design When wiring up the schematic in the FPGA design project, the Flash RAM device is represented by a Port-Plugin component and is available from the FPGA NanoBoard Port-Plugin integrated library (Program FilesAltium2004LibraryFpgaFPGA NanoBoard Port-Plugin.IntLib). Figure 1 shows an example of how the Flash RAM is wired into a design. Figure 1. Placing the embedded Flash RAM in the design. AP0114 (v1.0) January 20, 2004 1
  2. 2. Utilizing the NanoBoard Flash Memory The Flash RAM is an SPI-compatible device. The host microcontroller accesses the memory through the SPI Bus Interface Controller on the NanoBoard, as illustrated in Figure 2. The Controller plays the role of SPI Bus Master, determining who accesses the SPI Bus (NanoBoard Controller, FPGA Daughter Board or Host Computer (via the parallel port)) and which of the SPI slave devices (Embedded Flash RAM, FPGA Boot Flash RAM, NanoBoard System Clock) is selected for communications. Flash RAM MCU SPI Bus Interface (Embedded) Controller SPI_DOUT SDO SPI_DIN SDI SPI_CLK SCLK SPI_MODE Flash RAM Finite State (FPGA Boot) SPI_SEL Machine CS3 CS2 CS1 Board Clock Figure 2. MCU-to-Flash RAM communications. 2 AP0114 (v1.0) January 20, 2004
  3. 3. Utilizing the NanoBoard Flash Memory The following table provides interface signal details for the SPI Bus Interface Controller: Table 1. Interface signals for the SPI Bus Controller. Name Type Polarity/ Description Bus size SPI_DOUT I - Serial Data input. This is data sent from the MCU, to be written into the Flash RAM. SPI_DIN O - Serial Data output. This is data read from the Flash RAM, to be sent to the MCU. SPI_CLK I Rise Serial Clock SPI_MODE I - Together, these signals are used to define the mode for the SPI Bus – who is accessing the SPI Bus at that time. The bus can be SPI_SEL I - accessed by the following: - NanoBoard Controller - FPGA Daughter Board - Host PC (via Parallel Port) The specific SPI slave device to which communications are established is also defined. Control of mode and slave selection is carried out using a Finite State Machine. Flash RAM Interface Signals SDO I - Serial Data Input. Data is shifted into the device on the rising edge of SCLK SDI O - Serial Data Output. Data is shifted out of the device on the falling edge of SCLK SCLK I - Serial Clock CS1 I Low Chip Select. When active (Low) the Flash RAM device is enabled. AP0114 (v1.0) January 20, 2004 3
  4. 4. Utilizing the NanoBoard Flash Memory Running the Flash Memory Controller The procedure for loading an embedded software file into the Flash RAM can be carried out at any time – with or without an FPGA project open and irrespective of whether a design has currently been programmed into the target FPGA device (on the Daughter Board). From the Devices view, simply double-click on the icon for the NanoBoard Controller whose associated Embedded Flash RAM you wish to load. The Instrument Rack for the NanoBoard Controllers will appear as shown in Figure 3. Figure 3. NanoBoard Controllers Instrument Rack. Note: If you have multiple NanoBoards daisy-chained together, the NanoBoard Controller chain will reflect each detected (powered-up) board. Each NanoBoard Controller in the chain will only appear in the Instrument Rack after its corresponding icon has been specifically double-clicked. On the instrument panel of the required NanoBoard Controller, click on the Embedded button. The Flash RAM Controller For Embedded Software dialog will appear (Figure 4). From this dialog, press the Electronic Signature button. This tests the communications link between the NanoBoard Controller and the Flash RAM device. If communications are successful, a value will be entered into the field to the immediate right of the button and the confirmatory message “Device Found: M25P80 (8M-Bit Serial Flash RAM)” will be displayed. Figure 4. Flash RAM Controller for Embedded Software dialog. Erasing the Flash Memory Before loading the required embedded software file into the Flash RAM device, the memory must first be cleared. To erase the entire 8Mbit of Flash memory, press the Erase Entire Device button in the Flash RAM Controller for Embedded Software dialog. The erasing process will take approximately 5 seconds, after which a confirmation dialog will appear. 4 AP0114 (v1.0) January 20, 2004
  5. 5. Utilizing the NanoBoard Flash Memory Figure 5. Confirmation of memory erasure. To verify that the device has been successfully erased, press the Blank Check button in the Flash RAM Controller for Embedded Software dialog. Once the check has been conducted, you will receive another confirmation dialog. Figure 6. Verifying that memory erasure was successful. Programming the Flash Memory Once the Flash RAM has been erased, the embedded software file can now be downloaded. From the Flash RAM Controller for Embedded Software dialog, press the … button (located at the top-right of the dialog). The Choose Embedded Software File for Download dialog appears (Figure 7). This dialog allows you to browse for and open the required embedded software file. Figure 7. Browsing for the embedded software file to download. AP0114 (v1.0) January 20, 2004 5
  6. 6. Utilizing the NanoBoard Flash Memory After choosing the file and clicking Open, you will be returned to the Flash RAM Controller for Embedded Software dialog. The chosen file (including path) will be displayed, as shown in Figure 8. Figure 8. Embedded software file chosen and ready for download. To download this file to the Flash RAM, simply click the Save File To Flash button. The download process will proceed, with progress shown in the Design Explorer's Status bar. At the end of the download an information dialog will appear confirming the end of the process (Figure 9). Figure 9. Confirmation of file download to the Flash RAM device. Verification of download to Flash Memory After you have downloaded the embedded software file to the Flash RAM device, a check should be made to ensure the integrity of the file. To do this, from the Flash RAM Controller for Embedded Software dialog, click on the Verify against File button. The contents of the Flash RAM are read back and compared against the original embedded software file. The progress for this process is again shown in the Design Explorer's Status bar. An information dialog will appear with details of the verification results. Figure 10. Successful verification of downloaded file. 6 AP0114 (v1.0) January 20, 2004
  7. 7. Utilizing the NanoBoard Flash Memory If the download process is shown to have failed, the verification will report an error count. A large number of errors typically indicates that the Flash RAM device was not successfully erased prior to download of the embedded software file. In this case, try erasing the device again – using the Erase Entire Device button – and then using the Blank Check button to verify that the device's memory has indeed been successfully erased. The embedded software file can then be downloaded again. Revision History Date Version No. Revision 20-Jan-2004 1.0 New product release Software, hardware, documentation and related materials: Copyright © 2004 Altium Limited. All rights reserved. You are permitted to print this manual provided that (1) the use of such is for personal use only and will not be copied or posted on any network computer or broadcast in any media, and (2) no modifications of the manual is made. Unauthorized duplication, in whole or part, of this document by any means, mechanical or electronic, including translation into another language, except for brief excerpts in published reviews, is prohibited without the express written permission of Altium Limited. Unauthorized duplication of this work may also be prohibited by local statute. Violators may be subject to both criminal and civil penalties, including fines and/or imprisonment. Altium, CAMtastic, Design Explorer, DXP, LiveDesign, NanoBoard, Nexar, nVisage, P-CAD, Protel, Situs, TASKING, and Topological Autorouting and their respective logos are trademarks or registered trademarks of Altium Limited or its subsidiaries. All other registered or unregistered trademarks referenced herein are the property of their respective owners and no trademark rights to the same are claimed. AP0114 (v1.0) January 20, 2004 7