Using SPI Flash Memory as Embedded Memory

Frozen Content

Related articles: SPI Communications on the NanoBoard NB2, SPI Communications on the NanoBoard 3000

The NanoBoard provides SPI Flash memory for use as embedded memory in an FPGA design. This enables 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 SPI Flash memory provided by the NanoBoard.

The procedure for loading an embedded software file into the SPI Flash memory can be carried out at any time – with or without an FPGA project open and irrespective of whether a design is currently programmed into the target FPGA device.

Controls to download to and erase, the SPI Flash memory, can be found in the Flash RAM Controller For Embedded Software dialog. Access to this dialog and use of its controls are detailed in the following sections.

Accessing Flash Memory Controls

The Flash RAM Controller For Embedded Software dialog is accessed directly from the instrument panel for the NanoBoard's host controller. From the Devices view (View » Devices View), simply double-click on the icon for the NanoBoard (in the NanoBoard Controllers chain) whose embedded Flash memory you wish to load. The Instrument Rack – NanoBoard Controllers panel will appear. Click on the Embedded Flash button to access the dialog.

If using the SPI Flash memory device that can be used for embedded or boot purposes, click on the FPGA Boot Flash button to access the Flash RAM Controller For FPGA Boot dialog. The programming process is identical.

Accessing controls for the embedded Flash memory when using either a NanoBoard NB2 or a NanoBoard 3000.

The Device ID region of the dialog reflects the communications link between the NanoTalk Controller and the Flash memory device. If communications are successful, upon accessing the dialog a value of $13 will be entered into the far right field and the confirmatory message Device Found: M25P80 (8M-Bit Serial Flash RAM) will be displayed. If this is not the case, try to manually interrogate the communications link by pressing the Read Electronic Signature button.

Erasing the Flash Memory

Before loading the required embedded software file into the Flash memory device, the memory must first be cleared. To erase the entire 8Mbit of Flash memory, press the Erase Entire Device button, in the Erase region of the Flash RAM Controller For Embedded Software dialog. The erasing process will take approximately five to eight seconds, after which a confirmation dialog will appear.

Confirming full memory erasure.

Controls are also available for erasing a particular sector of memory. Each M25P80 device is organized into 16 sectors. Each sector contains 256 pages, and each page is 256 bytes wide. Therefore each sector is 65536 bytes or 512Kbits.

Simply use the available drop-down to select the sector you wish to erase (or enter the sector number directly) and then click the Erase Sector button. Erasure time is typically less than a second, after which time you will receive a dialog to confirm completion of the erase.

Confirming sector erasure.

To verify that the device has been successfully erased, press the Blank Check button. The verification process will take approximately sixty seconds, after which time you will receive another confirmation dialog.

Verification of memory erasure.

Downloading to Flash Memory

Once the Flash memory has been erased, the embedded software file can be downloaded. From the Download region of the Flash RAM Controller For Embedded Software dialog, press the ... button to the right of the File Name field. The Choose Embedded Software File For Download dialog will appear. Use this dialog to browse to, and open, the required file.

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 in the File Name field.

Embedded software file chosen and ready for download.

To download this file to the Flash memory device, simply click the Save File To Flash button. If you want to download to a specific area of memory, enter the required address in the Memory Address field. The download process will proceed, with progress shown in Altium Designer's Status bar. At the end of the download an information dialog will appear, confirming the end of the process.

Confirmation of file download to the Flash memory device.

Verifying the Download

After you have downloaded the embedded software file to the Flash memory device, a check should be made to ensure the integrity of the file. To do this, simply click on the Verify against File button, in the Download region of the Flash RAM Controller For Embedded Software dialog.

The contents of the Flash memory are read back and compared against the original embedded software file. Progress is again reflected in Altium Designer's Status bar. An information dialog will appear at the end of the process, providing details of the verification results.

Successful verification of downloaded

If the download process is shown to have failed, the dialog will report an error count. A large number of errors typically indicates that the Flash memory device was not successfully erased prior to downloading 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.

See Also

You are reporting an issue with the following selected text and/or image within the active document: