High Capacity Secure Digital Card Common Issues
Other versions of this page are also available for the following:
8/28/2008
The following sections attempt to address some of the common issues that may arise when working with high capacity SD cards.
Windows Embedded CE supports high capacity SD cards as of Windows Embedded CE 6.0 R2.
Buffer Overflow
With the introduction of support for high capacity SD cards greater than 4G and up to 32G, it is important to check for buffer overflow because a 32G card will be beyond the 32 bit address space. For example, when trying to read/write to a high capacity SD memory card it is important to check the block size to ensure that there is no buffer overflow. For an example, see the following code sample.
if(ULONG_MAX / SD_BLOCK_SIZE < NumBlocks){
status = ERROR_INVALID_PARAMETER;
}
Device Size
With the introduction of high capacity SD card support, there are two ways device size is returned from the CSD register. When dealing with a high capacity SD card the device size is returned in Blocks, not bytes. If this situation is not handled, for cards that are small in size, the total sectors on the card will become very large because overflow will occur in the buffer that stores the total sectors.
See Also
Concepts
Secure Digital Card Driver Development Concepts
Secure Digital Card Bus Driver
Secure Digital Card Host Controller Driver