Limited Interest

Game Boy Advance Wireless Adapter

Technical   As I Understand It

Some people may be aware that I have played around with the GBA wireless adapter, indeed I’ve made one that works over the internet but unstably. The reason that I hadn’t made this post earlier is because I wanted to make it stable before releasing the code and writing it up. Alas, I haven’t had much motivation to continue, which is a shame given I got so close.

This is the first post of a planned two. In this first post I will be talking about how the wireless adapter works, and in the second I will talk about specifically how I did all this. The short version of that second post is using the PIO on Pi Picos.

The Wireless Adapter

The Game Boy Advance Wireless Adapter

The Game Boy Advance Wireless Adapter

The wireless adapter is a piece of hardware that connects to the link cable port of a GBA that then communicates wirelessly with other adapters. It also contains a multibootable1 rom for playing games only one player has a copy of (although I am not aware of many games that use it, some NES classic games use this). However, the most notable games to use it is probably the Pokémon games Fire Red, Leaf Green and Emerald (Sapphire and Ruby do not have wireless adapter support)2.

The
multiboot rom from the wireless adapter showing a game title of AGB.RS and a
username of CORWIN

You can make this screen display any game

Communicating with the adapter

When I started, I used the following resources to start being able to talk with the wireless adapter:

Pinout

The wireless adapter connects using the link cable port to the GBA. It uses

which is all 6 of the pins. If you are going to mess with interfacing with the link cable yourself, make sure you know which pin is which. If you just want to use the wireless adapter as part of the GBA this isn’t relevant.

Serial Peripheral Interface

Broadly speaking the GBA communicates with the wireless adapter using the Serial Peripheral Interface (SPI), however it can be somewhat weird. In the case of the GBA this is a three or four wire protocol depending on how you count. The clock, two data wires, and what is normally chip select but operates more as a reset.

The reason you would have a chip select normally is because then you can reuse the other three wires across all the chips on your board and switch using the chip select. On the GBA we only have one other device on this bus, so a chip select isn’t really an apt term for it.

A logic
analyser displaying an SPI trace from the GBA and wireless adapter
communications

A logic analyser can be used to probe the link cable protocol between the GBA and a Wireless Adapter

I will break up the ways in which you communicate into three parts:

One thing to make note of is that when I have screenshots showing the logic analyser traces, these all come from Pokémon Emerald as it is what I had at the time I did a lot of this.

Initialisation

The initialisation sequence captured using a logic analyser

The initialisation sequence captured using a logic analyser

Before starting sending and receiving commands, a handshake with the adapter needs to be done. During this, the clocks runs at 256 kHz. Real games start this process by resetting the adapter.

To reset you take the reset line high. Most people refer to this as SD. You can see this in the figure.

After this the GBA sends a single command, although we will ignore this for now.

Next is the Nintendo Exchange.

Nintendo Exchange

The GBA and the adapter exchange the word “NINTENDO” with each other in quite a strange way.

GBA
sends `0x7FFF494E` and wireless adapter sends `0x00000000`.

GBA sends 0x7FFF494E and wireless adapter sends 0x00000000.

The GBA here sends 0x7FFF494E, of this the relevant part is the 0x494E. If we look up what the bytes 0x49, 0x4E are you will find them to be the letters NI. As exchanges happen simultaneously, at this point the adapter doesn’t know what to respond with and so responds with all zeros.

GBA sends `0xFFFF494E` and wireless adapter sends `0x494EB6B1`.

GBA sends 0xFFFF494E and wireless adapter sends 0x494EB6B1.

Next the GBA sends 0xFFFF494E and now the wireless adapter does respond and responds with 0x494EB6B1. I can assure you there is a pattern here:

The “own” data are the bytes of the string “NINTENDO”, and you advance to the next pair when the most significant bytes equal the inverse of the least significant bytes.

Following these rules the transfer looks like

GBA Adapter
0x7FFF494E 0x00000000
0xFFFF494E 0x494EB6B1
0xB6B1494E 0x494EB6B1
0xB6B1544E 0x544EB6B1
0xABB1544E 0x544EABB1
0xABB14E45 0x4E45ABB1
0xB1BA4E45 0x4E45B1BA
0xB1BA4F44 0x4F44B1BA
0xB0BB4F44 0x4F44B0BB
0xB0BB8001 0x8001B0BB

Although note that due to the rules, the first few transfers may contain some junk data and be different to this in practice. And after this, you can start sending commands.

Commands

A command being sent by the GBA and acknowledged by the
adapter

A command being sent by the GBA and acknowledged by the adapter

Commands are how you tell the adapter to do things. When in command mode the clock operates at 2 mHz. Some examples of commands include connect to adapter, send message, and receive message. All commands follow the same form:

Whenever either side expects something to be sent from the other (as SPI is always dual direction, although one side is often not used), the value 0x80000000 is used.

The adapter starts listening for an instruction after a timeout of around 800 micro seconds 3.

List of commands

Finish Initialisation - 0x10 and 0x3d

Image without alt text or caption

Broadcast - 0x16

Image without alt text or caption
The meaning of the bytes in a broadcast transmission.

The meaning of the bytes in a broadcast transmission.

Start Host - 0x19

BroadcastRead - 0x1c -> 0x1d -> 0x1e

Image without alt text or caption

Setup - 0x17

Image without alt text or caption

ConnectedAdapters - 0x1a

Connect - 0x1f

Image without alt text or caption

IsFinishedConnect - 0x20

Image without alt text or caption

FinishConnection - 0x21

Image without alt text or caption

SendData - 0x24

SendDataWait - 0x25

Image without alt text or caption

ReceiveData - 0x26

Image without alt text or caption

Wait - 0x27

Image without alt text or caption

List of commands that I don’t quite know the meaning of 4

0x11

Image without alt text or caption

0x13

0x30

Image without alt text or caption

Waiting

Image without alt text or caption

I know more!

If you know any extra details about the wireless adapter, get in touch!. For specific details I’ve left footnotes around if you happen to know that piece of information4.

Update: