CHAPTER 20

SD CARD CONTROLLER

A flash memory card can be used as massive storage for an embedded system. The DE1 board has a slot for an SD (secure digital) card. In this chapter, we develop hardware and software routines to retrieve data from an SD card. The hardware portion is an SPI (serial peripheral interface) controller, which sends commands and transfers data between the SD card and processor. The software portion includes the SPI driver routines to transmit and receive data over the SPI bus, the SD card driver routines to send a command and read and write a sector, and basic routines to read a file from a FAT16 file system.

20.1 OVERVIEW OF SD CARD

The FPGA's internal memory, external SRAM, and SDRAM discussed in Chapter 16 are all volatile memory, which requires power to maintain stored data. Nonvolatile memory, on the other hand, can keep data after power-off. EEPROM (electrically erasable programmable read-only memory) device is a type of non-volatile memory. Its content can be electrically erased and written again. Flash memory is a special type of EEPROM in which a large block of data is erased and written at a time and costs much less than a byte-programmable device. To write a single word, a flash memory device needs to read the entire block containing the word, modify the specific word, erase the entire block, and then write the entire block back. Because of the high overhead, it is more feasible to transfer a large amount of data at a time. This behaves more like ...

Get Embedded SoPC Design with Nios II Processor and Verilog Examples now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.