Drobe logo

Driver for USB IO kit started


Published on 7th Mar 2006, 23:40:09, source is drobe.co.uk
By Chris Williams

Plus coping with two USB stacks

Velleman USB IO kitA draft version of a driver for a USB based hardware interface board has been produced for the Castle stack. Dave Higton was offered a Velleman IO kit as a challenge by a colleague to produce a suitable driver for. Earlier this week Dave asked for interested RISC OS using electronics enthusiasts to contact him for a copy of the software.

The kit is available from outlets such as Maplin, and is designed to control external devices and instruments from a computer. It features five digital inputs, two analogue inputs, eight digital outputs, and two analogue outputs.

Engineer Dave said: "I have managed to get it to work. But it's not finished yet."

Dave added it should be a straight forward process to produce a version of the driver software for the Simtec USB stack. Up to four units can be used at once on one computer; the limit being due to the way the boards uniquely identify themselves to the host machine.

He explained: "What I have written is a demo programme: click the icons, and watch the digital outputs go on and off - they have LEDs. For a real application, you'd want something different.

"The point of asking people with an interest to contact me is that I may be able to provide information that will help them write their applications.

"The inputs and outputs are quite standard interface levels, except that the digital outputs are from a ULN2803A, which means they are open collector Darlington outputs capable of controlling up to 50V and several hundred milliamps."

Previously, Dave produced a driver for a USB radio and controlled his central heating from an A3010.

Writing software for both USB standards
He has created USB driver software for both the Castle and Simtec stacks, which are software incompatible with each other.

Dave said: "Initialising the USB pipes is entirely different in the two stacks; the Castle one is far easier and less lines of code. The Simtec stack is not well documented in terms of examples, or in terms of a recipe of steps to go through to open, use and close a pipe."

A pipe in this case is a communications channel between the USB stack and a particular piece of functionality in the USB device, along which data and messages are exchanged. Dave also identified a fault in the Castle USB stack which made it impossible to create a pipe to a particular type of device functionality, known as an interrupt mode output endpoint. This was eventually fixed in RISC OS 5.11 allowing Dave to finish his USB radio driver.

He continued: "Sending a USB message is different in the two stacks, but the difficulty is handled by different procedures of the same name and same specification. Sending data isn't hard. Lack of documentation was an issue in both cases, though trial and error was easier with the Castle stack because it deals with streams, very much like file handling, so there aren't many options to try. Much the same comments apply to receiving data."

When a program finishes, it must release the USB related resources which it may have acquired from RISC OS. Dave also found a bug in the Castle stack which causes resources to be wasted when the USB radio is unplugged while the relevant software is still running; repeating this a couple of hundred times would result in the USB system running out of 'handles' - identification numbers attached to acquired resources - which would lead to further problems until the machine is restarted.

Dave continued: "The Simtec USB HID Input module grabs the radio and won't let go, so it is currently not possible to use this application along with a USB keyboard or mouse, for example. However, Matt Edgar at STD tells me that this is being worked on. It wouldn't surprise me if there is a new Snafu [firmware] release in the near future."

Links
Dave's website

Related articles
Early Soundblaster Live Iyonix driver released
Iyonix software speed boost driver released
PostScript 3 driver mulled

This article has been linked to, or is available in the following formats:  
 
 
 
 
 
[Printable] [Digg this] [Blog search]


Design and concept (c) Fudgecake Design, 1999 - 2001. Content (c) The Drobe Team, 1999 - 2006. See www.drobe.co.uk for more information. For non-commercial personal use only.