Choosing The Right Mcu Platform: A Comparison Of Pic, Avr, Arm Cortex-M, And More

Common Microcontroller Platforms: Overview of PIC, AVR, Arm Cortex-M, RISC-V, and Others

Microcontrollers (MCUs) are small, low-power integrated circuits designed to control electronic devices. They contain a processor core, memory, and programmable input/output peripherals. When selecting an MCU, engineers must consider factors like performance, power, cost, ease of development, and ecosystem support.

Some of the most popular MCU platforms include:

  • PIC: PIC microcontrollers were introduced in the 1970s by Microchip Technology. Known for their low cost and simple architecture, PIC MCUs have an extensive range from small 8-bit to larger 32-bit devices. PICs have a large installed base and community support.
  • AVR: AVR is a modified Harvard architecture MCU family from Microchip, popularized by use in Arduino boards. AVR MCUs feature a RISC architecture optimized for low-power operation. AVR offers a wide variety of small, low-cost 8-bit MCUs as well as more advanced 32-bit devices.
  • Arm Cortex-M: Arm Cortex-M MCUs implement the Arm architecture known for use in most smartphones. Cortex-M family features high-performance 32-bit cores with DSP extensions, floating point units, and memory protection. Devices range from low-end MCUs to high-capability microprocessors.
  • RISC-V: An open, free architecture, RISC-V offers a modern take on mid-range 32-bit MCU cores. Momentum is building quickly thanks to its extensible design. Current ecosystem is still maturing but major vendors are introducing RISC-V based solutions.

Other less common but still relevant platforms include venerable 8051, MAXQ, MSP430, and more. New IoT-focused entrants like ESP32 SoCs blend Wi-Fi with MCU functionality. Choosing among this diversity can be challenging – the subsequent sections explore the key differences.

Key Differences and Trade-offs: A detailed comparison of performance, power consumption, development costs, programming options, peripheral support, etc.

Here is an overview of how popular MCU platforms compare across some top criteria:

Performance and Capabilities

  • 32-bit Cortex-M MCUs outperform even the highest end 8-bit PIC/AVR MCUs for complex tasks involving data processing, math, encryption, networking, etc. Larger 32-bit MCUs may include DSP extensions or floating point.
  • Higher clock speeds above 100 MHz further improve performance. Real-time control tasks rely more on quick, deterministic response than raw clock rate.
  • Memory protection features in Cortex-M improve safety critical application robustness. PIC/AVR rely on single-threaded execution with more care needed for stability.
  • Peripheral mix varies greatly. Midrange Cortex-M offer ADCs, connectivity, graphics acceleration, motor control modules and more not found on comparably priced PIC/AVR.

Power Consumption

  • Overall power depends greatly on operating profile and system design. In low-power sleep modes, an 8-bit PIC may draw just 10-20 uA – an order of magnitude less than a 32-bit Cortex-M3.
  • Active power consumption depends on operating frequency, supply voltage, process node variations, and more. Newer products on modern process nodes help reduce consumption.
  • Tools like Microchip’s nanoWatt XLP improve light load efficiency. Cortex-M has worked to reduce baseline power draw.

Cost Factors

  • Small 8-bit PIC/AVR MCUs start below $1 USD. Simple applications only require basic GPIO control and minimal resources.
  • Mid-range pricing varies more widely. High-volume 32-bit Cortex-M0 sells for under $2 while integrated wireless SoCs with MCU logic cost over $10.
  • NRE costs like development boards and programmer hardware drives initial outlay higher for 32-bit MCUs. Open-source options like Arduino reduce entry price.
  • Royalties and licensing should be considered for some MCUs with higher fees for 32-bit devices. Most PIC/AVR volume pricing includes unlimited use.

Carefully weigh size, power, and performance needs when deciding 8 vs 32-bit MCUs. The crossed cost chasm still rewards judicious resource usage.

Development Tools and Environment

  • Toolchains are highly fragmented by vendor and architecture. Arm’s acquisition of major compilers like Keil and IAR reflect Cortex dominance.
  • Higher-end IDEs provide better optimization and debug support. Many engineers rely on low-cost or free toolchains with limitations in areas like code size.
  • Arduino IDE and PIC/AVR offerings cater well to beginners. Eclipse, EmBitz and CLI environments give experts more control. Code portability varies.
  • Support for operating systems and multiprocessing differs. Real-time OSes offer another abstraction above the hardware.

An ecosystem of mature and maintained tools boosts productivity. Eval license restrictions or demo limitations risk hampering development.

Programming Options and Flexibility

  • C compilation is universally supported. Optimized C code suits most performance sensitive applications.
  • Assembly is still used selectively for size/speed critical routines across most MCUs. Some timing or hardware issues require ASM.
  • C++ OO extensions are growing on more advanced 32-bit platforms thanks to increased resources. Templates, dynamic allocation and exceptions add software complexity.
  • High-level Python scripts produce portable prototypes which often must be recoded to ship. Interpreted languages remain RAM constrained.

No one language meets all MCU needs. A pragmatic, multi-language approach recognizes the strengths of each option.

Example Applications: When to choose PIC vs AVR vs Arm Cortex-M vs RISC-V

The target application guides MCU platform selection significantly. Here are typical uses cases for the most popular architectures:

PIC

  • Cost-sensitive consumer electronics – Toys, appliances, power tools, etc.
  • Analog/Power control – Lighting, BLDC motors, power conversion
  • Automotive systems – Many body controllers and instrumentation clusters

Proven in high-volume markets, 8-bit PIC MCUs satisfy applications with modest processing budgets that demand reliable performance.

AVR

  • Arduino compatible projects – Rapid prototyping and hobby builds
  • Human Interface – Simple UI management, monochrome graphical LCDs
  • Sensors/Actuators – External device interfacing, data collection, motor drivers

The wide AVR portfolio scales from ATtiny wearables up to XMEGA home automation. AVR libaries ease integration challenges.

Arm Cortex-M

  • Processing-intensive apps – Video, voice, analytics, machine learning
  • Network Connectivity – WiFi, BLE, sub-GHz, and cellular
  • Advanced Human Machine Interfaces – Large color touchscreen GUIs

High-efficiency cores complement integration of graphics, sound, imaging along with connectivity peripherals.

Example: Blinking an LED

Here is a simple “blinky” demo contrasting code for the PIC16F15244, ATmega328P, and NXP Kinetis KE15Z MCUs:

16F15244 Code

#include 

#pragma config FOSC = INTOSC    // Internal oscillator
#pragma config WDTE = OFF       // Watchdog timer disabled

void main(void) {

  TRISA = 0; // Set RA0 as output  
  while(1)
  {
    RA0 = 1; // LED on
    __delay_ms(500);
    RA0 = 0; // LED off  
    __delay_ms(500);
  }
}  

ATmega328P Code

#include 
#include 

#define LED PB5 // Arduino pin 13

int main (void)
{
  DDRB |= (1<

KE15Z Code

  
#include "MKL25Z4.h"                    // Device header
#include "fsl_clock_MKL25Z4.h"       // Clock definitions

#define MASK(x) (1UL << (x))     
#define RED_LED_POS (18)        // Red LED pin

int main(void) {

  SIM->SCGC5 |= SIM_SCGC5_PORTB_MASK; // Clock to PORTB
  
  PORTB->PCR[RED_LED_POS] &= ~PORT_PCR_MUX_MASK;          
  PORTB->PCR[RED_LED_POS] |= PORT_PCR_MUX(1);   // Pin as GPIO
  
  PTB->PDDR |= MASK(RED_LED_POS); // Set pin as output  

  while(1) 
  {    
    PTB->PSOR = MASK(RED_LED_POS);  // LED on
    for(int i = 0; i < 0x7FFFF; i++); 
    
    PTB->PCOR = MASK(RED_LED_POS); // LED off
    for(int i = 0; i < 0x7FFFF; i++);
  }
  
  return 0 ;
}

Development Environment Options: IDEs, compilers, debuggers, and other design tools. A comparison of free vs paid toolchains

Vendor-specific IDEs dominate each platform, but alternative options provide choice:

PIC/AVR

  • Microchip MPLAB X - Full-featured Eclipse-based IDE Manage projects with graphics editor UI and visualize data.
  • Atmel Studio - Atmel's advanced IDE now owned by Microchip. Tightly integrates debugging and programming.
  • Arduino - Easy for beginners to pick up and portable code to advanced IDEs later.
  • Specialized compilers like HI-TECH, CCS, Raisonance, and IAR add optimizing for speed or size.

Arm Cortex

  • Arm Keil MDK - Long the gold standard for Arm development, now part of Arm. Packs extensive features.
  • IAR EW ARM - Powerful IDE with advanced compiler and debug probe support. Some of the best code efficiency.
  • GCC Arm Embedded - Free, open-source toolchain with no code size limits. Actively maintained and robust community.
  • MCUXpresso - NXP's Eclipse-based IDE smooths development for Kinetis, LPC, and iMX RT. Free with unrestricted use.

Evaluate each toolchain with representative code to validate compatibility and output quality match expectations. Verify license terms allow prototyping to production use without additional fees.

Hardware Considerations

Microcontroller selection impacts electrical design and PCB implementation. Be sure to assess:

  • Pin counts from 20 pins up to over 200 pins cover wide application range
  • Packages range from ultra small QFN, DFN and wafer-level chip scale to larger TQFP, QFP, SOIC and through hole DIP
  • Peripheral mixes differ greatly across MCU families with varying serial, ADC, PWM and other building blocks.
  • Memory profiles guide selection based on program size and RAM requirements.
  • Low-power operation depends greatly on system-level optimization.

Review parametric search options early to narrow choices by key hardware criteria. Define must-have peripherals, I/O needs and physical requirements.

Support and Learning Resources

Navigating technical questions and continuing education differs by architecture:

  • PIC/AVR - Long history has built comprehensive community and answers. Core concepts transfer between similar 8-bit MCUs.
  • Cortex-M - Processor expertise most applicable within Arm ecosystem. Some concepts map from Cortex-A application processors.
  • Vendor forums & application notes - Engineers accessible and insights into real designs.
  • SemiWiki, Reddit, StackExchange, Quora - Large sites have tech activists supporting various MCUs.
  • Books - In depth guidance for both hardware and software best practices.

The Arm architecture can have a steeper initial learning curve. Leverage 8/16-bit experience when transitioning to 32-bit systems.

Future Outlook and Trends

The platforms powering future embedded systems face multiple technology disruptions on the horizon:

  • IoT connectivity pushes more MCUs to include wireless alongside sensors and analytics
  • AI drives demand for efficient parallel processing suitable for edge networks
  • Industry consolidation continues evident by Microchip/Atmel, Infineon/Cypress and NXP/Freescale deals
  • Open source RISC-V architecture threatens expensive licensing models
  • New special purpose accelerators handle tasks like computer vision or voice recognition

Additional considerations around security, functional safety and reliability move the state-of-the-art forward across all microcontroller families. No single architecture owns the future as innovation remains key to adaptability.

Leave a Reply

Your email address will not be published. Required fields are marked *