SD card emulator on an FPGA SoC
An FPGA that emulates an SD card and keeps the card image in DRAM. Boot images and test data change in software, with no physical card swaps.
- PLSDIO slave in hardware
- DRAMbacked card image
- AXImaster into the PS
Architecture · block diagram
- Main data path
- Logic
- Processor
- Memory
- Interconnect
- Off-chip
The story
Many embedded boards boot from an SD card. To test them, you usually write an image, insert the card, boot and repeat. The process is slow, wears out cards and connectors, and is hard to automate. An FPGA that emulates an SD card removes the physical card from the test loop.
Challenges
On the SD bus, the host had to see a standard SD card. Software also had to be able to change the contents of the card, between boots or during them.
What I built
The device under test talks to the FPGA through its normal SD host controller. In the PL, an SDIO slave implements the card side of the bus. An AXI master turns card reads and writes into memory transactions to the PS. There, the Arm CPU and the DDR controller keep the emulated card image in DRAM. Software on the PS can load, swap or inspect that image at any time.
The hardest problem
The SD protocol sets strict response timing, and the host times out on a slow card. The SDIO slave is in the PL, with a direct AXI path into DRAM. It answers with hardware latency, and the PS only manages the images.
Result
The host sees a standard SD card, backed by DRAM. Software swaps boot images and test data with no physical card changes. The design is also a base for fault injection and for a log of each host read and write.
Where you'd find something like this
Automated testing of devices that boot from SD
Switching boot images in CI farms for embedded Linux boards
Fault injection and capturing a host's storage access patterns
Related services