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 > Communication Hardware

#92095 - entilzha - Tue Jul 11, 2006 4:11 pm

Hi guys,

Currently I'm looking into using the DS as an embedded system in a hobby robot. I tried it with the GBA earlier, which worked nicely. Back then I used the communication port of the GBA in general purpose mode, and programmed it to talk I2C to the rest of the robot.

Thinking about maybe building a new robot, it is time for a new challenge. The DS poses the interesting option of WiFi communication for wireless robot control, especially since I understand WiFi-lib now supports TCP. Not having a DS yet, I was wondering if this is a feasible project. It leaves 2 questions open to me:

* Would WiFi-lib enable me to send TCP/IP messages to the DS? Does the DS accept messages from random computers?

* How am I gonna control the robot itself? It will have some microprocessors taking care of things, which I will have to interface with. I understand the com-port now only exists in software. Does it still exist in hardware pins somewhere, meaning I should get my soldering iron and start hacking? Or is it really gone?
And also: does the SPI interface leave me any options? Does anybody know what would happen if I set the device bits in the REG_SPICNT to 3 (prohibited)? Maybe I could make my own device there? Or maybe I could share a line with the microphone or something?

Thanx in advance for your tips/suggestions..

#92312 - HyperHacker - Wed Jul 12, 2006 7:21 pm

If you install FlashMe, you can use the DS card slot as a sort of serial port.
_________________
I'm a PSP hacker now, but I still <3 DS.

#92384 - entilzha - Thu Jul 13, 2006 8:38 am

Wow.. That would be amazing.. I wouldn't have though of that one.. so that would mean modding an sd card. Not too shabby, as I would be using the gba slot to hold the program cartridge.

Any docs/threads/hints on how this can be done?

#92391 - TheRain - Thu Jul 13, 2006 9:14 am

Natrium42's SerialMe which requires Passme hardware and programming a CPLD to function...

http://www.natrium42.com/projects/serial.html

this fellow succesfully interfaced a SPI camera to the DS ( full source code is downloadable toward the bottom)

http://www.kako.com/neta/2006-011/2006-011.html

Darkfader has documented the physical specs of the card slot and his page has PCB layouts of all sorts
http://darkfader.net/ds/
DS Card Slot Pinout
http://df.groovyness.com/darkfader.net/ds/files/cartridge.txt

nerdofnerds and I are working on MIDI for the DS so we're collecting information on this too.

#92400 - masscat - Thu Jul 13, 2006 10:46 am

Does anybody know where you can get DS cartridge slot prototype boards from (like those used in the SPI camera project or similar)?

EDIT: Just read the website off the picture of the board (kako.com) so I imagine they had them made up themself.

On the wireless side of things, at the moment the DS requires an AP to associate with but after that any computer can talk to it. The DS is capable of being an AP but the wireless library does not support it yet (I am not sure it is understood how to setup the ds hardware for this).

#93310 - KeithE - Tue Jul 18, 2006 3:07 pm

Thank you thank you thank you for this topic, and for the links to the SPI camera!

With the information there, I was able to interface a tri-axis accelerometer to the DS through the SPI EEPROM interface in the DS card slot.

#93363 - entilzha - Tue Jul 18, 2006 8:09 pm

Congratulations!

That Japanese site from the camera-interface is incomprehensible, but the code is not too hard to understand, just like his schematic..

I have to agree with masscat though, how do I get a special insert for the DS slot? There is an etching kit available to me, but I'd prefer to stay away from it if that's possible (I'm no hero with chemicals). Did you take an already existing DS cart and mod it, or did you make your own insert?

#93369 - entilzha - Tue Jul 18, 2006 8:28 pm

The key thing is this Japanese guy somehow knows the registers for SPI interfacing with the savegame EEPROM. These aren't mentioned in the DSTek. Maybe he dove into the ARM-9 documentation or something? Maybe he just tried out some registers..

Anyway, apparently there is another SPI port available for interfacing with the savegame EEPROM on registers

0x040001A0 (CONTROL)
0x040001A2 (DATA)

#93381 - masscat - Tue Jul 18, 2006 9:52 pm

There is some information about the registers on the NDSTech Wiki.

#93383 - KeithE - Tue Jul 18, 2006 10:03 pm

I used the NDSTech wiki to help me understand the registers. Also, the temperature sensor code linked to from the SPI camera showed me how to send multiple bytes of data without raising chip select between each byte.

I hacked up a DS game, bought for $9.99 at the local video game store, using the diagram on akkit.org for reference.

And I didn't follow the schematic on the SPI camera site - I connected my sensor to pins 2, 6, 15, and 16 of the DS card (CLK, CS, MISO, MOSI).

#93466 - entilzha - Wed Jul 19, 2006 10:03 am

ok, nice. I assume you just removed both the game chip and the EEPROM?

#93480 - KeithE - Wed Jul 19, 2006 1:50 pm

That is correct - I desoldered both the chips, and soldered wires from my sensor to the proper via holes on the PCB. I left the capacitors on the board - I didn't trace what they were connected to but they don't seem to hurt anything.

#93483 - dovoto - Wed Jul 19, 2006 2:25 pm

I highly recomend

www.charmedlabs.com

I have been using it for the last 3 years or so and is by far the most ureful device i have ever purchased. Works great on ds and gba. It does use the gba cart bus as apposed to the ds cart bus but I personaly dont see that as an issue.
_________________
www.drunkencoders.com

#93524 - TheRain - Wed Jul 19, 2006 6:15 pm

Hey dovoto... does that thing have a slot on it to plug in a flash cart with it?? or how do you run your code??

Anyhow... if anyone's interested, I succeded at getting MIDI to transmit from the DS. MIDI, btw, is a serial protocol operating at 32,125 baud and sending three bytes at a time with start and stop bits... so 30 bits in total for a MIDI message. The code I wrote was derived from natrium's SerialMe code, but does not require a CPLD at the card slot... data is sent directly from pin 16... here's my MIDI .h file:
http://www.collinmeyermusic.com/dsmidi/dsmidi.h
you may want to invert the bytes sent (HIGH to LOW, LOW to HIGH) if you are working with some other protocol. You can see my notes in the .h file where I changed natrium's code in order to invert my bits because MIDI bits are inverted in level.
and my extreeeemly complicated (joking) schematic:
[Images not permitted - Click here to view it]

I did similarly to what KeithE did, deconstructed a card and just soldered wires to it.

#93542 - dovoto - Wed Jul 19, 2006 8:22 pm

It has 4MB of onboard flash mapped to the gba cart. This has been more than enough for anything I have done (although some homebrew is too big to fit). You can suppliment the memory with something like an MK2 cheaply enough though.

The fact that it has an onboard fpga with 60 or so io ports (and 16MB of ram if you opt for that version) is pretty awesome for any homebrew robotics project or even as a general purpose FPGA development board.

99% of the time it is just my gba flash card for ds homebrew deving (I dont have to take it out of the DS to flash it is the main reason...it also does full coms with the pc via the cable).
_________________
www.drunkencoders.com

#93545 - KeithE - Wed Jul 19, 2006 8:36 pm

That midi project looks pretty cool. What have you used it for?

I decided to use the DS card bus instead of the charmed labs Xport for 2 reasons: 1 - I don't want to buy one. 2 - I'd like to make a device that anyone can use without having to buy extra hardware to support it.

#93579 - TheRain - Wed Jul 19, 2006 11:45 pm

Thanks Keith...

So far, the only app i have created with it is on my dev blog http://www.collinmeyermusic.com/dev/ it's just an X/Y touchpad controller that sends out MIDI Continuous Control messages based on your screen touches.

Currently I am working towards a step sequencer with mod sequencing as well.... but learning enough about the DS to create a nice, skinned looking interface and some eye candy is the biggest hurdle I have to that. Well, that and I still need to think through the sequencer timing issues.

As an aside, MIDI is designed as a music systems communication protocol... but I wanted to note that the specification can be used for all manner of other hardware designs as a control specification.. though if you are to be MIDI compatible 32,125 baud is the max speed of transfer.

I think that device that dovoto's talking about looks REALLY cool, if a bit hefty of a package... I can't wait for DSerial though, I hope natrium get's it working soon. http://www.natrium42.com/blog/?p=38#comments

Something I think would be really slick is a touch screen interface to something that is like stepper motor or servo controlled... maybe even where what's on screen is a slick looking graphical representation of what you're controlling with smooth touch screen control. =)