#1177 - atari - Wed Jan 15, 2003 1:39 pm
I'm building a simple floor roving robot using 2 rotation-hacked RC servos, to be linked to a GBA for control purposes.
I was originally intending to use the XPort device, since the GPIO is super-simple, and the method of sending the required pulses to the servo motors is very well documented. Problem is, I've been trying to get hold of an XPort, and Charmed Labs don't seem to want to sell me one.
Seeing as I only really need 2 simple outputs (once for left motor, one for right motor) from the GBA (and ideally two collision detector switches, so two inputs), could I realistically do this using a hacked link cable?
As you've probably guessed, I have no idea about hardware, so any help anyone can offer me would be useful. Specifically what bits / mode I should be accessing on the communication port, and anything schematically relating to which wires do what.
[edit: I should mention that this is a college project in using software for hardware control, hence my idiocy when it comes to actual hardware physicality!]
#1196 - Lord Graga - Wed Jan 15, 2003 5:57 pm
Well, you could use the 5v output....
It is located in the top right when looking on the GBA with screen up.
I have no idea about the software stuff :/
#1209 - atari - Wed Jan 15, 2003 6:46 pm
Just one 5v output, eh?
Makes it tricky... I was trying to do it without using any other seperate microcontrollers, just routing pins of the Xport to servo control wires, powering the servos with batteries.
#1248 - ampz - Wed Jan 15, 2003 10:36 pm
I repeat: There is NO 5V pin in the GBA ext port!!! It's 3.3V pin.
And yes, you could probably use the ext port, there are four GPIO signals in the ext port (link port, com port, or whatever they call it..)
#1259 - atari - Thu Jan 16, 2003 12:25 am
Excellent.
Four is ample, really. I had a feeling it might be possible... So let me guess, UART mode, then treat it as parallel port? I have no problem getting controlled intervals from the GBA (software will not require much processing power) so as long as I can send 3.3v pulses to whichever pin i like, it should be all good.
#1288 - eephltn - Thu Jan 16, 2003 11:44 am
I believe it should be called General-Purpose mode instead of UART mode. Set bit 15 and bit 14 of REG_RCNT (0x4000134) to "0X" for Uart mode and to "10" for General-purpose mode.
#27800 - sandos - Thu Oct 21, 2004 3:31 pm
Dont forget the headphone-jack.. Can probably be useful as a DAC?
_________________
sandos
#27839 - phonymike - Fri Oct 22, 2004 12:32 am
Code: |
Pelican Accessories 4-Player Link Cable
Looking into end of plug (male)
x
/?????????????\
| 1 3 5 |
| 2 4 6 |
\_____________/
pin 1P 2P 3P
1 +3.3v white white n/c
2 SO blue blue blue
3 SI green green green
4 SD brown brown brown
5 SC orange orange white
6 GND black black black |
I got that from a 4 player cable I bought. and some code might look like this:
Code: |
#define SC 1
#define SD 2
#define SI 4
#define SO 8
#define SETTINGS (0x8000 | (SC<<4) | (SD<<4)) //general purpose, SC and SD are outputs while other two are inputs
#define LEFT_MOTOR SC
#define RIGHT_MOTOR SD
#define LEFT_SENSOR SI
#define RIGHT_SENSOR SO
#define REG_RCNT *(vu16*)0x4000134
REG_RCNT = SETTINGS | LEFT_MOTOR | RIGHT_MOTOR; //move forward
REG_RCNT = SETTINGS; //stop
if(REG_RCNT & LEFT_SENSOR){
//left sensor triggered
} |
also note you can't just tie the outputs from the gba to the power wire on the servo, it'll suck too much juice and won't work. however if you provide power for the motor with batteries, and use the comms wire (yellow?) on the servo, then it'll work. the gba's output isn't enough to power even a small motor, but if the motor has power already, it can 'tell' the motor to go. you'd have to figure out the servo protocol though, and send it through the gba's port which would kinda suck. maybe you can try a transistor for the motor, the gba can trigger that.
also note according to gbatek, the SI (input) should only be used for input, so other hardware that doesn't expect power to be there won't break. so according to him, you should only use 3 outputs with 1 input in general purpose mode, which is fine for your needs.
#27865 - sandos - Fri Oct 22, 2004 4:23 pm
Im using the EXT port as described here. I can recommend the GBATEK guide, it was actually the only useful information I could find.
Im having one problem though: how fast is the port able to swtich bits? I can write to the register something like 400k times/s, but Im not convinced the port actually manages to keep up with this. As the serial modes are only ~115kbps, I would assume it doesnt do much more than 100k/s. Any advice on this?
_________________
sandos