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 > Connecting IO's to DS GBA Slot

#156929 - Key_46 - Fri May 16, 2008 10:37 am

hi, i am trying to connect a small DC motor(not like Rumble Pack) and a small switch and i don't know what pins should i use and how to access the via code... i am thinking to use /WR for out and /RD for in. will this work?

#156931 - Maxxie - Fri May 16, 2008 11:03 am

/RD and /WR are not data, they control the dataflow on the Adr/Data Lines

#156933 - tepples - Fri May 16, 2008 12:27 pm

Everything You Always Wanted To Know About SLOT-2*


*but were afraid to ask
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#156949 - Key_46 - Fri May 16, 2008 7:44 pm

tepples wrote:
Everything You Always Wanted To Know About SLOT-2*


*but were afraid to ask


I Still can't unsderstand how to change and get the ports state via Code... now i am using the pins 22 ~ 29 as my IO's, to pull them low can i just leave them open or i need to ground them?

#156954 - Maxxie - Fri May 16, 2008 8:29 pm

You can't as it is NOT a single address IO Port.

For a simple IO that runs on every address on that bus (you can access it by reading or writing any address from 0x08000000 to 0x09FFFFFF) you need to apply two latches.

The input should only be passed to the bus (on the AD lines), when /CS = 0 and /RD = 0.
The output is only valid to read when /CS = 0 and /WR = 0. You need to buffer the output if you want to work with it.

#157139 - griff - Mon May 19, 2008 7:29 pm

Do you think it's possible to make a serial communication using the GBA port, to communicate with a PC or something like that?!

#157141 - Key_46 - Mon May 19, 2008 7:36 pm

griff wrote:
Do you think it's possible to make a serial communication using the GBA port, to communicate with a PC or something like that?!


In theory it's not that hard. My idea at this moment is to make a little AM Radio Transmitter for DS.

#157144 - Maxxie - Mon May 19, 2008 7:45 pm

Uhm, actually there are plenty available already.

SPI in SD Cards/Interfaces (chapter 5)
SPI is a serial interface

#157204 - Key_46 - Tue May 20, 2008 10:18 am

Again, a new solution, this time a little bit more complicated: A Little Microcontroller connected to /WR, /RD, AD1, AD2, my actuator (via transistor ) and my switch. When i press the switch the PIC forces /WR to high and /RD to low, AD1 to high. When i release it, the PIC forces /RD to high and /WR to low and controls the motor using AD2.
*i will try do something more simple using just logical ports...

And, for the code, how can i know if the DS is in read or write mode?

#157205 - Maxxie - Tue May 20, 2008 10:55 am

The control lines are output only.

They are driven by the DS on read/writes on the named memory regions.
So that the software on the DS needs to poll data from the bus, and the cartridge needs to wait until an operation is requested. (possibly because there was)

The only pure input signal is /REQ as a special purpose signal.

http://nocash.emubase.de/gbatek.htm#auxgbagamepakbus

You can not inject any data into the system or set it into an hw write mode from peripherival. You need always software to actively read/write data.


If you drive the signals too by the logic you described, all you will achive is shortages on the control line, which - dependind on the safetly measures in the DS itself - will shut the DS down, suck on the battery, burn a fuse or damage your DS.

#157223 - Key_46 - Tue May 20, 2008 5:31 pm

Ok, i will use Clock Output pin to sync my chip with the DS and program the Chip to detect /WR and /RD state changes and send/read information.

I read in http://www.bottledlight.com/ds/index.php/Hardware/GBACartridgePort

Quote:
Sequential reads are done by strobing /RD low: data will be output on AD0..AD15 and should be valid on the rising edge of /RD.


So, i need to wait /RD to be low, set AD data, then the DS will pull up /RD to confirm the reading end?

#157224 - Maxxie - Tue May 20, 2008 6:31 pm

Yes