As your embedded applications get more complicated an On-Chip Debugger will save you a lot of time when things don’t run quite right. On-Chip Debugging (OCD) is just what it sounds like — a way to run your program on the target chip that lets you pause execution to examine values and change them if need be. The Arduino has no built-in method of using OCD, but the AVR chips used by the boards do. The caveat is that you need a proper AVR programmer to access the Debug Wire protocol, or a JTAG interface for some of the larger chips. In this case I’m going to be using an STM32 Discovery Board to give you an overview of OCD. But this will work the same way for any chip that has hardware debugging capabilities. Many IDE’s have debugging support built right in so that you can use a nice GUI as you work. But often these are just a front end for the command line tools I’ll be using. Join me after the break and we’ll get started.
linux714 Articles
Machine Offers Cheap Advice – Charges More For Something Profound
[Nick Johnson] recently wrote in, sharing a neat project he put together in his spare time.
Our readers are most likely familiar with the ubiquitous “fortune” program that ships with many *nix distros, offering cheeky comments and quotes with the press of a button. [Nick] thought it would be cool to build a fortune telling machine using the app, resulting in the handsome device you see above.
The laser-cut wooden case is home to a Raspberry Pi which does the heavy lifting, a coin acceptor, an LCD screen for displaying the device’s status, along with a SparkFun thermal printer. Upon feeding the machine some money, the user can press the “Advise Me” button, prompting the RaspPi to present a printed fortune from its vast database of sayings. [Nick] took some time to do some rough categorization of the fortune databases, enabling the machine to offer more substantial content as the user inputs more coins.
Check out the video below to see [Nick’s] fortune telling machine in action.
Continue reading “Machine Offers Cheap Advice – Charges More For Something Profound”
QR Code Opens Doors To You

[Jeremy Blum] wrote in to share his LibeTech QR Code Door Lock project. He developed it during his Senior year at Cornell University along with three of his classmates. It seeks to move away from magnetic card locks in favor of optical locks that authenticate based on a QR code.
The hardware he’s using here is definitely cost prohibitive, but we’re sure the concept could be greatly simplified. In this case a BeagleBone running embedded Linux monitors a feed from a webcam. When it detects a QR code it compares it with a database of approved keys and will unlock the door for you.
There are problems with this technique, one being that an attacker might be able to get a usable photograph of your key without you knowing. But the majority of hotel locks in use right now are even less secure than that. On the upside, the key to your room can be emailed to you for use on just about any device with a screen, or printed out on a piece of paper.
You can find [Jeremy’s] presentation video embedded after the break.
Programming A Propeller On An ARM
[Stefan] uses a small ARM-powered netbook for his development work, so when he tried to play around with the Parallax Propeller he ran into a few problems. The official tools from Parallax are Windows only, and the available 3rd party dev tools are only compiled for x86. After a lot of futzing about, [Stefan] was able to develop on his ARM netbook and wrote in to tell us how it’s done.
Luckily, Parallax released a GCC port for the Propeller, but unfortunately isn’t completely portable to ARM. The Propeller loader for this architecture ambivalent build uses a little bit of SPIN code, which can only be compiled on Intel machines.
To get around this problem, [Stefan] wrote an installer script to gather all the necessary bits of code to his computer. His ARM/Linux toolchain consists of the Propeller GCC, an open source SPIN compiler, and a Python script used to load code [Stefan] found on the Propeller forums.
Now that [Stefan] has a complete toolchain for programming the Propeller on an ARM device, it’s possible to develop for this very cool multi-core microcontroller on his netbook or even the Raspberry Pi.
Raspberry Pi Wedded To A DSLR

This is a Raspberry Pi outfitted in a DSLR battery grip. [Dave H] was very interested in the idea of combining a single-board computer with a high-end camera. The size and cost of such a computer was prohibitive until the RPi came along. He managed to fit the board into the broken battery grip he had on hand, and he already has the prototype up and running.
[Dave’s] alterations to the battery grip allow access to the USB, Ethernet, and Composite video ports. Powering the RPi was a bit of a challenge. He tried using an iPhone charger with four AA batteries but that only provided 4.2V. After going back to the drawing board he discovered he could rework the parts that he removed from the grip, using a Cannon 7.2V 1800 mAh battery. So far he can automatically pull images from the Camera and transmit them over a network connection. But since the RPi is running Linux, there’s a whole world of hacks just waiting to be exploited. What comes to mind first is image manipulation software (like ImageMagick) which has a command-line interface.
[Thanks Christian]
Node.js For Linux Joysticks

[Tim Caswell] has been using gamepads and joysticks to demonstrate his node.js hacks for a long time. The thing is, he has been relying on C++ bindings to handle the hardware while trying to herald the praises of node.js. Why not cut out the middle man and write a joystick driver in node.js? It turns out to be so simple anyone can do it.
Granted, this is not a kernel driver. He’s relying on the Linux kernel to recognize the hardware and provide him with the customary /dev/js0 file which he can then work with. As you can see in the snippet above, he’s looping through code in order to constantly read from the hardware. To get this far he dug through the documentation for joystick packets (yay for open source!) to find that each is made of a 32-bit timestamp, a 16-bit value, and two 8-bit numbers identifying the event type and button or axis.
Once he has the packets, it’s off to the races. Each data type is parsed into an appropriate variable which you can use in the logic of your own program. Don’t be nervous, this will make a great weekend project!
Adafruit’s Custom Rasp Pi Distro Eases Some Pain

Many of you have still not yet received your Raspberry Pi. When you do, you’ll find that there is work to be done in the operating system to get things working as you might want them to. The wonderful folks over at Adafruit have tackled this by releasing their own distribution of Linux for the Raspberry Pi.
Based on the shipped distribution “Wheezy”, Adafruit’s distribution “Occidentalis v0.1. Rubus occidentalis” or “the Black Raspberry” now includes the following:
- Updated to Hexxeh firmware
- 4 Gig SD image (will not fit in 2 G cards!)
- I2C and hardware SPI support
- I2C/SPI modules initialized on boot
- sshd on boot
- ssh keygen on first boot
- runs ahavi daemon (Bonjour client) and is called raspberrypi.local
- Realtek RTL8188CUS wifi support
- One wire support on GPIO #4 when loaded
