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.

DS development > DS Slot 2 Accessory "Template"

#112196 - Juglak - Thu Dec 14, 2006 8:00 am

Not sure if this is really useful to anyone, but, I've been working on a way to get something super cheap to work in the GBA slot to do... well, anything at all.

I finally came up with somewhat of a solution.

Using a pretty inexpensive 3.3v microcontroller (Atmel ATMEGA165-16AI in this case, since I had some and some PCB's I made to easilly test with them lying around), I was able to make some working data communications.

Its pretty slick, I must say.

Basicly, the GBA slot has 24 address pins (16 of them mux'd with data pins). Since the top 8 bits of the address are always acurate (they dont need to be latched) it makes this a bit easier.

So, to retrieve data from the Atmel IC, in DS code you would read from the GBA slot like so:

Code:

GBA_READ_ADDR = ((AtmelAddr & 0xFF)<<17);
u16 data = *(u16*)GBA_READ_ADDR;
swiDelay(25); // The Atmel at 8 MIPS is not fast enough to register the address change just yet, so wait a few clocks, and the data will be acurate
u16 data = *(u16*)GBA_READ_ADDR; // data is now accurate


That will make the high byte of the GBA slot address = AtmelAddr.

Note that the atmel addr can really only be 8-bit, but thats ok. That gives us 256 16-bit values we can read/write to the Atmel software. Thats potentially a full SNES controller button readout, just on one address.

Now the Atmel only runs at 8 MHz (8 MIPS), so, no where near fast enough to do true GBA ROM emulation (roughly 8x too slow, actually).

But, using this method, I've been able to interface NES/SNES control pads, as well as some other random crap with the GBA slot. Particularly useful? Not really. But would be neat to have a two player NES emu on a single DS. ;)

Anyway, heres a pic I took of the rig (note at this time I have 8 more address lines to connect).

[Images not permitted - Click here to view it]

Note: I gutted WWF Road to WrestleMania GBA to make this... poor game. :(

If anyone can think of anything useful for this setup, let me know. I'll happily post my AVR ASM for the project. Its not too complicated.

I'm thinking about fabricating a GBA cartridge with an SNES controller port on the bottom of it, to work with the SNES emu I started on.

(Note to self, you have far too many projects going on...)

Anyway... again, not sure how useful this is, but, its fun stuff all the same.

Cheers!
_________________
My goodies: 1xDS Lite - Supercard Lite, DSi, Supercard DSONEi


Last edited by Juglak on Thu Dec 14, 2006 8:09 am; edited 1 time in total

#112197 - Juglak - Thu Dec 14, 2006 8:02 am

Forgot to mention why I was explaining a lot.

The Atmel isnt fast enough to latch the lower 16 bits of the address before the GBA expects the data to be on those lines (at 8MHz, this is about 125ns delay... the address is long gone by the time the AVR recognizes it needs the data). By then, the AVR just needs to output the 16-bit data before the RD line is pulled high again. Hence the reason only the upper 8-bits of address are useful.

The AVR can easily latch data from the NES/SNES controller, since the pad doesnt care how long it takes to get the data.

I could also interface two of these AVR chips (one for the GBA interface, one for other processing) to do more "intense" interfacing... an idea was DS TV/VGA Out, but I'm reasonably certain that it would be limited to about 1-2 FPS with this rig. Still nifty idea though, since a past project of mine was B&W TV (and full color VGA) done using only the AVR microcontroller and some resistors, power supply, and really crafty AVR ASM code. Roughly $9 in parts.
So, it could be done... just probably cant get the data to the AVR fast enough to make it really usable.
_________________
My goodies: 1xDS Lite - Supercard Lite, DSi, Supercard DSONEi

#112304 - HyperHacker - Fri Dec 15, 2006 2:07 am

That's awesome. Tell me, how do you solder such tiny things?
_________________
I'm a PSP hacker now, but I still <3 DS.

#112305 - Juglak - Fri Dec 15, 2006 2:47 am

HyperHacker wrote:
That's awesome. Tell me, how do you solder such tiny things?


Fine tip soldering iron, mainly. And when that fails (usually always end up messing up and bridging at least 2 pins...), just slop solder all over all the pins, and use fine desolder braid to take up the excess.

I have a Weller WES50 soldering iron... pretty decent low cost semi-pro one.
_________________
My goodies: 1xDS Lite - Supercard Lite, DSi, Supercard DSONEi

#112338 - masscat - Fri Dec 15, 2006 11:04 am

Natrium42 assembling a DSerial is a good example of soldering surface mount devices.

#112573 - Juglak - Sun Dec 17, 2006 11:50 pm

Just to note, I think I'm going to scrap this project, in favor of a Slot 1 device I'm working on, which can do all of this and more... unless anyone has any objections or other ideas for a Slot 2 device.

See the thread http://forum.gbadev.org/viewtopic.php?p=112572.
_________________
My goodies: 1xDS Lite - Supercard Lite, DSi, Supercard DSONEi