Utilizing the SPI Flash Memory on the NanoBoard-NB1
The NanoBoard-NB1 provides Serial SPI Flash memory 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.
An 8Mbit Flash memory device (M25P80) is used to provide this embedded memory functionality. This device is component U7
on the NanoBoard-NB1.
Wiring the Flash Memory into the FPGA Design
When wiring up the schematic in the FPGA design project, the Flash memory device is represented by a Port-Plugin component (SERIALFMEMORY
) and is available from the FPGA NB1 Port-Plugin integrated library (FPGA NB1 Port-Plugin.IntLib
), located in the \Library\Fpga
folder of the installation.
Figure 1 shows an example of how the Flash memory is wired into a design.
The Flash memory is an SPI-compatible device. The host processor/MCU accesses the memory through the SPI Controller, as illustrated in Figure 2. The SPI Controller itself resides within the NanoTalk Controller on the NanoBoard-NB1.
The SPI Controller determines who accesses the SPI Bus (NanoTalk Controller, FPGA daughter board or Host Computer (via the parallel port)) and which of the SPI slave devices (Embedded Flash memory, FPGA Boot Flash memory, NanoBoard System Clock) is selected for communications.
Running the Flash Memory Controller
The procedure for loading an embedded software file into the Flash memory 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 memory you wish to load. The Instrument Rack for the NanoBoard Controllers will appear as shown in Figure 3.
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 Read Electronic Signature button. This tests the communications link between the NanoBoard Controller and the Flash memory 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.
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 Flash RAM Controller for Embedded Software dialog. The erasing process will take approximately 5 seconds, after which a confirmation dialog will appear.
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.
Programming the Flash Memory
Once the Flash memory 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.
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.
To download this file to the Flash memory, simply click the Save File To Flash button.
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 (Figure 9).
Verification of Download to Flash Memory
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, from the Flash RAM Controller for Embedded Software dialog, click on the Verify against File button.
The contents of the Flash memory are read back and compared against the original embedded software file. The progress for this process is again shown in Altium Designer's Status bar. An information dialog will appear with details of the verification results.
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 memory 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.