ARM Cortex M0+ by NXP announced for $0.39

Available in DIP8 and TSSOP packages, this 32bit microcontroller is based on the Cortex M0+ core, targeting the 8 bit market and could be a strong competitor, with an announced starting price of $0.39.

One of the nice features is the internal matrix, allowing to access internal features (UART, SPI, timers etc) on almost any pin.

More about the chip specifications on

Source: Adafruit

Building avr-gcc for C++11 on Mac OS

Yesterday I saw that the support of C++11 has been added in GCC 4.7. Since avr-gcc is just a special configuration of gcc itself, it is then possible to build AVR programs using C++11. Of course, the standard library will not be available, but the language itself has some interesting features.

Since I don’t have the latest avr-gcc on Mac OS, I confirmed the theory by building a test program on the Raspberry Pi (equipped with avr-gcc 4.7.0). Yup, it works.

The latest available version of avr-gcc on Mac OS 10.6 is either 4.5.1 (using CrossPack) or 4.7.0 (using MacPorts). I could use MacPorts, but I don’t like the fact they install everything into /opt/local, it doubles up with the /usr/local directory where I usually install cross-compilers etc. If you want the easy version, go for the MacPorts solution. Otherwise, read on and hold tight..

Building the AVR toolchain from scratch on Mac OS

The complete toolchain is composed of three parts:

  • The compilers (avr-gcc, avr-c++ etc)
  • The binutils (avr-size, avr-objcopy etc)
  • The C library (avr-libc containing all the includes and precompiled libraries

The installation process in described on the avr-libc webpage.


I’m assuming you have the following tools installed on your machine:

  • Xcode development tools (my version is 3.2.6)
  • MacPorts (to fetch the libraries we need to build gcc)

Getting the sources

The gcc sources are hosted on FTP servers, which can be quite slow. I used SVN instead, with the following command:

svn co svn://

The sources for the binutils can be found here, and the sources for the avr-libc can be found here.

Building the binutils

Before building the binutils, you will need to apply a patch to add AVR support to the avr-size tool. Here is the patch released by Atmel, however it failed to build on my machine, and I had to apply another one.

Requirements for the compilers

To build gcc, you will need the following libraries (for floating-point math):

  • gmp
  • mpfr
  • libmpc (be carefull not to install mpc like I did, it’s not the same thing)

That can be done with the following command:

sudo port install gmp mpfr libmpc

You will also need the iconv library, but the MacPorts version did not seem to work, so you’ll have to build it manually, from the sources. You will also need to copy this patch file to the libiconv-1.14 directory (or whatever version you download).

cd libiconv-1.14
mkdir build && cd build
../configure --prefix=/usr/local/temp/iconv
cd ..
patch --input libiconv_patch_gcc_4.7.2.txt
# when prompted for file to patch, enter build/include/iconv.h
cd build
make install

Here I install it into a temporary directory, since I might not need it later.

Building the compilers

To build GCC, we need to tell it where to look for the gmp, mpfr, mpc and iconv libraries. Make sure you don’t have the iconv library installed with MacPorts, as it will override the one you just built in /usr/local/temp/iconv.

cd gcc_4_7_2_release/
mkdir obj-avr && cd obj-avr
../configure --prefix=/usr/local/avr --target=avr --enable-languages=c,c++ --disable-nls --disable-libssp --with-dwarf2 --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-libiconv-prefix=/usr/local/temp/iconv
make install

Building the C library

If you had an older version of avr-gcc installed, now might be the time to remove it (or at least to remove its path from $PATH), so you can build the avr-libc using your shiny new compiler.

This step is quite straightforward, just follow the instructions and you should be fine.

Building a test program

In order to enable C++11 features, you’ll have to pass the following flag to the compiler:

Now try the following program, demoing the auto variables and range-based for loop:
int main()
    const char foo[] = "Hello, World!";
    char bar[14] = { 0 };
    auto i = 0;

    for (auto baz: foo)
         bar[i++] = baz;
    return 0;

You will notice that we’re returning from main, although it’s considered to be a blasphemy by some embedded developers, what it will do is only continuing executing empty instructions until looping back to the reset point. Anyway, this would not be worth much uploading onto a chip, since there would be no way to check that bar contains “Hello, World!” after execution..

Capacitive sensing for advanced user interfaces

Here’s a very interesting post about capacitive touch interfaces.

Capacitive touch sensing is a popular alternative to mechanical switches and knobs in consumer electronics […]. In traditional designs, capacitive touch sensing is implemented by using a dedicated IC, while advanced user interface features such as proximity sensing, LED dimming, haptics, and liquid level detection are implemented with one or more separate ICs. Using multiple ICs increases board size, BOM cost, and time-to-market. In this article we discuss how to design advanced user interfaces using a single SoC.


Review of devboards and tools

Boarduino by LadyAda / Adafruit.

My first Arduino-compatible board. It’s the clone of the old Arduino Diecimila (with an ATmega 168P), in a breadboard-friendly format. It’s ideal to start with hardware computing and the breadboard format helps interfacing it with sensors and other circuits.


Sanguino by Zach “Hoeken” Smith

I needed more memory and pins than the usual 168P,  so I started using the 644P in the Sanguino, and made it a basis for most of my projects. It has been my main devboard for quite some time, before I made the Mobius Modular board.


Teensy 2.0 by Paul Stoffregen

Graciously donated by Paul for the purpose of developing the MIDI library on the Teensy, I’ve been using it mainly for this purpose. It has the same chip as the Arduino Leonardo, meaning it has native USB HID support.


Teensy 3.0 by Paul Stoffregen

One of my last acquisitions. ARM M4-powered, this little board can be one of the next big things in the ARM devboard race. I don’t think it might be powerful enough to run an OS “comfortably” like the Rasberry Pi, but a small RTOS should not be a problem.Detailed review here.


Arduino Leonardo

I currently use it as a unit test platform for the MIDI Library. The native USB driver in the ATmega32U4 makes it a good board to experiment with native MIDI USB, to create plug and play MIDI controllers and synths.


Mobius Modular Motherboard

I made this board to simplify the prototyping of MIDI devices and to be the heart and mind of my Mobius project. It’s using an ATmega 644P and features an IO expander for an LCD screen, as well as a hardware switch debouncer. The central connector breaks out access to 10 GPIO pins.


Raspberry Pi

I feel a bit guilty of using it only as a Git/Web home server, but it’s doing the job quite well. It’s running the Wheezy distro without many modifications. I might give a try to the Adafruit Occidentalis distro to play with the GPIO.


Texas Instruments Stellaris LaunchPad

The cheapest ARM board I’ve ever seen ($4.99 including worldwide shipping), but comes with limitations, as it’s only a demo board. Still, for that price, you get two ARM M4 chips.

Review here.



Open Workbench Logic Sniffer by Dangerous Prototypes

Logic Sniffers are useful when debugging digital circuits, but also for firmware debugging: toggle pins when you enter and leave a function to check how much time you spent inside it! It can also analyse most serial transmissions (when setup correctly, took me some time to get it right).

Bus Pirate by Dangerous Prototypes

Very useful little tool to control almost everything that talks a serial language. Scriptable in Python, so with PySide you can make nice interfaces to analyse, control and hack the world. Note: If you plan to use it as an AVR programmer, prefer an USBtiny or something similar, it’s damn too slow.


Arduino MIDI Library v4.0 beta

I’m starting the beta of the Arduino MIDI Library version 4.0.

It includes the following changes:

  • Support for SoftwareSerial
  • Multiple instances (a merger demo has been added to the examples)
  • Refined build options
  • Support for other targets than Arduino

If you’re interested, you can clone the release/4.0 branch of the GitHub repository, or download the latest snapshot. If you find any issue, please report them to

Active Pickguard project for Kinetis Challenge

Eli Hughes made this awesome PCB pickguard for his entry in the Freescale Kinetis Make It Challenge. It contains a Freescale Kinetis ARM Cortex M4 processor with DSP extensions to process the guitar signal, providing both an analog and digital audio output.

He also release a video with the details of all the maths and physics explained, as well as the hardware design.

Code and schematics are available here.

Arturia MiniBrute review by Portishead’s Adrian Utley

Here are Portishead’s guitarist Adrian Utley first reactions to Arturia’s MiniBrute analogue synth. Adrian’s got it hooked up here to his Maestro Echoplex EP-4, running into a Universal Audio 6176 channel, to recreate the dark ambiance that makes the Portishead signature.

Looking forward to hear it on their next album!

Thanks to Yves Usson for sending me this video 😉