Welcome to the PHCC Wiki.

Please create an user account and then help us to make this the one-stop for information on PHCC.

 Actions

USB interface

From PHCC

PHCC USB Interface

Speed Considerations

If you look at the (marketing) numbers of USB, it sounds great. For USB 1.1 those numbers are

  • Low Speed: 1.5Mb/s
  • Full Speed: 12Mb/s

and USB 2.0 adds a third speed:

  • High Speed: 480Mb/s

Note: the above numbers with "Mb/s" are MegaBIT per second.


The problems here are:

  1. USB data rates are not per-device, but per bus (bandwidth)
  2. USB data rates are "raw". No device will ever get up to that number
    1. there is protocol overhead
    2. the protocol doesn't allow just blasting bits over the wire whenever the user feels like it. Packet size and frame transmit times are limited
  3. As more and more devices supporting USB make it to the market, people start using them
    1. This leads to lots of USB devices dangling from user's PCs.
    2. Since all devices on the bus share the bandwidth, things get slower with more devices
    3. some devices need lots of bandwidth, and if lots of data is transferred, the bandwidth is taken away from other devices
      1. webcams
      2. USB harddrives/cdroms
      3. USB card readers for compact flash, MMC, SD, ...
      4. digital cameras
  4. Many commerical USB devices with a higher bandwidth need use some nasty tricks to make USB faster. This, of course, can have adverse effects if you have other devices on the bus.
    1. one of the tricks seems to be to decrease the period of transmits (USB frame) from its defined value of 1ms to shorter periods. This violates the USB specs!

For more info, esp. on USB bandwith, check out the PDF from Microchip's Masters Conference 2004:
http://techtrain.microchip.com/masters2004/downloads/classes/858/858.htm
This contains some very good info.

USB vs. RS-232

If we were to compare the actual usable bandwidth of the RS-232 serial port and USB (low speed), RS-232 would clearly be the winner, even with (RS-232) speeds as low as 19200 bits/s.

We need at least the next USB speed class, full speed, to outperform RS-232. However, if there's a lot going on on that USB bus, effective data tranfer rates could drop below those of RS-232.

Here are a few quotes from the above mentioned document from Microchip:

Regarding Full Speed USB:

  • "Realistic raw data throughput to a single peripheral is ~1.0 MB/s"
  • "Only 64KB/s in many cases"

Regarding Low Speed USB:

  • "8- byte data transfer every 10 ms"
  • "= 800 Bytes/ second only"

USB and PHCC

To use PHCC effectively with USB, we should skip low speed USB entirely as its just not up to the task. High speed USB is only available on USB2.0, and, more importantly, microcontroller-based interface chips are harder to come by and more expensive. Of course, you would have to optimize your program to make use of the higher speed offered.

This leaves us with Full Speed USB. There are many chips that can be used, those from FTDI are good, easy to work with, cheap and they don't need to be programmed. Their FT232 series fits the bill perfectly as it can talk RS-232 on one side and USB on the other side. It doesn't need a whole lot of external components.

In fact, this chip is used in many of the commerical serial-to-USB converters found on the market.