Friday, March 22, 2013

What’s cooking @ e-Gizmo: Episode 4 – Easy to use USB Host for Microcontrollers

FDTI Vinculum II Second Generation USB Controller Chip is a user programmable 16-bit microcontroller supported with a free ‘C’ language Vinculum Software Tool suite and libraries.
With a gazillion of cheap USB devices abound, one may find it hard to believe why microcontroller fanatics seem to generally ignore these devices in favor of home brew equivalents that eventually cost more.

The truth is, they have good reasons to be so. USB devices are cheap, but they require unwieldy programs to set up (and put in use). In fact, the memory and processing power of a typical 8 bit microcontroller running as a USB host may be easily overwhelmed by just the required USB housekeeping functions. Not to mention the long patience and endurance you have to put up if you have to write these routines yourself.

VDIP2 Vincullum compact development development modules has DIP style I/O pin-out layout, and features two USB ports, one of which can be programmed by the user either as a host or a slave interface.
A friend teaching at the University of the Philippines tipped me off about a chip that makes it relatively easy to interface USB devices with a microcontroller, albeit to a limited extent. FDTI, as it turned out, has for years already have a programmable USB Host solution, the Vinculum Chip VNC2.  A chip with VNC2 features had been in my wish list for quite a while. Why I never heard of it before still baffles me.

VNC2 Debugger/Programmer module is necessary if you plan to develop a specific application yourself or has to program the chip the first time. Otherwise, an ordinary USB flash disk is all you need to perform a firmware upgrade.
Fueled with excitement, I got hold on a pair of V2DIP2-48 and debugger module kit ordered from an on-line distributor for a quick test drive. I assembled a test platform with an on board regulator (to protect it from myself) and a port for a RS-232C converter, and loaded the V2DIP2 module with the latest V2DAP firmware. I used a PC running windows hyperterminal software as the control console.

USB Flash Disk

V2DAP allows you to access and manage the flash disk content using human readable DOS-like command. You can examine the disk directory, create and delete files and subdirectories, check disk parameters, and of course, read from and write to files in ASCII and binary format. It is as easy as it can get. No more FAT, sectors, protocols, etc. to worry about. The VNC2 chips allows control and data transfer via UART, SPI, or parallel FIFO Bus.

Being a DOS user for a good part of my life, I felt nostalgic after the D> prompt appeared a moment after I plugged a USB flash disk. The commands are not exactly DOS alike, but are close enough. Hobbyists who long for an easy USB Flash Disk access will instantly fall in love with the VNC2. 

Keyboard, Mouse, and Joysticks

V2DAP also readily accepts HID devices, but you should not expect these to be a plug and play experience.  I am not familiar how HID devices transmit their data, but based on the three devices I tested, there seems to be no common format. Light hacking is probably required. 

A CDR-KING (Extreme Flight) USB joy stick streams out a binary data whenever I move or press a function button in the joy stick. A data pattern shows up easily. I could tell immediately which portion describes the joy stick analog X-Y readings and the key status.

Next, I tried an A4Tech USB Mouse. As expected, a stream of binary data is dumped every time the mouse is moved or a key is pressed. I made no effort at this point to make sense of this data, but it should not be hard to decode this.  

Finally, an A4Tech USB Keyboard was plugged in. I was expecting the VNC2 to churn out something whenever I press a key, but that was not happening. Some keys were unresponsive while others results in funny character outputs. I suspect the USB keyboard requires an initialization of sort to start up. I will work this out soon.

Bluetooth Dongle and USB GSM Modem

A functional evaluation module was quickly assembled using prototyping PCBs and a few extra components. The VNC2 debugger module is shown in this photo installed on the VDIP2 development module programming port. A e-Gizmo UART TTL to RS-232C conversion module is used to connect the VDIP2 module monitor port with a PC (through a COM port) running hyperterminal software.
I can imagine how you folks would want to make these devices work on your micro, but it appears we still have to wait. As of this time of writing, FDTI has no VNC2 libraries that will allow us to interface those cheap USB Bluetooth and Modem devices with our micros. I tried CDR-King Bluetooth dongle, it listed as unrecognized. Same thing happened with SmartBro GSM Dongle. A let down, I’d say.

USB Devices using FDTI USB to UART Bridge

The V2DAP will read data from any USB Device using FDTI USB to UART chips. Examples of these devices may include USB GPS Dongle, Bar code reader.

Coming Soon: e-Gizmo USB Host Controller

VNC2 offers microcontroller junkies an easy and affordable solution to interface a number of USB devices with their devices, notwithstanding the limitations as described. e-Gizmo is now working on a USB Host kit based on this chip. This is slated to be available to the local hobbyists before the end of May this year. Before the release date, I will write a separate blog on how to use data coming from a USB Joystick, USB Mouse, USB Keyboard, perhaps plus a few more devices.  

e-Gizmo USB Host Controller Module based on the VNC2 Chip is current under development. First few units may be available for sale by end of May, 2011.
    















No comments:

Post a Comment