Shop OBEX P1 Docs P2 Docs Learn Events
SX to PC via USB — Parallax Forums

SX to PC via USB

CrustyNoodleCrustyNoodle Posts: 15
edited 2008-06-05 05:37 in General Discussion
Well I'm really starting to get into this whole micro thing and enjoying it a lot.· My ultimate aim is to build an inertia dyno to test and tune RC car engines and my SX project will do the data acquisition and a bit of servo control.

I've done a fair bit of searching on the forum now and haven't yet found a clear solution to the SX to PC communications using USB.· As I only have laptops with USB ports I'd like to find a solution that enables me to communicate using USB without the need to use a USB to RS232 type of device.· Ultimately I'd like a device that has a USB recepticle that I can plug into the bread board area of my SX Tech Board that then allows me to address it directly using my SX.

Does anybody know if there is such a beast in existence and if not then any suggestions on how best to do this?
·

Comments

  • BeanBean Posts: 8,129
    edited 2008-06-02 11:08
    You could use either the FT232RL(Serial) or FT245RL(Parallal) chips.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Did you know that 111,111,111 multiplied by 111,111,111 equals 12345678987654321 ?

    www.iElectronicDesigns.com

    ·
  • JonnyMacJonnyMac Posts: 9,216
    edited 2008-06-02 13:24
    Parallax makes an adapter called the USB2SER -- I uses this to get serial data to/from the PC via USB all the time. You can add a 4-pin header to your board to plug into; it's very easy.
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2008-06-02 17:41
    Since you mentioned something that will just plug in there are a couple modules made by DLP Design that would work. They are based on the FTDI chipset (which seems the best chipset in my opinion) so they just work. Here are some links:

    http://www.dlpdesign.com/usb/usb232.shtml

    http://www.dlpdesign.com/usb/txrx.shtml

    Best Regards,

    Robert
  • PJMontyPJMonty Posts: 983
    edited 2008-06-02 19:45
    CrustyNoodle,

    Bear in mind that all the solutions being offered are essentially USB serial ports in chip form. You're still doing a USB to Serial conversion within the chip/driver combo, but you're doing it with a chip on your board instead of in an adapter. It could be argued that it's cheaper to buy a single serial adapter rather than keep putting USB chips on each board, depending on the number of boards you end up making. Also, you can get away with talking to a serial port without using a full blown level converter such as a MAX-232, so you wouldn't necessarily add that cost to each board.

    Just something to think about...

    Thanks,
    PeterM
  • CrustyNoodleCrustyNoodle Posts: 15
    edited 2008-06-03 03:21
    Thanks guy's those suggestions are ideal - but I see what you mean about cost!· I can see why this is not often the done thing.·

    It's only a one-off project (at this stage) but I'm still undecided as to which route to take - USB2SER or the USB to Serial adaptor.

    PJMonty, from your comments, I assume if I use the USB to Serial adaptor then I won't need to do anything more than connect directly to the DB9 plug?· If that is the case then I might be able to have my cake and eat it too if I just hard wire the USB to Serial adaptor to my board.

    Thanks for your input.
  • JonnyMacJonnyMac Posts: 9,216
    edited 2008-06-03 04:49
    Unless you want to connect a standard serial connection to the board you'll end up having stacked level shifters. The USB-to-Serial adapter has a USB chip plus an RS232 level shifter on it. On you're board you'd typically put an RS232 level shifter downstream of the DB-9. So, if you're always going to be using USB you end up with to RS232 level shifter that aren't required. A couple of the devices listed above will take you directly from USB to TTL-level serial.
  • StarManStarMan Posts: 306
    edited 2008-06-03 17:28
    How long of a cable can be used when going directly to TTL?· Like RS485, can there be a network with more then one device?

    Chris I.
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2008-06-03 18:18
    It is best to keep the runs as short as possible when using the TTL (Logic level) serial signals. If you want long distances then go ahead and use a MAX232 (or similar device) for Serial or use one of the FTDI adapters already listed.

    As far as sharing the line there are certainly ways to do it is you are careful. The RX signal can go to multiple devices easily. A few things to consider is the fan out so that you are not trying to drive more devices than the driving device can handle. If you need more you may need a driver to buffer the signal so it can drive more things. In this case it may be more like a Party line so all the devices hear the signal. This is fine if you are using something like the AppMod style protocol so it will only respond to data sent to the particular device. You may also want to use some selection logic so that only one device at a time hears what is coming down the Serial line. If you get a chance to read the April 2008 issue of SERVO I did something like this for my BOB robot project.

    For the multiple devices sharing the TX line you can either use some extra logic as a MUX so that only one can use the line at a time. Another option is to use an "open-collector" as the TTL TX on all your devices and have a pull-up resistor on the line. This way any of the devices can talk without shorting anything out. Of course they should be well-bahaved and not all try to talk at once. Again, the AppMod protocol is useful here since the target device is typically asked for information and only that particular device would respond.

    If you are using a USB adapter I would certainly look at sharing the logic level serial line with several devices and look at all the examples that use the AppMod protocol. Parallax already has many well documented and several are done with SX/B on the SX chips. Projects like that are one example where the SX processor is an excellent choice.

    Hope this helps,

    Robert
  • JonnyMacJonnyMac Posts: 9,216
    edited 2008-06-03 18:45
    All EFX-TEK accessories (e.g., AP-8, DC-16, FC-4, and RC-4) use an SX with open-true communications and the Parallax AppMod protocol. As Robert points out, though, the modules are designed for very short interconnections. With straight TTL there is virtually no noise immunity.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2008-06-04 05:39
    Well, if you really don't have an RS-232 port [noparse][[/noparse]many newer devices don't], by all means use an adapter. But if you have an RS-232 port, there is really no reason to include the USB as nothing is gained in speed.

    Full duplex RS-485 will allow longer distances, but RS-232 is okay for 50 feet. So again, why bother with adding layers of hardware and technology.

    If you really want a complex RS-485 network, CANbus - which has 8 byte packets - will allow multiple masters and multiple slaves. But since you say that you are just getting started, I would recommend avoiding such complexities until you really need them.

    Mostly, the simpler the solution, the better. You will likely be needing or wanting ADC chips to accumulate data. Each channel can sample and hold data until read. By reading in a round robin fashion, one ADC chip can provide 8 channels of useful data that is sent to the PC as one packet of 16 bytes [noparse][[/noparse]each sample is 12bits or longer, so 2 bytes are required].

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    PLEASE CONSIDER the following:

    Do you want a quickly operational black box solution or the knowledge included therein?······
    ···················· Tropically,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
  • nonnnononnno Posts: 28
    edited 2008-06-04 20:25
    Bean (Hitt Consulting) said...
    You could use either the FT232RL(Serial) or FT245RL(Parallal) chips.

    Bean.
    Hi

    I tie RL245RL by way of experiment and :.
    Though I was expecting that I become a parallel port
    The device driver of WIN2000 is a serial port.

    Is there a method of compulsion to a parallel port?

    The latest driver of FTDI 2.04.06 is announced.
    http://www.ftdichip.com/Drivers/D2XX.htm
    nonnno
  • CrustyNoodleCrustyNoodle Posts: 15
    edited 2008-06-04 22:24
    Thanks for all the great info guy's.· I've decided to build an RS232 port into my project and just use the USB to DB9 serial adaptor to hook it to my PC.·

    Kramer, thanks for your suggestions and to answer your first question - no I really don't have any serial ports on my laptops - I have two X-series ThinkPads which are strictly USB and firewire.· I don't even have CD drives in these things - but I do have an SD card reader and PCMCIA.
  • BeanBean Posts: 8,129
    edited 2008-06-05 02:13
    nonnno,
    On the PC it acts like a serial port, but on the other side the FT245RL acts like a parallel port.
    Whereas the FT232RL acts like a serial port on both sides.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Did you know that 111,111,111 multiplied by 111,111,111 equals 12345678987654321 ?

    www.iElectronicDesigns.com

    ·
  • nonnnononnno Posts: 28
    edited 2008-06-05 05:37
    Thank you. It was possible to be promoted greater understanding about FT245RL.

    For instance, when "SX/KEY" is operated by way of USB, isn't it
    difficult to specify "Port"?

    In which is there an advantage when connecting it with "fluffy" with the cereal in parallel though
    it comes off from the basis for a moment?
Sign In or Register to comment.