As I mentioned in the previous article of this series, the schematic of MAX3421E board differs very little from datasheet reference design. It consists of MAX3421E itself, MAX4793 USB current-limiting switch, MAX6349 3.3V regulator, plus a dash of resistors, capacitors and connectors. Some parts are optional; for example, if you prefer leaving USB power line (called Vbus) unrestricted, don’t solder MAX4793. Also, if you don’t mind using 2 power supplies – 5V to supply Vbus, and 3.3V for MAX3421E, then leave MAX6349 unpopulated as well. Alternative power pins are provided on the board.
The 3.3V regulator can also be substituted with LDOs from other manufacturers either “drop-in”, like ones from National Semiconductor (example: LP3990) or with minor modification – cutting a trace or two (example: TC1040 from Microchip). Look for LDO in SOT-223 package and check pin assignment against MAX6349 datasheet.
Crystal, USB and ground pins of MAX3421E are committed, all other pins are routed to 0.1″ header.
Let’s talk about pin functions. SPI pins of MAX3421E go to SPI pins of microcontroller. Interrupt pin INT will be polled. I used it as interrupt source under RTOS and it worked very well; at present, I am using simple loop, and since handling of MAX3421E events takes a lot of code with a lot of branching, interrupt on INT pin is not worth it. GPX – the second interrupt source, is also polled. I use one GPIN and one GPOUT pin to turn Vbus on/off and read overload status. If you are planning to do a lot of experimenting with USB code, the ability to remove power from the bus at a moment’s notice is essential; many devices get confused by unexpected packet rather easily and would later reject anything but a good old power cycle.
If you decide to use the PIC18F26K20 microcontroller and you have older, non-variable VPP programmer (PIcKit, ICD 2 and like) you will also need VPP limiter.
The project CAD files, including Eagle schematic and board layout, as well as Gerber files, can be downloaded from download section.
The following schematic of PIC connections can be used as an example. Since the software for this board is still “work in progress”, I may later add, remove or change some pins. The whole thing can be built on a breadboard, however, it might not be able to work at 16MHz maximum SCLK speed. On the other hand, a simple protoboard with wire connections works well. SPI transfer test, which is part of the code, can be used to determine safe speed.
The setup is powered from a single 5V supply connected to MAX3421E breakout. PIC18F26K20 is powered from MAX3421E breakout, 3.3V is also connected to level translator threshold pins of MAX3421E and FT232RL USB to serial converter.
Before we move into programming, I want to give a reference to another piece of MAX3421E code. Maxim USB Laboratory has some source code written in C for ARM7. It’s very basic, nothing more than initialization and couple of different control transfers, but worth a look.
Next article, which I’m planning to post in a week, will be describing development setup and a little bit of programming.
- Lightweight USB Host. Part 4 – The code.
- Lightweight USB Host. Part 1 – Motivation.
- Lightweight USB Host. Part 3 – accessing MAX3421E.
- Lightweight USB host. Part 6 – introduction to HID.
- Lightweight USB Host. Part 5 – control transfers.
- USB Host breakout at work
- Arduino USB host – Pre-prototyping.
- Arduino USB host – First programs.
- USB Host Shield for Arduino – first prototype.
- Arduino USB Host Shield build log. Part 1.