APC Australia

Taking Arduino to 32-bit

Eventually, eight bits just aren’t enough. Darren Yates looks at various options for taking your projects to 32-bit performanc­e.

-

Arduino has become a popular maker platform for a whole range of reasons, not least of which is its simple, low-cost 8-bit processing. As we’ve seen over the last three or so years in our Arduino Masterclas­s series, there’s plenty you can do with 8-bit processing when you’re not encumbered by a lumbering operating system. But eventually, your ideas will get to the point where 2KB of RAM isn’t enough and you just need more speed. That’s when it’s time to make the jump to 32-bit.

OFFICIAL OPTIONS

We’ve spent plenty of time concentrat­ing on the Arduino Uno and its smaller sibling, the Arduino Nano, but the Arduino developers have been busy modernisin­g their boards in recent times and there are now a number of 32-bit Arduino options available.

ARDUINO DUE

The cheapest and oldest of these is the Arduino Due. It’s the same size as the Arduino Mega we used in a Digital Audio Recorder Mk II project ( tinyurl.com/hd64wqp), but comes with Atmel’s considerab­ly-faster 84MHz SAM3X8E ARM Cortex M3 microcontr­oller. Officially, the Arduino Due is end-of-life now, but you’ll still find clones floating around eBay for around $20. The SAM3X8E has 96KB of RAM split into two banks, 32KB and 64KB, plus 512KB of flash storage for your code.

You get the same 54 digital I/O pins as the Mega, but it also comes with two 12-bit digital-analog converters (DACs). One of the more popular starter projects for the Due is to turn those DACs into a pseudo-16-bit stereo audio player.

Unfortunat­ely, the Arduino Integrated Developmen­t Environmen­t (IDE) v1.6.9 no longer includes the Arduino Due compiler by default — you have to install it separately. To do this, go to the IDE (get it from arduino.cc) and from the menu, select ‘Tools > Board > Boards Manager’, choose ‘Arduino SAM boards’, and press the Install button. This downloads in the ARM compiler to build your code.

ARM CORTEX M-SERIES

However, what’s really cool about 32-bit is the ready availabili­ty of ARM Cortex M-series microcontr­ollers — these are the little cousins to the Cortex A-series ‘System on a Chip’ (SoC) that powers your Galaxy S7 smartphone. In fact, the original Google Glass was powered by Texas Instrument­s’ dual-core Cortex A9 OMAP4430 SoC — inside that chip are two Cortex M3 cores handling imaging subsystem (ISS) signal processing. The Fitbit Flex and Fitbit One fitness trackers are also powered by a Cortex M3 core. We might not be quite building the next Apple iPhone here, but we’re definitely now at the grownups’ table.

ARDUINO 101

The Arduino 101 is the first entry-level 32-bit board designed with the old Arduino Uno form factor. It features two cores — a 32-bit Intel Quark x86 core, plus a 32-bit ARC core, both clocking in at 32MHz. The board also includes Bluetooth LE and a six-axis accelerome­ter/gyroscope ready to go, making it an all-out Internet of Things (IoT) board. Support for the 101 is available in the latest Arduino IDE — just select the board type and the Intel compiler inside the IDE goes to work. You’ll find the 101 for about US$30.

UNOFFICIAL OPTIONS

The rise of IoT really has lit a fire under the maker movement and the push for faster, cheaper microcontr­ollers is on in earnest. Back in 2010, a group called LeafLabs came out with an unofficial Arduino Uno-style clone called the Maple, built on a 72MHz 32-bit Cortex M3 chip from STMicroele­ctronics called the STM32F103R­8T6. The group later released a Nano clone called the Maple Mini using the smaller STM32F103C­8T6 chip. What was unusual about these boards is that, despite their 32-bit chips, you could code them using a modified version of the Arduino IDE, rather than more complex options. While LeafLabs no longer makes the Maple range, the design files are now open-source and eBay is flooded with Maple Mini clones you can pick up for just $5.

Arduino boards, those claiming to be Arduino-compatible and even the Maple series have ‘bootloader’ software preinstall­ed. It’s kind of a basic input/ output system (BIOS) that tells the board how to communicat­e with the Arduino IDE over USB. These newer 32-bit Cortex M3 no-name boards don’t have this bootloader and you need the ST-Link V2 USB adapter to code them.

A couple of years ago, Roger Clark, an Australian software engineer, started looking at these clone boards. The arrival of the Arduino Due led Arduino to make available an ARM Cortex M-series code compiler for the official Arduino IDE and, to cut a long story short, Clark has built up a thriving community getting these STM32 boards working on the Arduino IDE called Arduino for STM32 ( stm32duino.com).

DIFFERENT SPECS

The STM32F103C­8T6 chip on these no-name boards has different specs to the Due’s SAM3X8E. This particular version of STM32F1 runs at 72MHz, has only 20KB of RAM and 64KB of flash storage. There are many different chips based on the Cortex M3 core, but to get compatibil­ity with the Arduino IDE, you need support libraries to enable the IDE to recognise and code each chip correctly. Chipmaker GigaDevice­s has developed a Cortex M3-based GD32F103 chip that runs at 108MHz and reportedly overclocks to 120MHz. This probably doesn’t sound particular­ly fast for a CPU, but when the fastest microcontr­oller, the new ARM Cortex M7, only clocks at 300MHz, it’s plenty quick — particular­ly given it’s not dragging a full-on operating system behind it.

VOLTAGE WARNING

The key thing to remember when you make the move from 8-bit to 32-bit is that all 32-bit boards run on a lower 3.3-volt power rail, not the 5-volts the Arduino Uno, Nano and Mega boards use. This is important because feeding 5V into an I/O pin on some 3.3V boards may well blow them up. The Arduino 101 is unusual in that its I/O lines are 5V-tolerant. If you’re using Arduinobas­ed peripheral boards, you’ll need to first check that they work at 3.3V, otherwise they may not start at this lower voltage.

A NEW CHAPTER

Making the hyper-jump from 8-bit Arduino to 32-bit ARM Cortex M-series boards will mark a new chapter in your learning, no question. It may seem daunting at first, but the basic principles are still the same — you come up with an idea, design the project, interface electronic components with the controller, flash your code and power on. The difference now is that you have much more processing horsepower at your disposal.

As we said, you’re definitely at the grown-ups’ table now.

 ??  ?? The Arduino 101 features a 32MHz Intel x86 core.
The Arduino 101 features a 32MHz Intel x86 core.
 ??  ?? Use the Arduino IDE’s board manager to install the ARM compiler.
Use the Arduino IDE’s board manager to install the ARM compiler.
 ??  ?? The 32-bit Arduino Due has gone end-of-life, but clones are still available.
The 32-bit Arduino Due has gone end-of-life, but clones are still available.
 ??  ?? The ST-Link V2 adapter programs STM32 boards via USB.
The ST-Link V2 adapter programs STM32 boards via USB.
 ??  ?? New code allows the Arduino IDE to code $5 Maple Mini clones.
New code allows the Arduino IDE to code $5 Maple Mini clones.
 ??  ?? This tiny board packs in a 72MHz 32-bit Cortex M3 chip for under $5.
This tiny board packs in a 72MHz 32-bit Cortex M3 chip for under $5.
 ??  ?? ARM’s Cortex M3 microcontr­oller powers the Fitbit Flex/One fitness devices.
ARM’s Cortex M3 microcontr­oller powers the Fitbit Flex/One fitness devices.
 ??  ??

Newspapers in English

Newspapers from Australia