The ARM-Cortex microcontroller is a most popular microcontroller in the digital embedded system world and most of the industries prefer only ARM microcontrollers since it consists of enormous features to implement products with an advanced appearance. The ARM microcontrollers are cost sensitive and high performance devices which are used in a wide range of application such as industrial instrument control systems, wireless networking and sensors and automotive body system etc.
Introduction to ARM Microcontroller
The ARM stands for Advanced RISC machine and it is a 32-bit reduced instructions set computer (RISC) microcontroller. It was first introduced by the Acron computers’ organization in 1987. The ARM is a family of the microcontroller developed by the different manufacturers such as ST microelectronics, Motorola and so on. The ARM microcontroller architecture come with a few different versions such as ARMv1, ARMv2 etc and each one has its own advantage and disadvantages.
The ARM cortex microcontroller is an advanced microcontroller in the ARM family, which is developed by the ARMv7 architecture. The ARM cortex family divided into three sub-families such as;
- ARM-Cortex Ax-series
- ARM-Cortex Rx-series
- ARM-Cortex Mx-series
ARM Coretex-M3 Microcontroller Architecture
The cortex-M3 ARM processor is a high performance 32-bit processor, which offers the significant benefits to the developers. The ARM architecture is a ‘Harward architecture’ which offers separate data and instruction buses for communicating with the ROM and RAM memories. It consist a 3-stage pipeline to fetch, decode and execute the instructions sequentially. The Cortex processor is a cost sensitive device which is used to reduce the processor area and has extensive improving interrupt handling and system debug capabilities.
The cortex-M3 arm processors are implemented by THUMB instruction set based on THUMB-2 technology, therefore, ensures high code density and reduce the program memory requirement. The cortex-m3 instruction set provides the excellent performance due to modern 32-bit architecture. The ARM processor core-m3 is closely integrated to Nested Vector Interrupt Controller (NVIC) to provide the good interrupt performance.
Additional Features of the Cortex-M3 Processor
It is a RISC Controller
- 32-bit high performance CPU
- 3-stage pipeline and compact one
It has THUMB-2 technology
- Optimal merges of 16/32 bit instructions
- High performance
It supports tools and RTOS and It has core Sight debug and trace
- JTAG or 2-pin serial wire debug connection
- Support for multiple processors
Low power Modes
- It supports sleep modes
- Control the software
- Multiple power domains
Nested vectored interrupt controller (NVIC)
- Low latency, low jitter interrupts response
- No need for assembly programming
ARM Microcontroller Register Modes
An ARM micrcontroller is a load store reducing instruction set computer architecture means the core cannot directly operate with the memory. The data operations must be done by the registers and the information is stored in the memory by an address. The ARM cortex-M3 consists of 37 register sets wherein 31 are general purpose registers and 6 are status registers. The ARM uses seven processing modes to run the user task.
- USER Mode
- FIQ Mode
- IRQ Mode
- SVC Mode
- UNDEFINED Mode
- ABORT Mode
- Monitor Mode
USER Mode: The user mode is a normal mode, which has the least number of registers. It doesn’t have SPSR and has limited access to the CPSR.
FIQ and IRQ: The FIQ and IRQ are the two interrupt caused modes of the CPU. The FIQ is processing interrupt and IRQ is standard interrupt. The FIQ mode has additional five banked registers to provide more flexibility and high performance when critical interrupts are handled.
SVC Mode: The Supervisor mode is the software interrupt mode of the processor to start up or reset.
Undefined Mode: The Undefined mode traps when illegal instructions are executed. The ARM core consists of 32-bit data bus and faster data flow.
THUMB Mode: In THUMB mode 32-bit data is divided into 16-bits and increases the processing speed.
THUMB-2 Mode: In THUMB-2 mode the instructions can be either 16-bit or 32-bit and it increases the performance of the ARM cortex –M3 microcontroller. The ARM cortex-m3 microcontroller uses only THUMB-2 instructions.
Some of the registers are reserved in each mode for the specific use of the core. The reserved registers are
- Stack Pointer (SP).
- Link Register (LR).
- Program Counter (PC).
- Current Program Status Register (CPSR).
- Saved Program Status Register (SPSR).
The reserved registers are used for specific functions. The SPSR and CPSR contain the status control bits which are used to store the temporary data. The SPSR and CPSR register have some properties that are defined operating modes, Interrupt enable or disable flags and ALU status flag. The ARM core operates in two states 32-bit state or THUMBS state.
ARM-Cortex Microcontroller Programming
In the present days, the microcontroller vendors are offering 32-bit microcontrollers based on ARM cortex-m3 architecture. Many embedded system developers are starting to use these 32-bit microcontrollers for their projects. The ARM microcontrollers supports for both low-level and high level programming languages. Some of the traditional microcontroller architectures are made with many limitations therefore, difficult to use the high level programming language.
For example the memory size is limited and performance might not be sufficient. The ARM microcontrollers runs at 100Mhz frequency and higher performance, therefore it supports the higher level languages. The ARM microcontroller is programmed with different IDES such as keiluvision3, keiluvision4, coocox and so on. A 8-bit microcontroller use 8-bit instructions and the ARM cortex-M uses a 32-instructions.
The ARM Microcontroller Assembly Level Programming:
The ARM cortex microcontroller is a 32-bit microcontroller therefore all instructions are 32-bit long which is executed in a single cycle. It consists of an instruction set to perform the arithmetic, logical and boolean operations. The ARM is a load-store architecture, then instructions are executed conditionally.
Syntax: Load a // a obtained the value from the place called a //
ADD12 // 12 is added to the load value a //
Store a // final value is stored in the variable a//
The assembly language programming is developed by the mnemonics such as ADD, SUB, MUL so on but for ARM programming, some extra instructions added such as ADCNES and SWINE, etc.
EX: 1. ORG 0000h
MOV r1, #10
MOV r2, #15
ADD r3, r2, r1 // r3=r2+r1 and the final value stored in r3 register//
MOV r1, #10
MOV r2, #15
SUB r3, r2, r1 // r3=r2-r1 and the final value stored in r3 register//
The ARM Coretex-M3 Microcontroller Embedded C Level Programming:
WAP to toggle the single LED through Embedded C language using ARM cortex microcontroller.
#define LED_PORT GPIOB
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); //enable the PORTB pins//
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //set the port frequency//
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //set the PORTB in output//
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All ; //enabled all PORTB pins//
GPIO_Init(GPIOB, &GPIO_InitStructure); //initialize the PORTB pins//
This is about the ARM microcontroller architecture with neat sketches and arm programing with example programs. Hope that we have given informative content on the arm processors. Further any help regarding arm programming or arm projects you can contact us by commenting below.