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 > USB Debugging, how to implement it?

#131850 - goruka - Wed Jun 20, 2007 6:33 pm

Ok, it seems using the USB chip inside the n-card is pretty simple, as it had registers just mapped to the GBA rom area.. Also, as it seems this chip is kind of popular in many devices, I though i'd write some debugging support (writing out printf's and gdb)... however, I've been checking usb.org and i can't seen to find any "standard" device i can emulate for communicating (as in, something that can emulate a serial port under windows, and a /dev/ttyUSB under linux/unixes)..
I want to use an existing device driver because I don't really want to bother writing a write for any OS the thing will run on... so, what USB device do you people recommend me to emulate for DS <-> PC communication?

Thanks!

#131852 - Diddl - Wed Jun 20, 2007 6:49 pm

I would implement an virtual Com like some USB devices have. So normal debug over serial port is useable without changes

#131854 - goruka - Wed Jun 20, 2007 7:10 pm

Diddl wrote:
I would implement an virtual Com like some USB devices have. So normal debug over serial port is useable without changes


That's pretty much what I want to do, but there doesn't seem to be any device like that in the USB.org standard device specifications... or at least none that i could find. I don't want to do anything that forces me to write a driver, (and much less a windows driver) since that's a lot more work...

#131869 - tepples - Wed Jun 20, 2007 9:50 pm

USB has a communications device class, which USB to RS232 adapters use. Have you checked the communication device class spec?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#131916 - masscat - Thu Jun 21, 2007 10:48 am

My understanding of what you are trying to do is plug the n-card into the PC via USB and have it appear as a serial port.
If this is correct and you do not want to write your own PC side driver then you will have to emulate (on the DS/n-card side) a serial/UART USB bridge device and borrow the vendor/device id of somebody's product that uses the device so that the PC can then use their driver.

Looking at the linux kernel source there are a number of devices you could emulate (have a look in drivers/usb/serial). For example, one device I picked at random was the Prolific PL2303, the datasheet of which is available from the Prolific website. The kernel source also includes vendor/device id pairs of products that use the device.

Have a look at the other devices as there may be one that is easier/nicer to emulate, as here is a comment from the kernel usb to serial driver code:
Code:
/* BEGIN HORRIBLE HACK FOR PL2303 */
/* this is needed due to the looney way its endpoints are set up */