Shop OBEX P1 Docs P2 Docs Learn Events
USB — Parallax Forums

USB

MarkysparkyMarkysparky Posts: 21
edited 2005-02-06 21:33 in BASIC Stamp
Is it possible to use the USB2SER Development Tool to take a usb signal and put it through the BS2 and out onto the debug menu (would this be USB packets or Serial packets?) to determine the packets sent from a device and then send data back through the USB2SER Development Tool? I guess I would have to use the serin and serout commands?

mark
freaked.gif

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-02-02 03:59
    Yes, use SERIN and SEROUT and available pins -- the USB2SER is designed for TTL signals; the pins of the BS2 programming port (where DEBUG works) are pseudo-RS232.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • nv-bobnv-bob Posts: 5
    edited 2005-02-02 16:12
    How can I find out more about the USB2SER Development Tool?
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-02-02 16:16
    The documentation can be downloaded from our web site.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • Jim McCorisonJim McCorison Posts: 359
    edited 2005-02-02 16:17
    If you type in usb2ser in the search box on the Parallax site you'll find www.parallax.com/detail.asp?product_id=28024

    Jim
  • MarkysparkyMarkysparky Posts: 21
    edited 2005-02-03 03:11
    So then can I use the USB2SER to connect to a usb device and then debug the code from the device in the debug screen?
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-02-03 03:22
    So long as your USB device is a PC -- not a mouse, game controller, or other USB slave.· The first two sentences of the documentation...

    "The USB2SER provides an easy way to interface a PC to a microcontroller. It bridges the PC's USB port to logic-level RX and TX signals that can connect directly to a microcontroller's I/O pins."



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • MarkysparkyMarkysparky Posts: 21
    edited 2005-02-03 03:29
    Ok if that won't work what about using a FTDI USBMOD2 to control a a mouse, game controller, or other USB slave device? I do not think that the USBMOD2 is the newist version so would I be able to use any version???
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-02-03 04:41
    There have been several discussions on this subject already, and the consensus seems to be ... no. To be a USB master requires quite a lot of resources that you just don't find in a small embedded controller.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • MarkysparkyMarkysparky Posts: 21
    edited 2005-02-03 19:45
    so tecincally it will be pretty much imposible to determine the codes coming from a usb game controller to determine the codes for the butons and joysticks?
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-02-03 20:14
    Through USB it may be impractical using a small microcontroller. That said, I've been wrong about many things, and having never tried (and likely never will) to connect a USB game controller to a small micro, I could be wrong on this subject. The Internet is a wonderful thing, and a dedicated search may turn up information that helps you in your quest.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • SteveWSteveW Posts: 246
    edited 2005-02-03 20:24
    Yes. Unless you build something that looks very much like a USB master (polling every millisecond, filling the right timeslots, acknowledging data), your USB peripheral is going to sit there, completely asleep, powered down, ignoring the USB cable and buttons.
    USB looks so simple to the user _because_ it's so complex (and rather nicely designed).

    Steve
  • SteveWSteveW Posts: 246
    edited 2005-02-03 20:48
    >Through USB it may be impractical using a small microcontroller

    The USB1 spec (you really, really don't want to be thinking about USB2) is here:
    http://www.usb.org/developers/docs/usbspec.zip
    along with more information than you can shake a really big stick at.
    It's faintly possible that, with extreme cunning and an SX running at 100MHz, you could build a truly simple master, as long as you compiled in all the constants. Handing off some of the bitshifting, CRCing, line-driving (and turning-around), to a CPLD or FPGA would help - should make it possible, although still not trivial. Banning hubs, and abandoning any pretence of being USB compliant, would give you some more slack time. At least, by being a host, you shouldn't have to worry about clock recovery.
    It's a hard project, and because the end result would likely be limited, end users would be perpetually dissapointed. I wouldn't touch it with a bargepole [noparse]:)[/noparse]
    Anybody hoping to hang a USB host connector on the side of a Stamp just gets the simple 'no'. Serial is so much simpler.

    Steve
  • SteveWSteveW Posts: 246
    edited 2005-02-03 22:00
    A bit more reading the spec, with this in mind.
    It might be possible to build a low-speed interface that fakes being a hub port, rather than a host. There don't seem to be any sequence counters, at the lower layers anyway, which would have precluded precalculating the CRCs, and since the hub strips out any full speed transitions before they make it to the low speed device, you've got a _lot_ more time to think about things on an SX. Maybe even enough to deal with frames on the fly, rather than precalculating everyting. Memory will be tight though - it deends how chatty the device wants to be.
    Dunno if any useful devices speak low-speed, though. Anyone?
    HID devices, which I guess are the most likely (only?) candidates are described here:
    http://www.usb.org/developers/devclass_docs/HID1_11.pdf
    Still tricky, and it'd not be a generic host, more a bodge to use a specific device, but it's looking slightly more possible.

    Steve
  • MarkysparkyMarkysparky Posts: 21
    edited 2005-02-05 00:55
    I found this information I think it is what I need right? I really do not know how to code it. Any suggestions? http://euc.jp/periphs/xbox-controller.en.html
    I know I will have to use the serout command but what would the command look like if i were to use the "A" button? or the joystick?

    mark
  • SteveWSteveW Posts: 246
    edited 2005-02-05 11:59
    You 'know' incorrectly, I'm afraid.
    Just because "USB" contains the word "Serial" does not mean that it has anything in commmon with, or interoperability with, RS232.
    You can _NOT_ attach a USB device directly to a Stamp. Stop trying.

    (The converter I described earlier is a seriously tricky piece of work. A hundred hours or so, with serious development tools, for somebody who knows what they're doing, and I'm still not sure it's possible. Right now, you don't know what you're doing, so it's not going to be you. It's not going to be me, either).

    If you really want to use your controller on a Stamp, then hack it open and attach the switches to the pins on the Stamp, and ignore the USB completely.

    Steve
  • Jim McCorisonJim McCorison Posts: 359
    edited 2005-02-05 17:07
    Perhaps we need a sticky post at the top of this forum titled somelike "USB & The Stamp - What you can and can not do". We seem to be having 2 or 3 threads per week from people wanting to have the stamp act as a master. It might save everybody time and bandwidth.

    Jim
  • SteveWSteveW Posts: 246
    edited 2005-02-05 18:11
    Yeah, I've worked it through as far as I think makes sense. It does start to sound like a serial <-> HID controller could probably be built into an SX, but it's a big, hard chunk of work, and I suspect it wouldn't do what people thought they wanted. No bid from over here...

    Steve
  • Jim McCorisonJim McCorison Posts: 359
    edited 2005-02-06 21:33
    If you want a glimpse at what it takes to monitor a USB connection, check out www.ellisys.com/products/usbex200/index.php. This device will handle USB 2.0 which I'm sure adds to the price, but their base unit is about US$3,000. My guess is that for that price there is probably a heck of a lot more in it than a microcontroller.

    Jim
Sign In or Register to comment.