Microcontroller Choice for the DIY DRO

Saturday, January 14, 2012

Arduino UNO, TI MSP430 Launchpad, FEZ Domino, LPCXpresso and MSP430F2132

The core of the DRO is the microcontroller, so that's where I will start. After some "back of the envelope" calculations, here are the basic requirements:

Input/Output Lines
  • Scales - 4 pins: 3 input lines and 1 shared clock line
  • MAX7221 - 3 pins; hardware SPI would be a large plus
  • LCD (using Hitachi HD44780 controller) - at least 6 pins for 4 bit mode (Clock, Register Select and 4 data lines)
  • Keypad - 8 GPIO pins (input and output) for a 16-key version
  • Stepper drivers - 7 pins: 3x 2 lines (step and direction) and one shared "Enable".
  • UART - 2 lines; hardware UARD would be a huge plus
This adds up to 30 total input/output lines, but the good news is that one some of them are bidirectional, so we might be able to use a shift register. SPI, UART, scales input, buttons and keypad need to be connected directly to the MCU; steppers and the LCD can be hooked up to the shift register. A shift register uses 4 pins for a net saving of 9 pins, dropping the total to 21 GPIO. This creates some head aches down the road, but in a pinch will do.

Microcontroller Parameters

Frequency - this is a tricky subject, since the requirements depend on the implementation, but 16MHz or even less should be plenty.

RAM - for the basic implementation a few kilobytes of RAM should be more than sufficient. Even for the CNC operation the data can be streamed from the host computer on demand,so RAM should not be an issue there either.

Perhiperals - ideally I'd like to have hardware SPI, UART and several timers. The first two save a bunch of head aches, since the transmission is take care of on hardware level, but let me elaborate a bit more on the timers: the MCU will need to provide step signals to 3 steppers at different frequencies, read scales at relatively slow 9 kHz and scan the keys at certain intervals. Doing all this in a single super loop will be tedious and unreliable, especially since the steppers require accurate timing to avoid jitter.

Before going shopping for an MCU I decided to look through my project bins. About 15 minutes of frantic digging yielded 5 options:
  • Arduino - this is a staple of most maker's tool chests with great community support and extensive code base. I already have Arduino UNO (which doesn't have enough IO pins), but Arduino Mega has way more than enough. Mega is based on Atmega1280, a very capable 8 bit MCU claiming 16MIPS performance and provides 6 timers, 4 USARTs and gobs of Flash and RAM, and best of all my local RadioShack has them in stock for $65. My largest reservation agains Arduino, though, is the programming environment: it works great for small "sketches" but large projects turn messy in a hurry.
  • FEZ Domino - this Arduino look-alike packs a punch: 32 bit NXP ARM microcontroller running at 72 MHz, with 62 KB of RAM built in SD card reader, 26 GPIOs and much more. The board uses C# for programming via free version of MS Visual Studio. The board I have has been discontinued, replaced with FEZ Panda with even better specs and 54 GPIOs. It's biggest drawback is the lack of "realtimeliness". It uses TinyCLR, an embedded version of MS .NET framework runs the code in "managed" mode, which makes it a tough sell for application requiring tight control over timing
  • LPCXpresso 1769- this is another ARM microcontroller in this bunch. The board I have boasts 64KB of RAM, 128 KB of Flash, can be clocked at 100 MHz and has every possible perhiperal one could dream of. The feature that in my mind is the most important for this project (besides the silly amounts of computing power and RAM) is the presence of nested vectored interrupts. The larges mark against it is the LPC-Link programmer, locked to Code Red's IDE. The board can be programmed using any standard JTAG programmer though, to be fair.
  • MSP430 - the Launchpad board simply doesn't have anywhere near enough OI pins, and even top of the line chips that can be used with it (MSP430F201x) don't have hardware UART, and only a single timer, so Launchpad is out. The other MSP430 board in the picture is a little breakout board I've designed and build a few years back. It has MSP430F2132 MCU, 32KHz crystal, voltage regulator, bypass caps and LED. It has 24 usable IO pins (which could do in a pinch) but since the board isn't readily accessible it's a no-go as well.

Out of five options I have, the only viable contenders appear to be Arduino (assuming that I will need to upgrade to Mega soon) and LPCXpresso 1769. Initially I was leaning towards the Arduino, since I can start prototyping with UNO and when I finally run out of ports, go to the RadiShack and get a Mega, but after some more thinking I've decided to give LPCXpresso a try for a few reasons:
  • It's costs half as much as Arduino Mega
  • Code Red Studio is based on Eclipse IDE and in my opinion is much nicer than Arduino's IDE
  • It has gobs of power
  • It uses a 32 bit architecture
  • It's ARM Cortex-M3,  which means that there is a ton of devices and more are coming
In the next post I will explain the design of the DRO in a bit more details (hopefully with nice pictures). Meanwhile, I'd be happy to hear your thoughts about my MCU choice

No comments :

Post a Comment