Backup Access: Overview

Description

The backup device is connected to the SPI bus in a Nintendo DS card. By conducting serial communications of commands through the IO register, operations such as state checks and data transfer are performed. The type and limitations of the commands prepared depend on the device type and size, but there are features as listed below that are generally shared.


Device Types

The following are the main backup device types and their features supported by the current CARD library.

Device TypesFeatures
EEPROMStandard feature, a relatively small amount of memory.
FLASHMemory with large capacity but comparatively slow writing speed.
For particularly large-capacity flash memory devices, the process of rewriting data can be somewhat complicated.  


There is no way to automatically determine which type of backup device is loaded in the DS Card, so an application needs to be aware of the device type that it will use and explicitly specify it with the CARD_IdentifyBackup function before any function call to backup access functions. You must make sure that ROM header information is determined in advance, as indicated in the guidelines, to prevent problems such as data being destroyed by carelessly accessing a DS card that has not been defined in detail. This is especially important for applications that will be executed by something other than the DS card, as in Single-Card Play. Under those conditions, restrictions in the CARD library are applied automatically, and the card cannot be accessed as long as the CARD_Enable function is not called. The ROM header information for the inserted DS Card can be referenced with the CARD_GetRomHeader function.

As mentioned above, different types of flash devices can use different types of commands and have different restrictions. In particular, the Write command that performs a simple rewrite operation cannot be used with flash memory devices above a certain capacity. To perform a rewrite operation on such devices, you must use a combination of the EraseSector operation to erase data at the sector level, and the Program operation to write data to sectors after they have been erased.
The table below lists currently supported devices and their operating characteristics.

Device TypesEEPROMFLASH
Size4 KB64 KB512 KB2 MB4 MB8 MB16 MB64 MB
Page Size(Total Capacity)256 B
Sector Size(Total Capacity)65536 B
Write (a direct write operation that does not require erasing)OOX
Program (a write operation that takes place after erasures)XO
EraseSector (the sector-erase operation)XO

Flow of Access functions

This is an explanation of the flow of operations after backup access functions are called.

  1. Most device commands related to data transfer are limited to a unique size by pages or sectors, so the CARD library automatically divides content specified by the user into several appropriately sized commands.
  2. Each divided command is executed in order. Command execution and the busy determination that follows need to be managed from beginning to end directly by the CPU, so this operation is mounted by a relatively low-priority thread on the ARM7 component side. Command execution requests are sent one at a time from ARM9 through PXI.
  3. When the command is finished in ARM7, ARM9 is notified of the result in the same way through PXI.
  4. If there are any remaining divided commands, command execution request is sent from ARM9 again at this point. This is repeated until processing is complete, ends in failure, or has been canceled by the CARD_CancelBackupAsync function. Because things such as memory copy in the operations to wait for completion and a new execution request sometimes take a long time, they are mounted by an internal thread in the CARD library instead of with the PXI interrupt handler.
  5. When the operation is complete, a notification is sent to the source of the specified callback. The processing result can be referenced with the CARD_GetResultCode function as a CARDResult enumerated type.

See Also

CARD Function List

Revision History

2008/11/27 Deleted CARD_BACKUP_TYPE_FRAM_256KBITS from the lineup of usable types.
2007/08/22 Added explanation about large-capacity flash devices and a table showing their characteristics.
2006/01/01 Initial version.


CONFIDENTIAL