Why I’m Excited That Microchip Is Buying Atmel

Computers & Mobile Maker News Technology
Why I’m Excited That Microchip Is Buying Atmel

Sega vs. Nintendo, Mac vs. PC, Android vs. iOSโ€ฆ the tech industry has spawned its fair share of โ€œholy warsโ€ย in our time. But thereโ€™s one thatโ€™s had Makers and embedded engineers up in arms since the nineties โ€” the war of the 8-bit microcontrollers: Microchipโ€™s PIC vs. Atmelโ€™s AVR.

With Wednesdayโ€™s announcement that Microchip will purchase Atmel for $3.56 billion, is the war finally over? What does this mean for the future of embedded development?

Probably not much in the short term. Microchip and Atmel will continue to produce and provide support for their existing devices well into the future, since, well, theyโ€™re in everything. In your home, in your car, in your pocket โ€” Microchip has shipped over 12 billion PICs to date, and the Atmel megaAVR is the chip that powered the first Arduino, which introduced scores of Makers to the world of physical computing.

Thereโ€™s a lot of promise here though. Microchip/Atmel have the the opportunity to combine the best of the AVR and PIC worlds into an awesome microcontroller platform. Despite the growing popularity and decreasing cost of powerful 32-bit ARM chips, there are still plenty of applications where 8 bits are all you need.

So what are the differences between PIC and AVR, and do they even matter? If youโ€™re just starting out in the world of embedded software, youโ€™re probably good to go with an Arduino board and its easy-to-use tools. But when you want to take the next step โ€” turning your prototype into a production-ready device, or building timing-critical applications โ€” youโ€™ll have to make a choice.

AVR: Open Source, Maker Friendly

Arduino_Uno_-_R3

If youโ€™ve used an Arduino before, youโ€™ve already programmed the AVR โ€” itโ€™s in the Uno, Pro, Mega, Gemma, LilyPad, Leonardo, Diecimilia, Duemilanove, and more. It’s popular with Makers because it’s been embraced by the open-source community. If you want to get started with standalone AVR programming, all the tools you need are available for free, for all operating systems. AVR-GCC is a full-featured and well-supported C compiler (if you use a Mac, setup is as easy as installing CrossPack), and the AVRDUDE utilityย lets you upload your code to an AVR microcontroller using one of many programming devices like Atmelโ€™s official AVRISP mkIIย or Sparkfunโ€™s Pocket AVR Programmer.

The โ€œRโ€ in AVR stands for RISC: reduced instruction set computing. What that means is that if you ever want to get your hands dirty with some assembly language, youโ€™re gonna have a blast. The instruction set is both well-suited for C compilers and straightforward enough to allow hand-coding of time-constrained routines. Thereโ€™s a sizable number of awesome AVR projects out there that do amazing stuff with assembly language: Linus “lft” ร…kessonโ€™sย Craft, Phasor, and Bitbangerย demo boards, the Uzeboxย game console, and my own Terminalscopeย project that can let you browse the web on your oscilloscope.

Unfortunately, where the AVR falls short is in bang for your buck. The ATmega328P, heart of the Arduino Uno, costs $3.70 for a breadboardable DIP package. This gets you 32K of ROM for your code, 2K of RAM, and 23 I/O pins: six of which can be used to read analog voltages, and six of which can output PWM signals for driving motors or fading LEDs. If you want more pins or more memory โ€” say, 16K of RAM and 32 I/O pins, in a 40 pin DIP package โ€” youโ€™ll have to upgrade to the ATmega1284, which will run you a whopping $7.67! If youโ€™re OK with surface-mount soldering, there are cheaper options with more exotic peripherals like onboard USB, but youโ€™ll find similar parts from other manufacturers at a tiny sliver of that price.

โ€œThereโ€™s a PIC for thatโ€

mplabx

Before Arduino, the Microchip PIC was the chip of choice for hobbyists and professionals alike. Their product lineup is huge, theyโ€™re packed with peripherals, and theyโ€™re dirt cheap. Want 28 analog input channels in a DIP package? The PIC16F1717ย is $2. Want to make something cool that talks to your computer over USB? PIC16F1454, $1.40, no extra components needed!

Microchip has put some pretty interesting peripherals in their PICs that can reduce or eliminate the need for external components, potentially reducing costs further. Many have onboard digital-to-analog converters (DACs) for generating true analog output voltages. The Complementary Waveform Generator can simplify driving of DC motors. And the Configurable Logic Cell is kind of like a tiny FPGA: it can perform simple operations (AND, OR, XOR, and more) on input signals and route them to outputs without any intervention from the main processor โ€” even in sleep mode.

So PICs are dirt cheap, widely available, and have plenty of cool stuff on board โ€” whatโ€™s the downside? Why was it the AVR that rose to megastardom in the Maker microcontroller revolution of the mid-2000s and not the PIC? Many would say that itโ€™s the tools. While there are numerous free and open-source tools out there for AVR development, if you want to program PICs, youโ€™re gonna need to use Microchipโ€™s software and hardware.

Until a few years ago, this restricted PIC development to Windows users only. Microchipโ€™s current integrated development environment (IDE), MPLAB X, is built on the NetBeans platform, and runs on Windows, OS X, and Linux. The download is a hefty 500+ MB. The user interface can be daunting, with its array of toolbars, sidebars, and configuration dialogs. If youโ€™re more of the command-line type, itโ€™s possible to use a script buried deep inside the MPLAB X app bundleย to upload code to your chip.

Unlike the AVRโ€™s clean RISC architecture, the PICโ€™s memory is segmented into banks of 128 bytes, only one of which can be active at a time. This arrangement has hindered the development of open-source compilers. The Small Device C Compilerย is the only one that Iโ€™m aware of. Iโ€™ve used it to produce working results, but it may not support all features of the latest chips, and has some bugs. If you want to program a PIC in C, your only other option is Microchipโ€™s XC8ย compiler. The free version doesnโ€™t perform any optimization on your code: if you want to build the fastest code possible, youโ€™ll need to buy a Pro license, which will set you back a thousand bucks. A justifiable expense for a professional engineer thatโ€™s shipping a million devices, but sadly out of range for most hobbyists.

As far as device programmers go, the PICkit 3ย ($50) is the only device guaranteed to support the latest PIC models. They can be tricky to set up (mine wouldnโ€™t work with my Mac out of the box, and I had to use a Windows PC to upgrade its firmware) but do the job just fine.

The Future

Iโ€™m dreaming of Microchip/Atmel releasing aย new generation ofย microcontroller with the AVR architecture, open-source toolchain,ย and the PICโ€™sย wide selection of peripherals and low price โ€” but is it too late? 32-bit ARM Cortex-M devices, such as those in the Teensyย and Arduino Due, are poised to take over the low-end market, and full-featured Linux systems like the Raspberry Pi Zeroย and CHIPย can be bought for a handful of dollars. But thereโ€™s something to be said for the sheer simplicity of the 8-bit micro. You can learn everything there is to know about one in a few weeks. Squeezing every last drop of performance out of a chip โ€” counting clock cycles, writing hand-tuned assembly language, slicing off instructions to get your code to fit on a cheaper part โ€” these are what keep me and countless other hackers excited about embedded development.

Tagged
Matt Sarnoff

Matt Sarnoff is the lead firmware engineer at Glowforge. He's been tinkering with microcontrollers large and small for nearly ten years.

View more articles by Matt Sarnoff
Discuss this article with the rest of the community on our Discord server!

ADVERTISEMENT

FEEDBACK