In this post I discuss the idea of a "Universal Microcontroller" - a 40 pin plug in module that can host mcus from a variety of different manufacturers and families. It is based around a standard 40 pin 0.6" wide DIL footprint for convenience and low cost.
The impetus behind this concept is caused by the fact that there are dozens of new microcontrollers appearing on the market every year and by having a common, low cost easy to use module would be a good way to evaluate some of the various product offerings in a breadboard friendly format.
Selecting a Small Microcontroller
There are so many selection criteria - so I will try to target a few of the more important ones
RAM
ROM
POWER
PERIPHERALS
SPEED
SIZE
COST
COMPILER
COMMUNITY
RAM/ROM - these relate to the size of the on chip memory allocations. Most microcontrollers these days tend to have a lot of flash ROM and a lesser amount of RAM.
If you are handling arrays and buffers, then RAM is important - and it is very easy to run short if your device has 2K or less. (Notably Arduino ATmega328).
There are a whole class of tiny microcontrollers, which have less than 1K bytes of RAM. It is more difficult to use these for general purpose applications - and they tend to be used for deeply embedded low end consumer goods, sensors etc.
POWER
A lot of applications for microcontrollers have to be battery powered - so there is a large emphasis on tailoring the application in such a way that battery life is maximised - particularly if you are operating from a coin cell or similar. Some microcontrollers are very power efficient, and have multiple low power modes including low voltage operation.
PERIPHERALS
The microcontroller manufacturer chooses to fit-out a particular cpu core with a certain set of peripherals and it is these which give the microcontroller it's flexibility and capability in handling various applications. An mcu which is lacking a particular peripheral can be very difficult or impossible to match well to a particular application. A rich peripheral set often minimises the amount of glue-circuitry needed to interface to common external devices.
Peripherals may be grouped as follows:
Communications UART SPI I2C USB etc
Timing TIM
Driving PWM
Sensing ADC DAC Comparator
Misc GPIO
These are the basic building blocks - the larger mcus may have sophisticated peripherals for audio, LCD video and external memory interfaces.
SPEED
The clock frequency of microcontrollers has increased steadily over recent years - and many have sophisticated clock control options to allow variable frequency clocking schemes especially for low power operation at much reduced frequency.
Most modern, general purpose microcontrollers will run at up to 20MHz or so. From then on upwards it could be best described as following a 1,2,5 progression:
20MHz AVR MSP430 ARM M0
50MHz ARM Cortex M0+
100MHz ARM Cortex M3/M4
200MHz ARM Cortex M4/M7
500MHz ARM
SIZE
This refers to the word size used by the mcu. Originally dominated by the 8-bit families (PIC, AVR, 8051 etc) these low end microcontrollers are being replaced by much more capable and cost-effective 32 bit parts, generally based on the ARM architecture. The 16bit MSP430 is an interesting exception -and will be interesting to see how this family product line fares in the face of competition from ARM. TI have already brought out their own MSP432 range based on 32bit ARM Cortex M4F cores.
COST
Microcontrollers range in cost from about 35 cents to about $12. These will have flash memory sizes from 512bytes to 2Mbytes and clock speeds that range from 20MHz to over 200MHz. Package sizes from just 6 pins to over 200 pins. Again it might be worth imposing a 1,2,5 scale on your budget - and see just what parts match your requirements.
COMPILER
This is a big factor in choosing a microcontroller. Can I program it easily, and how much does the tool chain cost? Fortunately there are free tools available - including code-size limited or time limited evaluation versions of some of the professional tools. The open source community has done a lot to make microcontrollers more accessible.
COMMUNITY
This has become increasingly important. Is there a good online help forum where beginners can get advice. Is the chosen device well supported by a community?
The Universal Microcontroller
Having selected our microcontroller how do we achieve universality?
About a month ago I reviewed a low cost version of the "Arduino" Nano - made in China using the CH340G USB to serial converter IC. The Nano has a lot going for it - in terms of low cost and compact size. The DIL format makes it easy to use. However it's 8 bit mcu is now showing it's age - especially when there are cheaper, faster and more feature rich 16bit and 32bit mcus available.
Other processors also use this DIL format - such as the "Maple Mini" based on the STM32F103, and my own "ARMiGo" based on the STM32F373 (with 3 x 16 bit differential input ADCS).
Looking further afield there are the Teensy series of boards based on the Freescale (now NXP) MK20DX series of ARM Cortex M4 mcus, and McHCK! also based on the MK20DX series.
I am also more interested in the MSP430 reange of 16 bit microcontrolers - now that they have FRAM memory - and are fully supported by Energia - an Arduino IDE "workalike" for the MSP430 and other TI processors.
Is there a Universal module format that can accept all these different devices? My mission now is to try to develop one
Progress So Far
In the intervening month, I have had prototype boards back, for a small computing platform, WiNode 5, based on my 50x50mm board format, which uses the CH340G. I can report that the board works perfectly.
At the centre of the 50x50 pcb is a footprint to accept a 40 pin DIL socketed device, and this was placed with the intention of allowing several microcontroller variants to be used with the WiNode 5 pcb.
At the moment, the following processor family options are under consideration:
- ATmega1284 - native on board either as a SMT or as a plug-in DIL 40 packaged part
- STM32Fxxx - added in the form of a 40 pin DIL module
- MSP430FRxxx - added in the form of a 40 pin DIL module
- MK20DXxxx - added in the form of a 40 pin DIL module
Other devices that may be considered in the future include:
nRF51822 Bluetooth Low Energy microcontroller
ESP8266 WiFi module
Of these options, 1 has been prototyped, 2 is currently in CAD, 3 is at concept stage (pre-CAD) and 4 is a latecomer - prompted by the popularity of the Teensy series of microcontrollers, and a very neat similar product McHCK! that I came across this week.
These options represent 4 of the most common processor families, and by creating a generic 40 pin plug in module should allow easy access to the various devices.
For the newer devices, (STM32Fxxx, MSP430FRxxx and MK20DXxxx) the module will support a 5 pin "programming" header placed at one end of the module. This will allow access to the 2 wire ST-link/SPW/SWD Serial Wire Debug pins - for programming and debug.
The ATmega1284 option was chosen so as to offer full Arduino compatibility - but with extra flash and RAM capacity.
The STM32Fxxx module was designed to accept several members of the STM32F Cortex M3/M4 range (in 48 pin LQFP or QFN packages) to exploit the 32bit architecture, clock frequencies up to 120MHz and 16 bit ADCs - on some devices.
The MSP430FRxxx module allows the use of very low power FRAM based 16bit processors, TI Launchpad compatibility.
The MK20DXxxx module allows compatibility with the Teensy and McHCK ecosystems. It is essentially a MCHCK device respun into the standard 40 pin footprint.
Common Hardware
Each module consists of microcontroller with most GPIO pins broken out to 0.1" headers, and a support system composed of reset circuit, crystal oscillator(s) (HF and 32768Hz if available) and debug/bootloader interface.
In addition to the above there will be a footprint for a SPI memory device - either FRAM, SRAM or Flash - which may be programmed or accessed from the standard pins. FRAM devices of up to 256Kbytes is the preferred option.
These modules will have a versatile power supply circuit - allowing options for single cell (eg alkaline AAA or coin cell) and LiPo operation. A high efficiency boost regulator and LiPo charger circuit are included.
The MSP430 Module
This was perhaps one of the easier to lay out. The 38 pin TSSOP package has a fairly good mapping to the 40 pin DIL. The mcu pinouts are as follows:
//
// +---\/---+
// (P1.4) PB0 1 | | 40 PA0 (P1.3) AI 0
// (P1.5) PB1 2 | | 39 PA1 (P3.3) AI 1
// [ ] PB2 3 | | 38 PA2 (P3.2) AI 2
// [ ] PB3 4 | | 37 PA3 (P3.1) AI 3
// NSS (P2.3) PB4 5 | | 36 PA4 (P3.0) AI 4
// MOSI (P2.5) PB5 6 | | 35 PA5 (P1.2) AI 5
// MISO (P2.6) PB6 7 | | 34 PA6 (P1.1) AI 6
// SCK (P2.4) PB7 8 | | 33 PA7 (P1.0) AI 7
// NRST 9 | | 32 AREF
// VCC 10 | | 31 GND
// GND 11 | | 30 AVCC
// [PJ.7] XTAL2 12 | | 29 PC7 (PJ.5)( Xout)
// [PJ.6] XTAL1 13 | | 28 PC6 (PJ.4)(Xin)
// RX0 (P2.0) PD0 14 | | 27 PC5 (PJ.1) TDI
// TX0 (P2.1) PD1 15 | | 26 PC4 (PJ.0) TDO
// INT0 (P2.2) PD2 16 | | 25 PC3 (PJ.2) TMS
// INT1 (P2.7) PD3 17 | | 24 PC2 (PJ.3) TCK
// PWM1B (P3.4) PD4 18 | | 23 PC1 (P1.6) SDA
// PWM1A (P3.5) PD5 19 | | 22 PC0 (P1.7) SCL
// PWM2B (P3.6) PD6 20 | | 21 PD7 (P3.7) PWM2A
// +--------+
Pins 2, 3 and 12, 13 in square brackets are only used with the larger VQFN 48 package MSP430FR5969.