Author Topic: Criterion for a general purpose micro controller to be used as USB host control  (Read 26069 times)

titan_amit

  • Member
  • ***
  • Posts: 13
Can we use a general purpose micro controller like 8051 to develop a USB host controller. If not why? If its possible to develop a USB host controller using a uc, what are the features uc must have?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Yes, if you interface it to a host chip such as PLX  OXU210HP, Maxim MAX3421E, FTDI Vinculum, GHI Electronics USBwiz.

Jan

titan_amit

  • Member
  • ***
  • Posts: 13
Ma'm is it possible to implement the host chip inside the micro controller. If no why?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
You need host-controller hardware either in the chip or on an external chip. If you want to see what host-controller hardware consists of, take a look at PLX or Maxim chips I mentioned.

Jan

titan_amit

  • Member
  • ***
  • Posts: 13
Hii ma'm

As you suggested i looked into the details of hardware of host controller chips and the only thing that i found special in them (apart from buffers and some special function registers) was Serial interface Engine(SIE). As far as i understood that SIE does all the basic functions like CRC calculation, bit stuffing etc., but my doubt is, isn't it possible to implement these functions in software inside a general purpose micro controller. Please guide me if i am wrong.

Pat Crowe

  • Member
  • ***
  • Posts: 39
The most time-critical task you would have to perform is recovering the clock from the incoming upstream data.

Remember that the incoming data is not synchronised to your own clock, and that several bit time will occur without data transitions. Recovering the clock is most simply implemented as dedicated hardware, that was what was intended by the spec. Recovering the clock in software requires sampling it at several times the bit rate and implementing a software digital phase-locked loop. Assuming Full Speed, the minimum sample rate would be 48 MHz.

At the same time as recovering the clock you would, of course, have to be reading and storing one complete packet's worth of data, for subsequent decoding.

Have a go at defining the software you would need to do this and I suspect you will become aware of the problem.

It is really a case of 'why try to do something the hard way?'.

dhouston

  • Member
  • ***
  • Posts: 10
Does anyone know of a host chip which uses SPI, like the MAX3421E, but can work at 3.3V & 5V?

dhouston

  • Member
  • ***
  • Posts: 10
Does the latest edition of USB Complete cover the data flow when using something like the MAX3421E with an embedded µC?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
USB Complete doesn't have MAX3421E-specific info.

My USB Embedded Hosts book will be out in November. It covers USB embedded host communications with example code for embedded Linux systems. More info is here:

http://www.lvr.com/usb_embedded_hosts.htm

Jan

dhouston

  • Member
  • ***
  • Posts: 10
Thank you. I had the first edition (plus 3 books other of yours) and it looks like I can save the cost of the latest edition and order the USB Embedded Hosts, instead. The sample Chapter 2 looks like this is exactly what I'll need. Amazon, here I come.

Initially, I have only a single (self-powered) device to support and, as it's about 7 years old, suspect it's low speed. Others have already reverse engineered most of its communications protocol. I'll be using an AVR µC but your Linux code will likely be helpful. I'm designing my PCB now and think I can do that with current knowledge.

Later, I plan an Arduino form factor board that can support all the things the MAX3421E can do. But, it will mostly be up to Arduino aficianados to decide what and how it interfaces with other hardware.

dhouston

  • Member
  • ***
  • Posts: 10
I would like to design my PCB (actually, revise a preliminary design) without waiting for your book. However, while the MAX3421E datasheet shows 3-4 variations on host/peripheral, it does not show a Host with a Self-powered Peripheral which is what I need. From the diagrams that are in the datasheet, I've drawn the schematic below (EDIT: modified after Jan's comment). I would appreciate your comments/corrections.

I need to connect to...
« Last Edit: September 23, 2011, 12:02:12 pm by dhouston »

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Even for self-powered devices, the host has to provide VBUS to power the pullup on D+ or D- for device detection.

The challenge with using an interface chip like Maxim's is obtaining host firmware for the system processor, not just the host controller driver but also drivers for the supported devices.

Jan

dhouston

  • Member
  • ***
  • Posts: 10
I have revised my schematic to include switched +5V to VBus. However, I have two more questions.

1. I only want to host a specific peripheral which has a cable with A on the host end and B on the peripheral end. Due to limited space I cannot use an A connector on my PCB (Arduino shield form factor) and will need to use a mini USB-AB connector. I can find a cable with the needed connectors on the ends but what do I do with the ID connection?

2. My project needs to work with 3V3 or 5V supply. How do I provide VBus from 3V3 power? I do have 3 MAX3232 ICs on the PCB - can I use those to supply VBus?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Use a step-up regulator to provide VBUS. The USB-IF's Embedded Host spec says that an embedded host should provide 8 mA or the amount of current required by supported peripherals, whichever is larger.

The Mini-AB (now Micro-AB) receptacle is intended for use on OTG systems. The ID pin tells the system whether an A-series or B-series plug is attached. The system could display a message if the user attaches a series-B plug.

The Embedded Hosts spec is included in the USB 2.0 spec's zip file.

Jan