gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Link communications

#1908 - Herg - Sat Jan 25, 2003 2:28 pm

I have been trying to write some link communications code with varying success.

My goal is to send a request from one GBA to another and have the second GBA respond with a block of data. I have been able to generate an interrupt on the second GBA, but when I try to respond, the first GBA doesn't receive the data properly.

I have been using the CowBite spec to work from, but it would be very helpful if I could see some working code.

#1989 - FluBBa - Mon Jan 27, 2003 10:43 am

If you use multiplay mode then I think only the master can initiate a send.
What I'm trying now on pocketnes is doing a syncbyte send first (which makes an IRQ on all machines) and then all units put their data in the send slot, then the master initiates a send again.
Everybody gets the data, everybody gets happy =)

But if you use a normal UART mode or so I don't know anything about that yet.

/FluBBa

#1992 - ampz - Mon Jan 27, 2003 12:42 pm

I use the UART mode in my "keyboard advance" software. (bidirectional communication)
No interrupts, just simple polling, but it might be helpful anyway...

http://www.hh.se/stud/d99tibr/index5.html

#2034 - Herg - Tue Jan 28, 2003 1:58 am

Yes, I am using multiplayer mode, and here's what I'm trying to do:

1 sends 0x1234 to 2
Generates interrupt on 2, check to see if value sent was 0x1234
If so, put 0x5678 in register
1 is periodically repeating the 0x1234 transfer until it sees the 0x5678, but it never gets there

#2040 - Costis - Tue Jan 28, 2003 4:11 am

Hi,

Yes, only a master GBA can initiate transfers in that communications mode. I had some troubles writing stable multiplayer code some time ago, but I fixed it by using a timer (only from the master) and an SIO interrupt to send and receive packets to\from slave GBA's. You have to make sure that there is a small delay between each transfer, though, so that the slave GBA's have enough time to catch up if they are behind. What you're saying should work, if you're leaving the slave GBA some time to place that value in the register and then polling it again.

Costis

#2740 - chrisrothery - Tue Feb 11, 2003 6:35 pm

Hi, I'm a newbie on this forum but I've been following gba dev for some time now on and off. Getting more serious about it again now, and thinking about link code like you guys.

I was planning a simple pong game across 2 machines just to prove I could do it. I've read the uart code that was linked to above and the source for sgade which seems very detailed so I'm happy to have a go.

The reason for this post is that like already mentioned by one of you guys, I've not been able to track down a simple source + binary demo of the kind I'm going to try & make. Posts come and go on the gbadev yahoo list for people to publish their multiplayer code but to no avail. Does anyone know of any that's been posted anywhere? I'll stick mine somewhere when I get it working but I'd rather not be re-inventing the wheel.

That is all. Thanks

#2764 - ampz - Wed Feb 12, 2003 11:41 am

My keyboard uart code above is as simple as it gets. Basic 9600bps UART communication. No interrupts, just polling. It can be used for very basic bidirectional communication between two GBA's.