High performance and low power consumption of 16-bit microcontroller

High performance and low power consumption of 16-bit microcontroller

tenco 2019-08-10

Longer battery life is critical to improving customer satisfaction with consumer devices.For battery-powered Internet of things (IoT) endpoints, extended battery life reduces maintenance costs and improves reliability.Due to the relatively large power consumption of microcontrollers used in these devices, designers need to choose and apply the appropriate architecture to meet the requirements of these applications.It turns out that 16-bit microcontrollers are the best choice in most cases.

Although 8-bit microcontrollers are becoming increasingly powerful, there are inherent performance limitations due to limited processing power and addressable memory, so that 8-bit microcontrollers are not typically used for high-performance applications.On the other hand, 32-bit kernel based systems tend to overshoot these applications, especially when unnecessary power consumption is too high.

The solution lies exactly in the middle of the 8-bit and 32-bit kernel -- the 16-bit microcontroller.Such devices not only have low power consumption like simple single power 8-bit microcontroller, but also have partial performance and memory advantages of 32-bit kernel.If the application does not require many threads to be processed simultaneously and the memory requirements are not too high, the 16-bit microcontroller can provide the appropriate level of performance and significant energy savings.

This paper describes the architecture of the 16-bit microcontroller and how it is the best choice for many battery-powered consumer devices and iot endpoint applications.In addition, several 16-bit microcontrollers from Microchip Technology and Texas Instruments are introduced, along with instructions on how to start designing with a 16-bit kernel.

Microcontroller selection

The first step in the design process after defining the project requirements is to select the appropriate microcontroller for the application.The three main options are 8-bit, 16-bit and 32-bit microcontrollers.

It is no exaggeration to say that 8-bit microcontrollers are very popular and can be regarded as the main device of designers.The low-cost, low-power 8-bit microcontroller is ideal for almost any low-power application: mainstream microcontrollers have the lowest power consumption, with some devices having a standby current of less than 100 nA.

Most 8-bit microcontrollers are based on accumulators, although some newer architectures have register sets, so the programming model is simple and limited: accumulators or small register sets with a single state register, stack Pointers, and one or more index registers.Stacks tend to be hardware stacks, and the firmware cannot access program counters (PCS).

Although 8-bit architectures are popular, they hit a bottleneck when it comes to networking and communication.Almost all communication stacks and network protocols are 16-bit or 32-bit, so you don't have to worry about 8-bit architectures.In addition, even high-end 8-bit microcontrollers tend to be limited to 16-bit addressing and lack paging mechanisms, limiting firmware size and complexity.

On the other hand, 32-bit microcontrollers are widely used in all high performance applications.Register-based architecture can easily support network and communication;It usually USES 32-bit addressing, supports floating-point and higher algebra operations, and has clock rates up to gigahertz.The 32-bit kernel has a more complex programming model, including multiple status registers, firmware accessible PCS, complex interrupt management, and two or more layers of firmware execution permissions.

16-bit microcontrollers are register-based, but the architecture is as simple as an 8-bit kernel.Therefore, 16-bit kernels tend to have good low-power performance, current consumption is significantly lower than 32-bit architectures, and power consumption is almost as low as 8-bit kernels.If applications require advanced mathematical operations, some 16-bit microcontrollers have mathematical coprocessors that can rival 32-bit cores for mathematical performance at the same internal clock speed.

In addition, many communication protocol stacks support networking of 16-bit microcontrollers.For protocols such as Ethernet, CAN, USB, and Zigbee, using 16-bit microcontrollers CAN be as fast as 32-bit microcontrollers, as long as the application code performs well enough to support the stack.

Large flash array addressing using 16 bit microcontrollers

A big difference between 32-bit and 16-bit architectures is the memory addressing range.The 32-bit microcontroller has a 32-bit address bus and can access up to 4 GB of memory.Traditional 16-bit microcontrollers use 16-bit addressing and can only access 64 KB of memory.However, many 16-bit architectures today use extended addressing of up to 24 bits, equivalent to 16 MB of address space.

Microchip Technology's low power PIC24F microcontroller family is a typical example of extended addressing.One microcontroller, PIC24FJ1024GA, 32 MHz 16-bit microcontroller with 1 MB onboard flash and 32 KB onboard SRAM, USES a simple programming model similar to many 8-bit microcontrollers (figure 1).


Figure 1: Microchip's PIC24F programming model is similar to the high-end 8-bit microcontroller and USES a register-based architecture with 16 general purpose 16-bit registers, stack pointer, PC and 5 auxiliary registers.(credit: Microchip Technology)

PIC24 has a 23-bit program counter and can access up to 8 MB of program flash.The 16 16-bit registers, known as working registers (WREG), are WREG from W0 to W15: registers W0 to W13 are general purpose registers (GP), which can be used to store data under firmware control.W15 is a special stack pointer (SP), which can be automatically incresed and decrement by function and subroutine calls, programming exception handling, and call return. SP can also be modified by firmware like registers W0 to W13.

W14 can be used as a stack frame pointer (FP) using LINK and UNLINK assembly instructions.The stack pointer restriction register (SPLIM) is a stand-alone register that can be used in conjunction with SP to prevent stack overflow.

PIC24 adopts harvard architecture with independent address and data space.In conjunction with special instructions, the data table page address (TBLPAG) register and the program space visibility page address (PSVPAG) register can be used to access and transfer data between addresses and data Spaces.This is a common feature of 32-bit architectures, but is rarely found in 8-bit kernels.

The 16-bit REPEAT loop counter (RCOUNT) register contains a loop counter that can be used to REPEAT assembly instructions.

The 16-bit CPU kernel control (CORCON) register is used to configure the internal operating mode of the PIC24 kernel.

Finally, the 16-bit state register contains the working state bits of the PIC24 kernel state, including the resulting state from the last time an assembly instruction was executed.

According to Microchip Technology's performance evaluation of PIC24FJ1024GA606T, the working frequency can reach 16 MIPS at 32 MHz.That's pretty impressive for a 16-bit kernel.The kernel has many features of a 32-bit microcontroller, such as a 17-bit x 17-bit hardware multiplier and a 32-bit / 16-bit hardware divider that also supports fractional arithmetic.These functions are useful for Internet of things endpoints that need to compute sensor data.In addition, the architecture can read and write data storage at the same time without affecting performance at all.

Although PIC24FJ1024GA606T has a variety of standard peripherals such as USB OTG, its power consumption is quite low in battery-powered applications.The required power supply voltage is only 2.0v to 3.6v, and the maximum current consumption when the microcontroller runs at full speed at the working frequency of 32 MHz is 7.7ma, which is extremely difficult to achieve when the 32-bit kernel is used.The core and peripheral clock can be controlled by firmware.Currently, there are two kinds of assembly instructions that enable the device to enter low-power mode: IDLE instruction stops the PIC24 kernel, but the peripheral can continue to work;The SLEEP command will stop operation of all devices except watchdog (optional) and external interrupt detection.In idle mode, the maximum current is only 2.8 mA, while in dormancy mode, the maximum current ranges from 10 to 45 A, depending on the peripheral configuration.In the lowest power consumption mode, namely sleep mode, the contents of random access memory (RAM) are still saved, and the consumption current of PIC24F is as low as 190 nA.

In order to achieve higher performance, Microchip Technology introduces high-end 16-bit microcontrollers in dsPIC® series.Microchip's dsPIC33EP512GP506T is one of the 16-bit 70 MIPS microprocessors with 512 KB of flash memory.The core register of dsPIC is roughly the same as PIC24, except that it adds registers that support digital signal processing (DSP) instructions, including two 40-bit accumulators and supports 32-bit multiplication.If PIC24 needs to be upgraded within the system, most PIC24 microcontrollers can be upgraded with pin compatible dsPIC, so using the same printed circuit board can also improve performance.

Of course, the higher the performance, the more power.The dsPIC33 has a supply voltage of 3.0 to 3.6v and a maximum current of 60 mA at a speed of 70 MIPS.

Reduce power consumption and improve performance

Texas Instruments' MSP430FR599x microcontroller family USES the company's ferroelectric random access memory (FRAM) program memory for higher read/write performance and lower power consumption than flash microcontrollers.MSP430FR5994IPNR 16-bit microcontroller is one of the series, with clock frequency up to 16 MHz and a FRAM of 256 KB.

Performance enhancements to the MSP430FR microcontroller kernel include bi-directional associated caching (consisting of four 64-byte cache blocks with row width) for higher FRAM performance;The 32-bit hardware multiplier can improve the performance of math-intensive operations.And a low power accelerator (LEA) coprocessor independent of the MSP430 main kernel.The LEA can perform 256 point complex complex Fourier transform (FFT), finite impulse response (FIR) filter and matrix multiplication.According to TI, matrix multiplication is up to 40 times faster than Arm® Cortex® -m0 +.The LEA improves the performance of sensor fusion operation, image enhancement and ultrasonic sensor data processing.When faced with these applications, developers often prioritize 32-bit kernels over ultra-low-power 16-bit microcontrollers.

The programming model for the MSP430R is very simple (figure 2), with 16 16-bit registers R0 through R15: R0 is the program counter, R1 is the stack pointer, R2 is the state register, R3 is the constant generator (for immediate operands), and R4 through R15 is the general purpose register.Other register configurations are memory-mapped, similar to most 32-bit kernels.


Figure 2: the MSP430 microcontroller register set configuration is similar to other register-based 16-bit kernels.Other register configurations are memory-mapped.(credit: Texas Instruments)

Although it improves performance, it does not increase power consumption at all.In standby mode, TI's MSP430FR5994 operates with real-time clock (RTC), and the current consumption is only 350 nA.In the off mode, the current consumption is only 45 nA.That's lower than any 32-bit microcontroller on the market today, and lower than most 8-bit microcontrollers.

MSP430FR5994IPNR has a working voltage range of 1.8 to 3.6 V.When the firmware is running as FRAM and the cache hit ratio is zero, the current consumption of the MSP430FR is only 3 mA.If the code is run from the cache, the current consumption is only 790 A.Combined with LEA, the 16-bit microcontroller provides extremely high processing performance and very low power consumption.

TI's msp-exp430fr5994 LaunchPad™ makes it easy to develop low-power applications for the MSP430FR5994 family.The LaunchPad development suite contains everything a developer needs to get started on msp-exp430fr5994 microcontroller coding and firmware debugging (figure 3).


Figure 3: TI's msp-exp430fr5994 LaunchPad has everything a developer needs to get started on msp-exp430fr5994 16-bit FRAM microcontroller coding and firmware debugging.(credit: Texas Instruments).

The LaunchPad features two buttons, two leds, and a microSD card slot.To demonstrate the low power performance of the MSP430FR5994 microcontroller, the LaunchPad has a 0.22f large capacitor to power the LaunchPad.Charge the capacitor by plugging the LaunchPad into an external power source and setting the jumper J8 to "charge".It only takes 2 to 3 minutes to fully charge the capacitor.After three minutes, set the jumper J8 to "use", remove the external power supply, and the MSP430 can run for several minutes, depending on the application.

Additionally, the LaunchPad can be used to measure current consumption for the MSP430 and its applications.The J101 isolation block has seven jumpers, including the 3v power jumper 3V3.By removing jumper 3V3, the application current can be measured through these two pins.

The LaunchPad also supports TI's EnergyTrace™ technology to connect to a computer using Texas Instruments' EnergyTrace graphical user interface (GUI), allowing developers to view the MSP430 microcontroller and application power data in real time, fine-tuning the application to minimize power consumption.

For example, real-time current monitoring and recording can show occasional surges in the current consumption of the MSP430 microcontroller.A surge in current reduces battery quality and shortens battery life.The surge can be due to misconfiguration of peripherals on the chip, external inductor or capacitor loads, or even due to firmware attempts to start all functions at once.With current monitoring and recording, developers can figure out how to adjust the firmware to control spikes.

conclusion

For many low-power, medium-performance battery-powered embedded applications, developers can choose the right 16-bit microcontroller over a 32-bit kernel.As mentioned above, in many applications, 16-bit microcontrollers consume much less power than 32-bit cores, yet still achieve the desired performance.

Tenco Technology