NFC Services

NFC Services

The New3DS NFC module was added with 8.1.0-0_New3DS. The Old3DS NFC module was added with 9.3.0-X.

On New3DS NFC module uses the NFC hardware via the i2c::NFC and gpio:NFC services. On Old3DS NFC module communicates with a NFC peripheral via IR with the IRUSER service.

Only 1 session can be open for all of these services combined. Commands for each service are handled by the main-thread.

NFC services #

NFC user service “nfc:u” #

This is the NFC service used by regular applications, for the NFP API.

This was first seen in the Super Smash Bros eShop demo (only in the exheader, the demo doesn’t actually use it), but at that time no system-module was available for NFC on CDN. The first regular application to use this service was Super Smash Bros, with the v1.0.5 game-update, which used the new 9.3.0-X command set.

NFC management service “nfc:m” #

Command HeaderAvailable since system-versionNameInputOutputNotes
0x040100C2Unknown, < 9.3.0-X???u32 unknownA, u32 unknownB, u32 unknownC, u32 (sizeof(*buffer) << 14 | 0x402), void * buffers32 resultUsed when resetting an amiibo from amiibo Settings.
0x040200009.3.0-XGetAdminInfo
0x040300009.3.0-XGetEmptyRegisterInfo
0x04040A409.3.0-XSetRegisterInfo
0x040500009.3.0-XDeleteRegisterInfo
0x040600009.3.0-XDeleteApplicationArea
0x040700009.3.0-XExistsApplicationArea
0x040800009.3.0-X???voids32 result, u32 unknownA
0x040C00009.3.0-X?Nones32 resultAmong other things, this will eventually call the savedata writing code referenced in the below savedata section.
0x040D00009.3.0-X???voids32 result
0x040E00009.3.0-X???voids32 result, u32 unknownA, u32 unknownBAgain, amiibo applet ignores value unknownA.
0x040F00009.3.0-X???voids32 result, u32 unknownA, u32 unknownB

This is used by the amiibo Settings applet. This service has the above commands, in addition to the command-set listed below.

NFC development service “nfc:dev” #

Command headerAvailable since system-versionDescription
0x00110100ReadRawPages
0x001200C0WriteRawPage

Some of these commands seems to be intended for use only on dev-units.

Unlike the New3DS NFC-module, at least some of these commands are stubbed in the Old3DS NFC-module(only returns an error).

NFC service “nfc:p” #

Command headerAvailable since system-versionDescription
0x00010000Initialize
0x00020000Shutdown
0x00030080(unk0, unk1) ?
0x00040000?
0x000500C2SendTagCommand
0x00060000GetTagInfo
0x00070000GetTagState maybe? Writes an output value to cmdreply[2].
0x00080000Writes a handle to cmdreply[3].
0x00090000Writes a handle to cmdreply[3].
0x000A0000Unknown. Writes an output value to cmdreply[2].
0x000B0000Unknown. Writes 0x60-bytes of output starting at cmdreply[2]. u16 +0 is the size of the data at +4, +2 is not initialized, u8 +3 is loaded from state, u32 +0x2C is loaded from state, and the data at +4 with the previously mentioned size is copied from state.
0x000C0040(u32 outputsize) Writes output to static_buf_id=0, outputsize 1 is used when it’s >=1.
0x000D0040(u32 outputsize) Writes output to static_buf_id=0, outputsize 1 is used when it’s >=1.
0x000E0080(u8 unk, u32 outputsize) Writes output to static_buf_id=0, outputsize 2 is used when it’s >=2.
0x000F0040(u32 outputsize) Writes output to static_buf_id=0, outputsize 2 is used when it’s >=2.
0x00100000Unknown.
0x00110000Unknown.
0x00120000Unknown. Writes an output u32 to cmdreply[2].
0x00130000Unknown. Writes an output u32 to cmdreply[2].

This service is used by the mint library-applet, starting with 9.3.0-21. This service was added to the mint service-access-control list with 9.0.0-20. The mint process is the only known eShop-related process using this service( eShop-application and NIM-module don’t use it). Used for NFC card payments in JPN eShop(the v16384 mint title is identical for USA/JPN besides programIDs in the NCCH header/exheader).

JPN eShop game “Megami Meguri” uses these same JPN NFC cards. The only accessible NFC service is nfcu.

NFC service “nfc:r” #

This service has no known use.

NFC service “nfc:s” #

Command headerAvailable since system-versionDescription
0x00130102SendTagCommand
0x00230000This writes the following command request data to I2C, without reading any response: 10 20 00 01 01.
0x00240000This writes the following command request data to I2C, without reading any response: 10 40 00 03 00 0F 01.

This service has no known use.

Unlike the New3DS NFC-module, at least some of these commands are stubbed in the Old3DS NFC-module(only returns an error).

“nfc:u” and “nfc:m” command set #

There are at least two different revisions of the NFC module. First version was introduced on New3DS only with firmware 8.1.0-0_New3DS. Second version made its appearance with 9.3.0-X, on both Old3DS and New3DS.

These two versions are not interchangeable and not compatible, since the newer version uses a different command set and has no implemented commands from the older version. This does not introduce compatibility problems since no retail software used the NFC module, before the system titles added with 9.3.0-21 which use NFC.

9.3.0-X #

Command HeaderAvailable since system-versionNameInputOutputNotes
0x00010040Initializeu8 inputvals32 result
0x00020040Shutdownu8 inputvals32 result
0x00030000StartCommunicationvoids32 result
0x00040000StopCommunicationvoids32 result
0x00050040StartTagScanningu16 invals32 result
0x00060000StopTagScanningvoids32 result
0x00070000LoadAmiiboData
0x00080000ResetTagScanState
0x00090002UpdateStoredAmiiboData
0x000A0000???voids32 result
0x000B0000GetTagInRangeEvent(?)voids32 result, u32 copy handle descriptor, Handle eventamiibo applet ignores value ‘descriptor’. It doesn’t even read it from the command buffer.
0x000C0000GetTagOutOfRangeEvent(?)voids32 result, u32 copy handle descriptor, Handle eventamiibo applet also ignores value ‘descriptor’ for this command.
0x000D0000GetTagStatevoids32 result, u8 outval
0x000F0000CommunicationGetStatus
0x00100000GetTagInfo2
0x00110000GetTagInfo
0x00120000CommunicationGetResult
0x00130040OpenAppData
0x00140384InitializeWriteAppData
0x00150040ReadAppData
0x00160242WriteAppData
0x00170000GetRegisterInfo
0x00180000GetCommonInfo
0x00190000GetAppDataInitStruct
0x001A0000NoneNo additional output.
0x001B0000GetModelInfo
0x001C00409.6.0-Xu8 inputvalNo additional output.?
0x001D00409.6.0-Xu32 inputvalNo additional output.?
0x001E00409.6.0-Xu8 inputvalu8 outval at cmdreply[2].?
0x001F008010.0.0-XStartOtherTagScanningUsed by JPN eShop app “Megami Meguri”.
0x0020010210.0.0-XSendTagCommand
0x0021000010.0.0-X?Used by JPN eShop app “Megami Meguri”. This can only be used when initialized with type3, and when the TagState is 3.
0x0022000010.0.0-X?This can only be used when initialized with type3, and when the TagState is 3.

Pre-9.3.0-X #

Pre-9.3.0-X command headerCommand header starting with 9.3.0-XAvailable since system-versionDescription
0x00010000?8.1.0-0_New3DSInitialize
0x00020000?8.1.0-0_New3DSShutdown
0x00030000?8.1.0-0_New3DSGetNFCState. This writes an output u8 to cmdreply[2]: 0 = not initialized, 1 = just initialized, 5 = data transfer ready, …
0x000400000x000B00008.1.0-0_New3DSThis writes an output handle to cmdreply[3].
0x000500000x000C00008.1.0-0_New3DSThis writes an output handle to cmdreply[3].
0x00060040?8.1.0-0_New3DS(u8 input)
0x00070000?8.1.0-0_New3DSThe user process must setup the output-buffer hdr+ptr data @ TLS+0x180 when using this. cmdreply[2] = actual output data size?
0x00080100?8.1.0-0_New3DS(<0x10-bytes starting at cmdreq[1]>)
0x00090000?8.1.0-0_New3DS
0x000A0000?8.1.0-0_New3DSThe user process must setup the output-buffer hdr+ptr data @ TLS+0x180 when using this.
0x000B0042?8.1.0-0_New3DS(u32 size, ((Size<<14) | 2), inbufptr)
0x000C0044?8.1.0-0_New3DS(u32 size, 0x20, , ((Size<<14) | 0x402), inbufptr)
0x000D0040?8.1.0-0_New3DS(u16 in)
0x000E0000?8.1.0-0_New3DS
0x000F00C2?8.1.0-0_New3DS(u32 unk0, u32 unk1, u32 unk2, ((Size<<14) | 0x802), inbufptr)
0x00100040?8.1.0-0_New3DS(u32 in)
0x00110040?8.1.0-0_New3DS(u32 in)
0x00120040?8.1.0-0_New3DS(u32 in)
0x00130000?8.1.0-0_New3DSWrites an output u32 to cmdreply[2].
0x00140000?8.1.0-0_New3DSThis writes an output 0x30-byte struct starting at cmdreply[2].
0x001500000x001100008.1.0-0_New3DSThis writes an output 0x2C-byte struct starting at cmdreply[2].
0x00160000?8.1.0-0_New3DS
0x00170000?8.1.0-0_New3DS

NFC services error codes #

Error-codeDescription
0xc8a17600The current NFC tag state, or other NFC state, is invalid with the NFC command which was used.

Data Types #

AdminInfo #

OffsetSizeDescription
0x000x08Program ID (From the Wii U, 3DS or Switch title who created the application area)
0x080x04App ID
0x0C0x02CRC32 Change Counter
0x0E0x01Flags (bit0 = amiibo initialized, bit1 = has application area, bit2/bit3 unknown)
0x0F0x01Unknown, hardcoded to 0x2
0x100x10xFF if there is no application area, related to the console of the application area game otherwise (0/2 = 3DS, 1 = Wii U, 3 = Switch)
0x110x07Padding
0x180x28Reserved

RegisterInfo #

OffsetSizeDescription
0x000x60Exported Mii Data (minus the AES-CCM used in the linked format)
0x600x16Amiibo Name (NUL-Terminated)
0x760x01Flags (bit0 = amiibo initialized, bit1 = has application area)
0x770x01Font Region
0x780x04Creation Date
0x7C0x2CReserved

This data originates from the Amiibo settings data stored under the encrypted NFC data.

CommonInfo #

OffsetSizeDescription
0x000x04Last Write Date
0x040x02Write Counter
0x060x02Character ID
0x080x01Character Variant
0x090x01Amiibo Series
0x0A0x02Model Number
0x0C0x01Amiibo Type
0x0D0x01Version
0x0E0x02Application Area Size (hardcoded to 0xD8)
0x100x30Reserved

This data originates from the Amiibo NFC data.

ModelInfo #

OffsetSizeDescription
0x000x02Character ID
0x020x01Character Variant
0x030x01Amiibo Series
0x040x02Model Number
0x060x01Amiibo Type
0x070x01Version
0x080x2EReserved

This data originates from the Amiibo NFC data.

Date #

OffsetSizeDescription
0x000x02Year
0x020x01Month
0x030x01Day

NFC module savedata #

  • “/nfp_backup.dat” This contains raw data from the Amiibo NFC data pages. The filesize is 0x001fbd20-bytes. Certain service cmds will trigger writing to this savedata. This entire file is read during amiibo Settings startup, it’s unknown what command(s) actually triggers that. It seems the Amiibo data here is updated each time the Amiibo NFC data is updated, and read each time the Amiibo NFC data is read. Data is written into this savedata when the Amiibo was never scanned on this system before. The data here is probably also updated when the scanned Amiibo NFC data doesn’t match the data stored here.

During NFC writing, the NFC data being written can become corrupted if the Amiibo figure is moved outside of range during writing. When this happens, this nfp_backup data can be used to restore a previous version of that data prior to the last failed write.

nfp_backup.dat structure #

OffsetSizeDescription
0x00x20Header
0x200x800Amiibo data table header
0x7D200x21CThe NFC data for the first stored Amiibo is located here. This is the entire raw data from all 0x87 NFC data pages.

Header structure #

OffsetSizeDescription
0x00x8Unknown, normally the following data? “00 00 02 00 02 00 00 00” (as little-endian u32s: 0x20000, 0x2)
0x80x14Unknown, normally all-zero?
0x1C0x4Unknown. CRC32 / checksum maybe?

Amiibo data table header #

This is an array with 0x40(?) entries, where the size of each entry is 0x20-bytes. Entry structure:

OffsetSizeDescription
0x00x8First 8-bytes from Amiibo NFC serial-number.
0x80x3Unknown, normally zero?
0xB0x2u16 little-endian date value for when this Amiibo was initially written into this savedata, with the same format from here.
0xD0xFUnknown, normally zero?
0x1C0x4Unknown. CRC32 / checksum maybe?

NFC module versions #

System versionNew3DS title-versionOld3DS title-versionChanges
9.6.0-Xv4102v4106New3DS and Old3DS: the only changes regarding new commands is that new commands were added for the nfcu/nfcm command-set and new commands for an unknown cmd-handler were added. It’s unknown if there’s other changes.

Errors #

Error codeDescription
0xC8A17600This is returned when the current state is invalid for this command.
0xC8A17620This is returned by NFC:OpenAppData when the appdata is uninitialized since NFC:InitializeWriteAppData wasn’t used previously.
0xC8A17628This is returned by NFC:GetAmiiboSettings when the amiibo wasn’t setup by the amiibo Settings applet.
0xC8A17638This is returned by NFC:OpenAppData when the input AppID doesn’t match the actual Amiibo AppID.
0xC8C1760CReturned for HMAC-hash mismatch(data corruption), with HMAC-calculation input_buffer_size=0x34.
0xC8A17618HMAC-hash mismatch with input_buffer_size=0x1DF(see here).