TargetSD-SPI™ Manager for SD Card SPI Mode

Overview

TargetSD-SPI is an SD Card manager for the SPI interface mode and protocol. It processes card insertion and removal, adding the card’s volume to or removing it from a file system. It acts as the file system driver, relying on a SPI controller driver to access the media.

Features

  • Manages SD Cards for TargetFAT and TargetXFS. It automatically detects card insertion, queries its size, type, and support of special features, and adds its volume to a file system, acting as the volume’s media driver; performing error checks and retries as needed. Automatically detects and processes card removal, removing the card’s file system volume.

  • Supports Standard Capacity (SDSC), High Capacity (SDHC), and Extended Capacity (SDXC) SD cards and MMC cards with memory capacities up to 2TB.

  • Checks the first sector for a Master Boot Record. If found, its first partition entry provides the starting sector number and sector count. Otherwise, the volume starts at sector 0 and uses all provided sectors.

  • Conforms to the latest SD Card Association standards.

  • Fast table-driven CRC calculation for data integrity and high performance.

  • Supports 3.3v signaling and clocks up to 50MHz for SD cards, 52MHz for MMC cards.

  • Announcements, through a callback function, are made when a card is inserted and its volume can be mounted and used by the application, and when a card is removed.

  • Documented driver interface. Supports sharing SPI channel with other devices. Includes sample driver.

  • Timeouts and retries are automatically performed as necessary in response to CRC and other errors.

  • Sectors are pre-erased before being written, for highest performance.

  • SD card garbage collection can be invoked during application idle times by calling vclean() from a low priority task. Maximizes response to high-priority use.

  • sdConfig() shows SD card’s product name, serial number, class, clock frequency, cluster size, special features, number of sectors, and volume size.

  • sdDiag() shows the number of insertions, maximum number of command retries, and non-zero error counts from host controller and device responses.

  • Verbose option displays contents of the Card Identification, Card Specific Data, and Configuration registers after card insertion; including manufacturer ID, version, serial number, date of manufacture, supported access time, transfer speed, special features, etc.

  • The best way to determine TargetSD-SPI’s memory footprint (and performance) is to measure it on your target board using your development environment. Blunk supports source code evaluations for that purpose. For estimation, a measurement of TargetXFS and TargetSD-SPI memory footprint for the ARM Cortex-A9 using a 4GB SD card is shown below. Full details in manual.

    Footprint Code RAM
    TargetXFS 62KB 107KB
    TargetSD-SPI 6KB 1KB
    Total 68KB 108KB
  • For efficient DMA use, all buffers passed to the driver are aligned on CPU cache line boundaries.

  • Developed using TargetOS™-Lite, Blunk’s free RTOS. Easily ported to other RTOSes or used in polled mode, without a kernel.

  • Source code is 100% Standard C and has been tested using PC-lint and multiple Standard C compilers, including GCC.

  • Royalty-free license. Includes complete source code, sample applications, sample drivers, user’s manual, and one year of technical support. Electronic delivery via customer-specific web portal.