|
SIO Normal Mode |
This mode is used to communicate between two units.
Transfer rates of 256KBit/s or 2MBit/s can be selected, however, the fast
2MBit/s is intended ONLY for special hardware expansions that are DIRECTLY
connected to the GBA link port (ie. without a cable being located between the
GBA and expansion hardware). In normal cases, always use 256KBit/s transfer
rate which provides stable results.
Transfer lengths of 8bit or 32bit may be used, the 8bit mode is the same as for
older DMG/CGB gameboys, however, the voltages for "GBA cartridges in
GBAs" are different as for "GMG/CGB cartridges in DMG/CGB/GBAs",
ie. it is not possible to communicate between DMG/CGB games and GBA games.
134h - RCNT (R) - Mode
Selction, in Normal/Multiplayer/UART
modes (R/W)
|
Bit Expl. 0-14 Not used 15 Must be zero (0) for
Normal/Multiplayer/UART modes |
128h - SIOCNT (SCCNT_L)
- SIO Control, usage in NORMAL Mode
(R/W)
|
Bit Expl. 0 Shift Clock (SC) (0=External, 1=Internal) 1 Internal Shift Clock (0=256KHz, 1=2MHz) 2 SI State (opponents SO) (0=Low,
1=High/None) --- (Read Only) 3 SO during inactivity (0=Low, 1=High) 4-6 Not used 7 Start Bit (0=Inactive/Ready,
1=Start/Active) 8-11 Not used 12 Transfer Length (0=8bit, 1=32bit) 13 Must be "0" for Normal Mode 14 IRQ Enable (0=Disable, 1=Want IRQ upon
completion) 15 Not used |
The Start bit is
automatically reset when the transfer completes, ie. when all 8 or 32 bits are
transferred, at that time an IRQ may be generated.
12Ah - SIODATA8 (SCCNT_H) - SIO Normal Communication 8bit Data (R/W)
For 8bit normal mode. Contains 8bit data (only lower 8bit are used). Outgoing
data should be written to this register before starting the transfer. During
transfer, transmitted bits are shifted-out (MSB first), and received bits are
shifted-in simultaneously. Upon transfer completion, the register contains the
received 8bit value.
120h - SIODATA32_L (SCD0) - SIO Normal Communication lower 16bit data (R/W)
122h - SIODATA32_H (SCD1) - SIO Normal Communication upper 16bit data (R/W)
Same as above SIODATA8, for 32bit normal transfer mode respectively.
Initialization
First, initialze RCNT register. Second, set mode/clock bits in SIOCNT with
startbit cleared. For master: select internal clock, and (in most cases)
specify 256KHz as transfer rate. For slave: select external clock, the local
transfer rate selection is then ignored, as the transfer rate is supplied by
the remote GBA (or other computer, which might supply custom transfer rates).
Third, set the startbit in SIOCNT with mode/clock bits unchanged.
Synchronization
The SI and SO Bits in control register may be optionally used to determine whether
the opponent is ready for starting a transmission (the actual transmission is
then automatically synchronized by the shift clock signal).
Bit 2 (SI) always reflects the current SI state (ie. the opponents SO state). Obviously,
Bit 3 (SO) is output to SO during transfer inactivity only.
Note that only GBA models support SI and SO synchronization bits - these bits
cannot be used when communicating with CGBs or monochrome gameboys.
Recommended Communication Procedure for SLAVE unit (external clock)
- Initialize data which is to be sent to master.
- Set Start flag.
- Set SO to LOW to indicate that master may start now.
- Wait for IRQ (or for Start bit to become zero). (Check timeout here!)
- Set SO to HIGH to indicate that we are not ready.
- Process received data.
- Repeat procedure if more data is to be transferred.
(or is so=high done automatically ??? would be fine - more stable - otherwise
master may still need delay)
Recommended Communication Procedure for MASTER unit (internal clock)
- Initialize data which is to be sent to slave.
- Wait for SI to become LOW (slave ready). (Check timeout here!)
- Set Start flag.
- Wait for IRQ (or for Start bit to become zero).
- Process received data.
- Repeat procedure if more data is to be transferred.
Cable Protocol
During inactive transfer, the shift clock (SC) is high. The transmit (SO) and
receive (SI) data lines may be manually controlled as described above.
When master sends SC=low, each master and slave must output the next outgoing
data bit to SO. When master sends SC=HIGH, each master and slave must read out
the opponents data bit from SI. This is repeated for each of the 8 or 32 bits,
and when completed SC will be kept high again.
Transfer Rates
Either 256KHz or 2MHz rates can be selected for SC, so max 32KBytes (256KBit)
or 128KBytes (2MBit) can be transferred per second. However, the software must
process each 8bit or 32bit of transmitted data separately, so the actual
transfer rate will be reduced by the time spent on handling each data unit.
Only 256KHz provides stable results in most cases (such like when linking
between two GBAs). The 2MHz rate is intended for special expansion hardware
only.
Using Normal mode for One-Way Multiplayer communication
Whem more than two GBAs are connected, data isn't exchanged between first and
second GBA as usually. Instead, data is rotated from first to last GBA (and
then back to first ???).
This behaviour may be used for fast one-way data transfer from master (or
childs ???) to all other GBAs. For example (3 GBAs linked):
|
Step Sender 1st Recepient 2nd Recipient Transfer
1: DATA #0 --> UNDEF -->
UNDEF --> Transfer
2: DATA #1 --> DATA #0 -->
UNDEF --> Transfer
3: DATA #2 --> DATA #1 -->
DATA #0 --> Transfer
4: DATA #3 --> DATA #2 -->
DATA #1 --> |
The
recepients should not output any own data, instead they should forward the
previously received data to the next reciepint during next transfer (just keep
the incoming data unmodified in the data register).
Due to the delayed forwarding, 2nd recepient should ignore the first incoming
data. After the last transfer, the sender must send one (or more) dummy data
unit(s), so that the last data is forwarded to the 2nd (or further)
recepient(s).