GPIO Registers

GPIO Registers

Registers #

GPIO #

Old3DSNameAddressWidth
YesGPIO1_DATA0x101470001
YesGPIO2_DATA0x101470101
YesGPIO2_DIR0x101470111
YesGPIO2_INTCFG0x101470121
YesGPIO2_INTEN0x101470131
YesGPIO2_DATA20x101470142
YesGPIO3_DATA0x101470202
YesGPIO3_DIR0x101470222
YesGPIO3_INTCFG0x101470242
YesGPIO3_INTEN0x101470262
YesGPIO3_DATA20x101470282

Legacy RTC #

NameAddressWidthDescription
RTC_CNT0x101471002Control register
RTC_REG_STAT10x101471101Rtc status register 1 (command 0). Bitswapped
RTC_REG_STAT20x101471111Rtc status register 2 (command 1). Bitswapped
RTC_REG_CLKADJ0x101471121Rtc clock adjustment register (command 6). Bitswapped
RTC_REG_FREE0x101471131The free general purpose rtc register (command 7). Bitswapped
RTC_REG_TIME10x101471204Byte-wise bit-swapped (bit7 is bit0, etc.) BCD RTC (byte0 = seconds, byte1 = minutes, byte2 = hours, byte3 = day of week)
RTC_REG_TIME20x101471244 (3?)Day, month and year all byte-wise bit-swapped
RTC_REG_ALRMTIM10x101471304 (3?)Rtc alarm time register 1 (command 4). Byte-wise bit-swapped
RTC_REG_ALRMTIM20x101471344 (3?)Rtc alarm time register 2 (command 5). Byte-wise bit-swapped
RTC_REG_COUNT0x101471404 (3?)Rtc dsi counter register (ex command 0). Byte-wise bit-swapped
RTC_REG_FOUT10x101471501Rtc dsi fout register 1 (ex command 1). Bitswapped
RTC_REG_FOUT20x101471511Rtc dsi fout register 2 (ex command 2). Bitswapped
RTC_REG_ALRMDAT10x101471604 (3?)Rtc dsi alarm date register 1 (ex command 4). Byte-wise bit-swapped
RTC_REG_ALRMDAT20x101471644 (3?)Rtc dsi alarm date register 2 (ex command 5). Byte-wise bit-swapped

Descriptions #

GPIO #

GPIO pins #

Only GPIO2 and GPIO3 pins have their interrupts configurable. Active low pins should be configured as “falling edge”, and output ports shouldn’t have interrupts enabled at all.

GPIO Services bitmasks use this table, in that order:

BitIRQ IDDescription
0?Debug button (?) (active-low)
10x63 (falling edge)Touch Screen (active low, 0 = screen pressed)
20x60 (falling edge) 0x62 (rising edge)Shell closed
00x64Headphones inserted
10x66TWL depop circuit (?) (active-low)
DATA2.0-WiFi mode/freq. select (0 = CTR, 1 = MP (DS WiFi))
00x68C-stick interrupt
10x69IrDA interrupt (active-low)
20x6AGyro interrupt
30x6BC-stick “stop” (output)
40x6CIrDA TX-RC (output)
50x6DIrDA RXD (active-low)
60x6ENFC output1 (?)
70x6FNFC output2 (?)
80x70Headphones button/half-inserted (active-low)
90x71MCU interrupt
100x72NFC interrupt (?)
110x73QTM output (?)
DATA2.0-WiFi enable

GPIOn_DATA #

Pin values, one bit per pin.

GPIOn_DIR #

Pin directions for GPIO2 and GPIO3, one bit per pin.

ValueDescription
0Input
1Output

GPIOn_INTCFG #

Interrupt configuration for GPIO2 and GPIO3 pins (not the extra ones), one bit per pin.

ValueDescription
0Falling edge
1Rising edge

GPIOn_INTEN #

Interrupt enable bits for GPIO2 and GPIO3 pins (not the extra ones), one bit per pin.

ValueDescription
0Interrupt disabled
1Interrupt enabled

GPIOn_DATA2 #

Extra pins for GPIO2 and GPIO3 (one bit each). These two pins, in total, are not bound to any IRQ and are not configurable.

Default values #

After bootrom initialization, these are the values of the registers:

AddressValue
0x101470000x0003
0x101470100x00000002
0x101470140x0000
0x101470200x00000DFB
0x101470240x00000000
0x101470280x0000

Legacy RTC #

RTC_CNT (0x10147100) #

BitDescription
0Latch STAT1
1Latch STAT2
2Latch CLKADJ
3Latch FREE
4Latch TIME
5Latch ALRMTIM1
6Latch ALRMTIM2
7Latch COUNT
8Latch FOUT1
9Latch FOUT2
10Latch ALRMDAT1
11Latch ALRMDAT2
12ARM7 Busy? This may be chipselect
13ARM7 write command received? (writing 1 clears it seems)
14ARM7 read command recieved? (writing 1 clears it seems)
15DS SIO SI pin (rtc irq pin)