Hackaday Prize Entry: BS Free USB

Take a look at some old electronics magazines, or even a few blog posts from 10 years ago, and you’ll notice something strange: parallel ports. Those big ‘ol DB25 were the way to get bits out of a computer and into a microcontroller. There was a reason for this: it was exceptionally easy to do.

Now, we have USB to deal with, and that means VIDs and PIDs, drivers, enumeration, and a whole bunch of cruft that makes blinking an LED a surprisingly complicated process. [Colin O’Flynn]’s project for the 2015 Hackaday Prize aims to fix that with BSU – BS Free USB.

Instead of USB to serial chips attached to another microcontroller, [Colin] is using a few microcontrollers with a built-in USB interfaces. These chips are loaded up with firmware and controlled with a simple API on the computer side. If you want to blink a pin, just add a library to your project and set the pin high. Want some SPI on your computer? That’s just setting a few pins as MOSI, MISO, and SCK and typing in a few bytes. It’s basically a $2 Bus Pirate that you can stick into any project.

If [Colin]’s name sounds familiar in the context of The Hackaday Prize, it’s because he won second place with the ChipWhisperer last year. While a tiny USB thing isn’t quite as cool as a tool to break embedded encryption, the BSU certainly seems more useful to millions of hardware tinkerers around the world.

The 2015 Hackaday Prize is sponsored by:

29 thoughts on “Hackaday Prize Entry: BS Free USB

    1. I would disagree. If you’re making something for hobby then you’re making it in very low quantities. As I mentioned below, you can get native USB enabled MCU for $2 on eBay. Why bother with stuff like V-USB when you can have a real thing for a dollar or two more. In quantities of 1-5 price difference doesn’t affect you much. Advantage is if you decide to make your build commercial it is ready.

    2. V-USB has a lot of limitations. It wastes a lot of CPU cycles servicing USB messages and can be nondeterministic if your application is some what real time requirement. There are also issues coexisting with other interrupts.

      The Low Speed has a lot of restriction imposed by the USB standard because USB bus slots are shared so they don’t want a low speed device to hog the time slots. You are limited to 8 bytes interrupt messages and only allow to transmit 1 per 10ms. Also no bulk pipes which basically limits your option of what you can implement.

      Microcontroller with native USB hardware are now price competitive with your average microcontrollers even at QTY 1 from digikey. If your soldering and PCB skills are up to date, then there are some below $1.

  1. What made using parallel ports so easy was that you could write/read directly to/from the port (0x3BC, 0x378, 0x278) with practically any software platform – even M$ Qbasic or Quick Basic or whatever it was.

    That ability ended with Windows XP (more than 10 years ago) as it doesn’t support direct port writes so all the ports are virtual ports and you have to use the Windows API to access them. Coding with the Windows API is a right pain in the … Perhaps it’s easier in some of the M$ platforms like VB or .NET but I have never used those. I have an allergy to M$ code.

    Interesting project. The only way I can have parallel IO is to have a big shift register hanging off a USB to Serial. Or more often I use something ending in ‘duino and hang a big shift register off that in CPLD. At least then I can use a terminal emulator like Hyper Terminal and dump binary files to the USB serial.

    It will be interesting to see how easy it is to code for this BSU and what platforms it supports.

      1. His street cred went to zero when he said “Hyper Terminal”.

        I’m convinced the only reason that Hyper DooDoo shipped with Windoze was because the owner has pictures of Bill Gates doing obscene things with goats in a pasture under a full moon.

    1. Never used s parallel port, but serial is easy in windows api, it’s just a special file you open, read and write to it with a stream, similar to Linux. .Net has a special wrapper class as well for serial ports.

    2. A small code change to use giveio as a driver opens up direct port access in XP. I don’t know if there is a method for later OSes. In Linux you can just mmap the device area.

      1. I’d like to have direct RS232 port I/O under XP so I could run the old DOS control software for a proLIGHT PLM2000 CNC milling machine.

        It *almost* works. I can get 2-way communication going and use the manual move functions in the DOS software but when I try actually sending out G-code, XP butts in and interrupts the COM port connection.

  2. I was using 18F2550 for USB stuff, $2 for MCU with native USB support is very nice price. I’m glad to see that Microchip made even smaller MCU with USB support. I hope they (or Atmel) will make 8pin USB-enabled MCU.
    Parallel ports are ancient technology nowdays, but if you have some CNC machine that requires it then USB->LPT is a very nice thing to have.

  3. But it is still USB and you still require an MCU with some USB firmware in it with the required Vendor ID, Product ID.
    It is why Raspberry PI are so nice: a computer with I/O that can be controlled without USB.

    Makers should campaign PC manufacturers to give us back direct I/O on our PC.

    1. Exactly. He is dealing with the VID/PID headache by sell you stuff. There are chips e.g. Most USB-serial chips let you use their pins as GPIO. FTDI even make FIFO parts that you can talk to. So nothing new other than a me-too I want to sell stuff.

      On your own embedded linux computer you can even assign PID/VID all you like if your application requires addition uC hanging off the USB for real time or specialized I/O e.g. ADC, DAC, SPI, PWM. The cheapest ones right now are the sub $10 RT5350 based routers that can run OpenWRT. They come with USB, Ethernet and wireless.

  4. I still use parallel port just for its ease of use and convenience. I’m constantly told you can’t get new computers with parallel and serial ports. This is bull. I built a new AMD quad core based computer less than a year ago and the motherboard I bought has both. I recently got anew HP laptop that has a serial port on it. They are still there all around and still useful. Each technology still has its usefulness.

    1. This. Exactly.
      If you’re buying computers off-the-shelf, then you will never see an RS-232 or LPT port again. However, every computer I have built since 1991 has had at least an RS-232 header on the motherboard, and any that I have built for myself have had it broken out to the back panel. It’s also not hard to find motherboards LPT headers these days, though they are not as common as they once were.

      1. Typically, these legacy ports need to be hung off the LPC bus somehow. I’m not sure how much longer it’ll stuck around in consumer apps through.
        I think there is part of the PCI spec about forwarding the legacy bus IO range and having a card that can pick up those cycles, but it’s been a while since I’ve had to dig through he spec for anything other than config space registers.

        Both these solutions are an extra cost and I think it may threaten MS logo certification. I believe they were part of the driving force behind the legacy free PC standard.

    2. me too, lavabit still sell pci dual parallel cards. The real problem is most the ones on the market use the MOS chipset which has a error in the reference manual around EPP mode I think (not the lavabit cards though). Im currently using all 3 of my ports on that machine (one onboard, two on pci card) and its controlling my cnc milling machine with linuxcnc.

  5. so, what we need then is a PCIE 1x card that breaks out into some bidirectional io. direct port access.
    ohohoohoho go totally retro and use jumpers to set the base address!!!! hahahaha.

    must be a pcie to pci to isa bridge chip around somewhere….

    1. +1 for jumpers or DIP switches. Set it and forget it, make Windows use the settings YOU want, not whatever it thinks it should use.

      Remember the early “Plug and Play” that didn’t work very well? Windows 95 had some nasty issues with it where if you set in BIOS for PnP OS installed it would not only assign different resources to some devices than showed in BIOS, it would not allow them to be manually assigned. Change PnP OS in BIOS to NO and it would either PnP correctly or would allow the resources to be manually set to the correct ones.

      That problem mostly happened with PnP ISA devices, especially sound cards. WTH Microsoft didn’t code Windows to preferentially assign the standard Sound Blaster IRQ’s DMA and port ranges to audio devices… Nooo, it always insisted on giving IRQ5 to another device and PCI Holder for IRQ Steering – then have them conflict, and assign IRQ 7 or 10 or 11 to the sound card to conflict with the LPT port or USB or something else, and disable the sound card due to the conflict. It was Plug and it Don’t Play.

      Same thing if you were using old cards with jumpers. Had to disable PnP OS then if Windows didn’t correctly assign things (which it was more likely to do right with non-PnP hardware) just had to use Device Mangler and *set them right* and usually they would stay – though there was one fairly common non-PnP sound card Win95 kept insisting on changing from the standard resources so the easiest solution was to change the card jumpers to what Windows demanded then shuffle other hardware settings around to accommodate – or convince the PCs owner to upgrade the sound card to one Windows would play nice with. “Every slot is in use, every IRQ and DMA is in use. Windows won’t leave the sound card IRQ and DMA where I manually set them so all you can do is change the sound card to this one which I know it doesn’t have this problem with.”

      1. LOL, We called it “Plug ‘n Prey”.

        That’s why there were three versions of Win95, ‘A’ the buggy one that had lots of problems with drivers and P’nP, ‘B’ which had most of the bugs from ‘A’ fixed and ‘C’ that had more drivers and some extra bug fixes.

        Win95 (and 98 and ME) were sill windows running on a DOS platform so you could still use Port addresses and IRQ’s. XP was DOS shell only (dos box) under a Windows platform so there was no access to IRQ’s, Ports etc.

  6. I still use parallel ports on old computers, which I just lend to people to run an experiment on :) Works great with any DOS, boots quickly, no timing problems. These days you must buy an Arduino to check a pin :( But if people INSIST on using OS X or WinLatest to check few pins, I’m glad to charge them more :)

    1. I collect and refurbish old computers and put linux on them and use them for teaching kids how to program microcontrollers. A P-4 with 1GB of ram is more than enough machine to run a decent linux distro with a GUI, some schematic software, and an AVR toolchain. And they have all the ports you need including parallel, serial, and usb.

      1. In fact, an old IBM T20 (P3 700, 256 MB RAM) notebook is powerful enough to do this as well. I collect older notebooks, because these usually have serial port, parallel port and the newer ones have USB as well…

        1. Very true. I have a stack of p-4 class notebooks with all the requisite ports on them in fact. I do have some older ones, including an old p-3 that has a docking bay along with tv capture and tv output on the computer itself. That’s a special keeper.

  7. Why not Ethernet then? CPUs supporting it are getting cheaper, its protocol stack is open, you can add layers (whose code is open as well) to let data travel on the internet, it’s realtime and in many contexts faster than USB (think latency, not pure speed), broadcasting or multicasting data is supported by design, going wireless is ultra simple, wires can be much longer than USB, etc.

      1. Gah! Forgot to say, doing that makes your parts count go up.

        Looking at his little toy, it seems he is using V-USB which, while it works mostly and cuts your parts cost way down with the right microcontroller, has its issues as well. Using ethernet tends to kick your parts count up. And most chips that support ethernet are not real friendly to through hole/dip stuff.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.