TargetSD-Bus™ Manager for SD Card Bus Mode
Overview
TargetSD-Bus is an SD Card manager for the SD Bus 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 host 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.
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 works with simple and advanced Host Controllers. Sample drivers are included.
Performs intelligent command retries in protocol layer, in response to CRC and other errors, versus driver level retries, for efficient error recovery.
Sectors are pre-erased before being written, for highest performance.
Supports file system TRIM requests. Unused sectors (after file deletion, truncation, or overwrite) are freed using either DISCARD, if supported (SDHC/SDXC cards), or ERASE in response to TRIM requests for improved 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, bus frequency, bit width, 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.
sdGetSmartData() supports querying the card health data provided by some industrial grade SD Cards via CMD56, a non-standard command. An NDA is typically required with the manufacturer to obtain the exact command parameters and to parse the resulting data.
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, maximum bus width, special features, etc.
The best way to determine TargetSD-Bus’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-Bus 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-Bus 17KB 1KB Total 79KB 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.