Essential Tools for Microcontroller Hackers
This is my list of must-have electronic gizmos for working with AVR and Cortex microcontrollers. It very much reflects my needs and preferences, and your mileage may vary.
The list is likely to grow or change over time.
Alright, no need for a flowery intro. Let’s get to it.
FTDI USB to TTL Serial Cable
http://www.ftdichip.com/Products/Cables/USBTTLSerial.htm
There are a few variants of this cable. Get the one with 3.3V I/O on a 6-pin, 0.1″ header — part number TTL-232R-3V3. It’ll run about $20.
Here’s the pinout:
# | Color | Signal |
---|---|---|
1 | Black | Gnd |
2 | Brown | CTS |
3 | Red | Vcc (USB +5V) |
4 | Orange | TXD (out) |
5 | Yellow | RXD (in) |
6 | Green | RTS |
This cable is handy for all kinds of digital electronics projects. It looks like a normal serial COM port to a PC, but speaks TTL instead of RS-232. The data frames are identical, but the signal levels are friendlier to low-voltage logic circuits. This is exactly what you need to communicate with the USART peripheral on most MCUs.
The cable variant above provides +5V(-ish) from the USB port, which is fine for powering 5V micros, or to feed a low-dropout (LDO) linear voltage regulator for 3.3V systems.
All the I/O is 3.3V, but tolerant of 5V signals, so the cable works equally well with 3.3V Cortex parts and 5V AVRs (for example).
If you need RS-232, this cable can interface directly with many of the popular RS-232 transceiver ICs, like the venerable Maxim MAX232, or my favorite, Intersil ICL3221.
(See also: Intersil ICL3243 for full-featured RS-232, including CTS/RTS, DTR/DSR, DCD, RI, etc.)
But, unless you have a reason to build a TTL to RS-232 interface anyway, you may instead prefer an FTDI USB to RS-232 cable, or one based on the Prolific PL2303, or WinChip CH340 chipset.
These can all be found for $10 or less, and are well supported on Windows (though you might have to search for the driver) and Linux (drivers are in the kernel tree). Probably Mac, too, but I haven’t tried it yet.
EDIT: Hi! I’m from the future, and have since switched to Mac for my primary day-to-day computing needs. In the App Store, there’s a terminal emulator called “Serial” which has bundled drivers for all the common USB chipsets. Everything I’ve tried just works with zero manual intervention. It also supports Bluetooth, which I think is going to be big some day. OK, back to you, past me!
Atmel ICE Debugger
http://www.atmel.com/webdoc/atmelice/index.html
There are a few kits with different cable attachments. Get the full kit, otherwise you’ll probably end up buying the add-on parts later anyway. It’ll set you back $99.
The ICE can speak a whole list of protocols, including JTAG, SWD, and SPI; and supports both AVR and ARM Cortex target MCUs. Consider it a necessary bit of kit for any serious MCU hacker.
There are two interfaces with the same signals, but different pinouts. Both are 2×10 @ 0.05″ shrouded headers. One is intended for use with boards using a standard ARM Cortex pinout (branded as ‘SAM’), the other for AVR style. Here’s what’s what:
# | SAM | AVR | # | SAM | AVR |
---|---|---|---|---|---|
1 | Vref | TCK | 2 | TMS | Gnd |
3 | Gnd | TDO | 4 | TCK | Vref |
5 | Gnd | TMS | 6 | TDO | Reset |
7 | key | n/c | 8 | TDI | Test Reset |
9 | Gnd | TDI | 10 | Reset | Gnd |
The full kit includes an adapter PCB to convert the small 2×10 interface to other form factors: 20-pin (2×10) @ 0.1″, 10-pin (2×5) @ 0.1″, and 6-pin (2×3) @ 0.05″.
There are also two ribbon cables that connect to one of the 2×5 @ 0.05″ interfaces on the ICE. The first has another 10-pin (2×5 @ 0.05″) plug wired straight through, and a 6-pin (2×3 @ 0.1″) extension. The second is an octopus, with 10 individual 0.1″ single-pin headers.
Atmel has spawned a great deal of unique programming and debugging interfaces for their various MCUs, but the one you will probably see most often is the SPI interface used for AVRs, particularly in Arduino circles. It uses a 2×3 @ 0.1″ header with this pinout:
# | Signal | # | Signal |
---|---|---|---|
1 | MISO | 2 | Vcc |
3 | SCK | 4 | MOSI |
5 | Reset | 6 | Gnd |
Saleae Logic
Say-lee… Say-lee-ay… Sall-ee… whatever.
The Logic family ranges from a 4-channel mostly digital logic analyzer, to a mixed 16-channel logic analyzer with simultaneous analog sampling. They aren’t cheap, but they do provide an alternative to a full-fledged oscilloscope — and those aren’t exactly free either.
All the digital pins are sampled at high speed, and the software can decode TTL, RS-232, RS-485, JTAG, SPI, I2C, CAN, DMX, MIDI, and several others.
You also get time-correlated analog waveforms — albeit, at a lower sampling rate. The advantage to this really can’t be overstated. Seeing the analog waveform beside the digital interpretation is very helpful in diagnosing intermittent problems.
It’s still nice to have a real oscilloscope, of course. They’re standalone units with (usually) higher sampling rates, wider voltage tolerance, and probably better performance. But if I had to pick one or the other, I would choose this. For one thing, my ‘scope doesn’t have 16 inputs.
Arduino Uno
http://www.arduino.cc/en/Main/ArduinoBoardUno
Regardless how you feel about the Arduino platform, it really is a fantastic way to get into microcontrollers. The Uno in particular, at a measly $25, should be in everyone’s tool kit.
If you’re new to electronics, buy one of these anywhere electronics and/or hobbyists go to buy things. The native development environment is a bit limited, but so easy to learn, it’s a little ridiculous. Give it like five minutes and you’ll have the hang of it.
Then, graduate to Atmel Studio and learn avrlibc. It gets you close to the hardware while still being easy to learn and use. You can then start building your own projects with bare Atmel AVR ICs, and use the Uno as a dedicated programmer.
When you’ve moved on to ARM, the Uno serves well as a quick and dirty prototyping board. Use it to send TTL or SPI data back and forth, or drive an LCD and display statistics or collected data.
Plus, there are many Arduino libraries out there to help test and demo functionality with next to no effort. Sure beats having to start from scratch, before you decide whether some idea will even work out or not.