This is a fascinating concept. We’re not sure of its usefulness, but it definitely stands on its own just for the concept. [Dean Camera] just added a new HID class to the LUFA project that lets you flash AVR chips by printing to them. This means once you have a file like the one seen open in Notepad above, you can just click on File, then on Print, and the firmware will be uploaded to the chip.
[Dean] is the creator of the LUFA project and still likes to get his hands dirty hacking around with it. This idea came to him while he was exploring the concept of using the MIDI protocol to program a chip. That didn’t pan out because of the way Microsoft has handled MIDI in newer versions of Windows. But he did get the idea of making LUFA identify itself as a simple USB printer. He dug into the specification and figured out how to do that. Once Windows connects to the device it doesn’t really care what data gets sent to it. So [Dean] wrote a parser for the bootloader which could accept the incoming hex code and write it to the chip’s program memory.
This is…… awesome. No, really. I can’t imagine how much time this would save me in some projects.
Fascinating! That’s a really neat concept.
that will make it universally programmable even on a mac as long as it shows up as a printer you can flash it.
if it is like the netv http://adafruit.com/products/609 all the software lives on a fat 32 formatted micro sd card like your cameras use so if you can get a card reader you can then copy the files.
Now where is the PIC version of it? :)
Giving to notepad the feature of a full blown IDE without adding software to the host.
Simple but brilliant.
Why is it better than presenting it as mass storage to which you store a firmware file? That’s how Freescale ARM FRDM dev boards work.
I’ve got you covered there, I also have a Mass Storage version:
http://fourwalledcubicle.com/blog/2013/03/the-new-new-lufa-bootloader/
As well as the older CDC (serial), HID and DFU class bootloaders.
It is better because it’s a hack! This is hackaday after all.
Emulating a printer is likely easier than emulating a block device with a FAT32 filesystem on top of it, too.
Probably not a PIC version of this as the guy who wrote it works for ATMEL perhaps? Just saying….
Movie plot gimmick. That actually works!
Now, here’s a though… would it work over a cheap USB network bridge?
Dean’s a great hacker. Atmel is lucky to have him on board.
Love this hack! Poking the box like this is why I enjoy HAD so much.
God only knows how many times people will print hex code on paper by mistake… or send PDFs to LUFA :D
Echo said:
“God only knows how many times people will print hex code on paper by mistake… or send PDFs to LUFA :D ”
The HAD way to encourage code documentation? :D
Please stop calling it HID class. Printers are NOT human interface devices. HID refers to mice, keyboards, gamepads, and other buttons-and-knobs-and-blinky-lights devices. Printers belong to the printer class, not the HID class.
Well, you better tell the USB spec designers that, HID class 7 seems to have an awful lot to do with printers…
If you mean HID usage table #7, then no, that’s keyboard/keypad usages. If you mean USB device class 7, then yes, that’s the printer class. Not the HID class. It’s a USB device class, but it is not equal to or part of the HID class. All HID-compliant interfaces have interface device class set to 3, while all printers have interface device class set to 7. They are different things; printer class is USB, but that does not make it HID.
Wow, I feel silly. I actually design+program microcontroller systems for actual printers, and so use this exact method all the time… on printers. It never once dawned on me to use this method on non-printer devices!
Although alternatives exist for USB-enabled MCUs (E.G. DFU specification or mass storage class), printer ports can also be set up for serial or parallel ports. Very nice.
HP came up with this before (and yes, they regreted it):
https://www.youtube.com/watch?v=njVv7J2azY8&list=PL218D0B7DFB6EF37A
Just in the spirit of pedantry, HP’s implementation was markedly more complex, at least on their nicer printers. Since the printer has a full PCL/PJL implementation(sometimes Postscript as well) you can send it full programs, with reasonably alarming capabilities, just by ‘printing’ them(such programs can result in printed output; but tend to suppress that, since nobody wants to waste paper spewing an entire firmware update). Effectively, the printer’s OS would execute, with full permissions(since there wasn’t a permissions model) any commands sent to it, with ‘security’ being provided by the assumption that well-behaved users would only send commands that printed documents, rather than performed filesystem operations or other shenanigans.
Since HP’s printer security model is somewhere between ‘pitiful’ and ‘nonexistent’, the full power of the PCL/PJL environment was available to anybody with the ability to send a job to the printer. Pretty much analogous to take a knife to a gunfight, or a traditionally-single-user OS without filesystem permissions to the public internet.
The system in this hack is much simpler, no interpreter involved, just a way to dump a data blob directly to storage(and, thankfully, since there is no ‘hook it up to the office LAN and let everybody have access’ use case for a microcontroller being flashed’ the total lack of access control isn’t an issue, unlike the HP case).
As I’ve understood, now the MCU programs itself with a firmware downloaded by printer protocol. So I’m waiting for a printer interface based programmer which will program other chips this way.
Really shouldn’t be all that difficult to mod his code to program other chips one would think.
this is brilliant. nothing else to say, except hopefully someone does a PIC version
Google Cloud Print anyone?
very cool hack, but Windows printing is not practical method for programming chips. what if you send a document to it by mistake? bricked chip is what,
No, because it will not recognize Intel HEX format and not program the chip (if developer had any sense when writing it)
Brilliant! Any reason this couldn’t be used for transferring 3d printing models as well?
Brilliant idea! It is really excellent.
Dean is a clever guy and a kind person, no wonder he came up with this awesome idea.