Posts

USB Host breakout at work

Here is an interesting project which uses MAX3421E breakout board to connect XBox360 wireless controller to old Nintendo Entertainment System. Francois Gervais used Cortex-M3 as an interface between Nintendo and a game controller. There are two other videos showing the details of the setup – check them out as well.


Continue reading USB Host breakout at work

USB Isolator Most Frequently Asked Question

ADuM4160 PIN pin grounding

ADuM4160 PIN pin grounding

Q. I am getting “USB device not recognized” error message – what do I do? Also, since the isolator is soldered into my circuit, “reconnect peripheral” suggestion seems too difficult to follow.

I decided to write this article after receiving several e-mails from people who bought my isolator. While setups described in those e-mails were different, the problem was the same – a PC refusing to recognize the device connected through the isolator. Here I will try to explain what is happening and also share my ideas how to troubleshoot and possibly fix the problem.

When nothing is connected to USB port, the bus is held at ground level with pull down resistors on the host side. USB device, when connected, pulls one of bus lines up, often times also with a resistor connected to Vbus and data line. Host sees it, sends bus reset and tries to query the device. If device is answering, host keeps querying the device and eventually enumerates it. When device is enumerated, application takes over.

If device is not answering (like for example, when self-powered device is turned off), host will give up and post “Device not recognized” message. To get attention from the host, we need to generate bus event, i.e., disconnect the peripheral and connect it back again.


Continue reading USB Isolator Most Frequently Asked Question

Solder stencil for USB Isolator PCB in store

USB Isolator Board Solder Stencil

USB Isolator Board Solder Stencil

I received a batch of solder paste stencils for my USB Isolator PCB. Now those who want to try low-tech reflow soldering technique, can do it. Stencils are laser cut by Ohararp from 0.0035″ Kapton. They are now offered for sale at the store.

How to drive USB keyboard from Arduino

USB Host Shield driving a keyboard

USB Host Shield driving a keyboard


I am continuing on topic of using USB Host shield to drive USB peripherals started in the previous article. The code presented here performs keyboard polls, character translation and management of “LOCK” keys – NumLock, CAPSlock and ScrollLock.

A keyboard is hard to use if results of typing can’t bee seen, so my first step was to add an output device. Even though HD44780-compatible character LCD can be driven with Arduino pins, I wrote a little library which uses GPOUT port of MAX3421E for LCD control. This library is now a part of USB Host Shield repo on github. I used LCD high-level routines from official Arduino distro and developed low-level functions specific to MAX3421E hardware, as well as LCD initialization. Since function syntax and behaviour (and source code ) is identical to official LCD functions, the user manual is already written and can be found in the library reference by title LiquidCrystal. The only difference is in the constructor; since only 4-bit mode is possible and only one pinout is supported, Max_LCD constructor is not accepting any parameters. The pinout of LCD connections to GPOUT is given in the Max_LCD.h file; see also title image of this article.


Continue reading How to drive USB keyboard from Arduino

USB Isolator kits in store

USB Isolator parts

USB Isolator parts

Immediately after announcing USB Isolator circuit I received several suggestions to put together a parts kit. Indeed, users of such devices are usually not afraid of small parts and generally aware of which side of soldering iron is better suited for holding on to. Also, I’m having hard time trying to find a supplier, where one can buy all the parts to build this circuit; usually, you need to buy from 2-3 suppliers, which significantly adds to shipping expenses. Considering this, I’m now offering not one, but two parts kits to build an USB Isolator based on Analog Devices’ ADuM4160.

The kits are added to “ADuM4160 USB Isolator bare PCB and kits” dropdown. One kit contains all the parts necessary to build an isolator – PCB, ADum4160, capacitors, resistors, USB connectors, pin headers, and jumpers and costs $25. Another kits contains all that plus all parts for 5V buck converter – LT1376-5, inductor, caps, etc and costs $33. Enjoy!

I’m not writing a build manual at this time; I’d like to get some feedback from builders first. Any questions you have, please don’t hesitate to ask.

Oleg.

USB Host Shield in store.

Four configurations in Arduino blue

Four configurations in Arduino blue

[EDIT] This post is about legacy product which is no longer supported. Visit USB Host Shield project page for up-to-date information[/EDIT]

Arduino USB Host Shields are in the store. If you are not yet familiar with the project, please browse “USB Shield” category of the site and read the articles. In short, the purpose of this shield is to add USB Host interface capability to Arduino. The software libraries for this shield currently support control and bulk-in transfers, while bulk-out transfer is in the works. Access to GPIO pins of MAX3421E is also supported. Sketch examples, demonstrating USB device control queries and polling USB keyboard, are published. More code will be developed in the future.

At present, four configurations of the shield are available. The first one, called “Minimal”, contains USB core components only. It is compatible with 3.3V Arduinos, such as Arduino Pro from Sparkfun. Also, since no 5V is available, only communication with self-powered devices is possible. Moreover, not every self-powered device would work in this configuration. For unknown reasons, some external hard drives refused to answer until VBUS voltage was raised to 5V. On the other hand, all printers and digital cameras that I and several beta-testers tried worked fine as well as other people’s external hard drives. “Minimal” configuration is the best one for battery-powered projects since 3.3V Arduinos consume less electricity.


Continue reading USB Host Shield in store.

Arduino USB Host – Peripherals.

USB constructor

USB constructor


The time has come to start using the code to communicate to peripheral devices. There are many devices which work well with microcontrollers. HID devices, such as keyboards, joysticks, and Radio Controller look-a-likes are useful and not too difficult to implement. Another good application of embedded USB host is digital camera control. Communication using Bluetooth and WiFi peripherals are also a possibility.

Today I’m going to show how to communicate with USB keyboard. Standard USB keyboard belongs to a class of devices, called HID (Human Interface Device). The format of data generated by HID device is quite flexible and each device stores it’s data definitions in structures called Report descriptor and Physical descriptor. Generally, to work with the device, report descriptor has to be retrieved and parsed. Because of HID flexibility, a universal HID driver will take many many lines of code. Luckily for us, if all we need is to talk to the keyboard, there is an easier way.


Continue reading Arduino USB Host – Peripherals.

Arduino USB Host Shield build log. Part 4.

Layout closeup

Layout closeup


Release candidate 1 boards has been received, built, tested, and came out green wire free – at last! I placed an order for a small batch with board house and expect PCBs to be available in a couple of weeks. I am making second call for beta testers – if you write code and/or blog, drop me a line with a link to your blog and your voltage preference for the shield – 3.3V or 5V. I have more 3.3V boards left from prototyping so naturally people requesting 3.3V boards will have more chances to get one.

Updated Eagle and Gerbers are available in Downloads section. If you don’t have Eagle, here is the PDF of the schematic. Please make sure you are not using scematic posted in one of the previous articles – there are quite a few changes.

In this article I want to give an overview of the board and it’s features. I’d like to start with most complicated part, which is power configuration. First of all, the USB core part of the shield (MAX3421E) requires 3.3V to function. Second, bus-powered USB peripheral requires 5V on Vbus. However, to use self-powered USB peripheral we only need to connect 3.3V to Vbus to be able to see speed-setting pullup resistors. Consequently, for digital camera control applications, shield can be mated with 3.3V Arduino (like Sparkfun‘s Arduino Pro) with no additional power supplies.


Continue reading Arduino USB Host Shield build log. Part 4.

Arduino USB Host Shield build log. Part 3.

USB Host Shield prototypes

USB Host Shield prototypes

Making functional 5V version of a shield proved to be difficult. I was hoping to publish a release after building previous protos. However, it turned out that together with fixing old errors I managed to make several new ones and also missed a couple from previous prototyping cycle. So, in order to produce a proto containing less errors than a previous one, I spent a great amount of time checking everything I could think about, writing test code, running those tests against prototypes, and then repeating them on all possible mixes of available Arduinos and voltages.

Also, I found that USB-B connector on Duemilanove shorts GPIN contacts on a shield. Cover top of the connector with piece of Scotch tape, if you haven’t already.

Today I placed an order with BatchPCB to what I call “Release candidate 1”. I am hoping this is a design which will be released when I get it back in 3 weeks or earlier( BatchPCB is getting faster ). Also, I forked previous repo containing Arduino libraries, the current development is now contained in USB_Host_Shield. I removed Vbus power control support since it’s not implemented on a shield and added functions for GPIO pins read/write. I’m freezing previous repository to support old sketches.

While waiting for PCBs I will continue working on HID code for the shield and also write a library to control LCD/buttons via GPIO pins. Stay tuned.

Oleg.

Building USB Isolator.

USB Isolator

ADuM4160 USB Isolator PCB panel

USB Isolator PCBs has arrived. In this article I will be talking about building and configuring one. The PCB was designed with hobbyist-friendly large size SMD packages and 10mil clearances and I hope it won’t be difficult to made one at home. The layout files are available from downloads section.
Let’s talk about parts procurement. This is a BOM at Mouser sans ADuM4160, LT1376-5, and PCB. This is BOM at Digi-Key, which includes LT1376-5. Last time I checked, Digi-Key was way more expensive. As far as ADuM4160, since no one sells it in single quantities right now (check this using FindChips), the easiest way to get it is to ask Analog Devices for a sample, they are generous folks.


Continue reading Building USB Isolator.