DSP, Micros & Memory


Microcontrollers - the tools of change

22 September 2004 DSP, Micros & Memory

Migrating or upgrading to a new microcontroller and the issues associated with porting all or parts of an existing design to a new microcontroller have been the subject of considerable debate in the electronics industry. The problems that engineers face in this situation are exacerbated when the project schedule is tight and perhaps the only certainty is the storm of protest that will greet the engineer who fails to deliver on time. Whilst this situation is not new, there has been a steady change in the industry over recent years and many will not be aware of the new rules that govern this age-old challenge.

As an example, consider the '8051' and the many derivative devices that are available in today's market. Ten years ago the 8051 was almost written off but it seems that reports of its death were exaggerated. There are a number of new offerings using the 8051 core that give increased performance and a significant increase in both the number and variety of peripherals available. Many engineers, familiar with the 8051, are looking at these new offerings. They feel comfortable that they know the 8051 core so it should be easier to adopt any 8051 based device than look at a different core.

This is a common statement but is this correct?

The porting challenge

Before we try to answer this question, let us look at what is involved with moving to a new microcontroller. Most manufacturers of microcontrollers have many different variants; one manufacturer boasts over 500 different varieties. These variants are necessary for designers to get a sufficient choice of peripherals to meet the mix required in the particular application that is being considered.

A far better approach would be to select a microcontroller that has all the peripherals required for many projects and a flexible I/O arrangement allowing the user to choose and configure the exact combination of peripherals that each project requires. The eCOG1 from Cyan Technology makes use of this approach and can significantly reduce the amount of effort required in PCB redesign. Choosing a part like this can make the hardware changes with a new microcontroller easier. In addition, the engineer will be appreciated by the logistics people in his company if he reduces the number of different parts bought and stocked.

Most engineers would argue that software compatibility is a reason to stick with their current family of microcontrollers - so let's look at the software issues.

When considering a new microcontroller there are two main software tasks that need to be addressed:

* Writing algorithms that work entirely in the core. These could be mathematical algorithms (eg, a filtering algorithm) or they could be the main execution loop for the product.

* Software that initialises and interfaces with peripherals.

First let us address the software that works entirely in the core of the microcontroller. Over recent years, there has been an increasing use of C compilers. Compilers have become more efficient so any performance penalty that arises from using C has been reduced to a point where the reduction in engineering effort offered by a C compiler far outweighs any loss of performance in almost all applications. There are still some time-critical software functions that need to be written in assembler but even these are likely to be 'packaged' in a main program written in C. In addition to the efficiency of compilers, we have seen a marked increase in the performance of microcontrollers in general. Many engineers have taken the opportunity offered by a 10 times performance enhancement of modern microcontrollers to switch to writing software in C and ending up with a product that is still much faster than previous generations.

The other driving factor behind the adoption of C has been the steady increase in the size of code that is commonly required for many products. Writing 8 K of code in assembler probably equates to around 100 A4 pages of software. Writing and maintaining this amount of code takes considerable engineering effort. Once you start to look at applications that require 32 K or 64 K of code then using a compiler becomes the only realistic option for 99% of applications.

If we accept that the next project that we will develop will use a C compiler then we can make an obvious but startling conclusion. A high-level language such as C removes the engineer from the intricacies of the microcontroller core. If we write:

Counter = Counter + 1; (or Counter++;)

- we suddenly realise that we do not have to care exactly how this is implemented in the application. This is the very purpose of the compiler so it should be no surprise. What is perhaps a little more startling is that this means that we do not have to worry about the details of the core itself. So long as the variable Counter is incremented, we do not need to know if the result was obtained using an accumulator or register architecture - we do not care.

Now let us look at the issue of programming the peripherals. In many new microcontrollers on the market, the number of peripherals is increasing rapidly. More and more of the die size is down to the peripherals, and their complexity and power seems to be ever increasing. Taking a look at some of the 8051 microcontrollers on the market today, we have data sheets that run into 300 or 400 pages. Of these you may find that only 25 of these pages document how the core works. The remaining pages are all about the peripherals, from the humble reset controller; through sophisticated ADCs to much more complicated communications controllers (eg, CAN, USB, Ethernet).

This leads us to the conclusion that software that uses the peripherals takes much more effort to develop than software that runs entirely in the core.

It follows that the more pages of a microcontroller data sheet that are dedicated to the peripherals the less you will find it useful being familiar with the core!

Drowning in peripherals

As an engineer faced with a plethora of sophisticated peripherals what could you do to avoid being overwhelmed with the task of making them all do what you want? Fortunately, help is at hand. Certain manufacturers of microcontrollers offer tools that generate the source code for you. The screenshot pictured above shows an example of such a tool - CyanIDE from Cyan Technology, showing 'point-and-click approach to setting the baud rate for a UART.

In fact, choosing a microcontroller from the same family and manufacturer but with significant new peripherals may not be as easy as choosing a microcontroller from a new manufacturer if the new manufacturer has good, integrated tools that help with the programming of the peripherals. The powerful combination of tools and configurability is more important than a lot of experience with the core.

The age-old challenge of using a new microcontroller is taking a new twist!



Credit(s)



Share this article:
Share via emailShare via LinkedInPrint this page

Further reading:

The 8-bit survival syndrome – Part 2
DSP, Micros & Memory
Just like the 4-bit pre-microcontroller, the 8-bit MCU has been finding ways to stick around. Their features and speeds have been improving, offering competitive reasons to work with them.

Read more...
Enhanced code protection for USB µC portfolio
Future Electronics DSP, Micros & Memory
To help easily incorporate USB power and communication functionality into embedded systems, Microchip Technology has launched the AVR DU family of microcontrollers.

Read more...
General-purpose MCU with RISC-V architecture
EBV Electrolink DSP, Micros & Memory
Renesas has released a general-purpose MCU to enhance its existing RISC-V portfolio, and this is its first MCU using a RISC-V core developed internally at the company.

Read more...
8-bit MCU with I3C support
Avnet Silica DSP, Micros & Memory
The PIC18-Q20 8-bit microcontrollers from Microchip easily interface with devices operating in multiple voltage domains, and the built-in I3C interface supports higher-speed and lower-power data transfers than I2C.

Read more...
An evolutionary step in customisable logic
Altron Arrow DSP, Micros & Memory
Microchip Technology is offering a tailored hardware solution with the launch of its PIC16F13145 family of microcontrollers, which are outfitted with a new Configurable Logic Block module.

Read more...
MCU for battery-powered applications
Altron Arrow DSP, Micros & Memory
Included in ST’s family of devices is the STM32U031, an ultra-low-power MCU featuring an ARM Cortex-M0+ 32-bit core running at up to 56 MHz.

Read more...
Serial SRAM up to 4 MB
EBV Electrolink DSP, Micros & Memory
The chips are designed to provide a lower-cost alternative to traditional parallel SRAM products, and include optional battery backup switchover circuitry in the SRAM memory to retain data on power loss.

Read more...
SiP supports LTE/NB-IoT and GNSS
RF Design DSP, Micros & Memory
The nRF9151 from Nordic Semiconductor is an integrated System-in-Package that supports LTE-M/NB-IoT, DECT NR+ and GNSS services.

Read more...
Qi2 dsPIC33-based reference design
DSP, Micros & Memory
Powered by a single dsPIC33 Digital Signal Controller, the Qi2 reference design offers efficient control for optimised performance.

Read more...
MIKROE’s IDE now includes MPLAB XC compilers
DSP, Micros & Memory
MIKROE has announced that the latest version of its multi-architectural IDE, NECTO Studio 6.1, now includes Microchip’s MPLAB XC compilers for 8-, 16- and 32-bit MCUs.

Read more...