Drobe :: The archives
About Drobe | Contact | RSS | Twitter | Tech docs | Downloads | BBC Micro

Driver for USB IO kit started

By Chris Williams. Published: 7th Mar 2006, 23:40:09 | Permalink | Printable

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

Previous: Middleton battles 'misinformation'
Next: BBC Micro ARM7 co-processor available

Discussion

Viewing threaded comments | View comments unthreaded, listed by date | Skip to the end

I built one of these boards over xmas, as well as the programmer. Cool to see them making their way to RISC OS as well.

 is a RISC OS Userpiemmm on 8/3/06 7:49AM
[ Reply | Permalink | Report ]

Fantastic, I'll be able to get out my boxes of scavenged electronic components which have sat in a cupboard since I used to hook them up to the BBC Micro's user and analogue ports. I never had much sucess getting complex (or even fairly simple) circuits to work, but I did managed to control motors, detect switch inputs, and display analogue meters on screen. It should be enough I/O to recreate a lego clone of the Beebs floor turtle everyone yearned for back in the 80s, but cost the earth.

 is a RISC OS Userdruck on 8/3/06 9:22AM
[ Reply | Permalink | Report ]

I've put the first Castle stack version up on my web site just now. [link]

 is a RISC OS Userdavehigton on 9/3/06 9:38PM
[ Reply | Permalink | Report ]

... and I've added the Simtec version too.

 is a RISC OS Userdavehigton on 10/3/06 10:16PM
[ Reply | Permalink | Report ]

Please login before posting a comment. Use the form on the right to do so or create a free account.

Search the archives

Today's featured article

  • Being a DJ with RISC OS
    The people want entertaining. Jon Wright has the solution
     36 comments, latest by jonix on 25/11/03 10:42PM. Published: 22 Nov 2003

  • Random article

  • Synthesizer control app now 32bit safe
    Yamaha XG-type utility Debbie also supports Mico and RiscStations
     Discuss this. Published: 6 Nov 2007

  • Useful links

    News and media:
    IconbarMyRISCOSArcSiteRISCOScodeANSC.S.A.AnnounceArchiveQercusRiscWorldDrag'n'DropGAG-News

    Top developers:
    RISCOS LtdRISC OS OpenMW SoftwareR-CompAdvantage SixVirtualAcorn

    Dealers:
    CJE MicrosAPDLCastlea4X-AmpleLiquid SiliconWebmonster

    Usergroups:
    WROCCRONENKACCIRUGSASAUGROUGOLRONWUGMUGWAUGGAGRISCOS.be

    Useful:
    RISCOS.org.ukRISCOS.orgRISCOS.infoFilebaseChris Why's Acorn/RISC OS collectionNetSurf

    Non-RISC OS:
    The RegisterThe InquirerApple InsiderBBC NewsSky NewsGoogle Newsxkcddiodesign


    © 1999-2009 The Drobe Team. Some rights reserved, click here for more information
    Powered by MiniDrobeCMS, based on J4U | Statistics
    "I see Drobe'll suck up any old s*** as news?"
    Page generated in 0.0662 seconds.