Introductory Session

Introductory Session

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMS
CLASS / 1

Introductory Session

By the end of the course, the successful student will be able to do:

1. Understand, explain, architectures of MSP 430 family microcontrollers, and analyse various types of real time applications.

2. Carry out a detailed analysis of low power modes in MSP 430 5X series microcontroller.

3. Understand the concept Real time clock and PWM based applications.

4. Analyse the architecture of IoT and WiFi based communication models in embedded systems.

Introduction to Embedded Systems

This class will give introduction to EMBEDDED SYSTEMS answering questions such as...

1. What is system?

2. Examples of systems

3. What is embedded system?

4. Characteristics of embedded systems

5. Purpose of embedded systems

Key points:

System: A way of working, organizing or performing one or many tasks according to a fixed set of rules, program or plan.

Examples of systems: Time display system (watch), Automatic cloth washing system (washing machine) etc………

Embedded system: An embedded system is an electronic/electro-mechanical system designed to perform a specific function and is combination of both hardware and firmware (software). The program instructions written for embedded systems are referred to as firmware, and are stored in Read-Only-Memory or Flash memory

Characteristics of embedded systems: Application and Domain Specific, Reactive and Real Time, Operates in harsh environments, Small size and weight etc….

Purpose of Embedded System: Data Collection/Storage/Representation, Data communication, Data signal processing, Monitoring, Control, Application specific user interface.

Applications and examples of ES

This class deals on different applications and examples of embedded systems and also difference between general purpose computing system and embedded system

Key points:

Applications and examples of embedded systems:

1. Consumer Electronics: Camcorders, Cameras.

2. Computer peripherals: Printers, scanners, fax machines.

3. Healthcare: EEG, ECG machines.

4. Card Readers: Barcode, smart card readers.

5. Robotics: stepper motor controllers for a robotic system.

6. Entertainment systems: video games, music system.

General Purpose Computing System Vs Embedded System

General Purpose Computing system: It is combination of generic hardware and a general purpose OS for executing a variety of applications.

Applications are alterable (programmable) by the user.

Embedded system: It is combination of special purpose hardware and embedded OS for executing specific set of applications.

Applications are non-alterable by the user.

CLASSIFICATION OF ES:

This class deals on classifications of embedded systems based on different parameters so that by which you can decide which class suites your application

Embedded systems can be classified based on following criteria:

(a) On generation

(b) On complexity & performance

(c) On deterministic behaviour

(d) On triggering

Classification based on generation:

First generation (1G) : 8-bit μp and 4-bit μc.

Second generation (2G) : 16-bit μp and 8-bit μc.

Third generation (3G) : 32-bit μp and 16-bit μc.

Fourth generation (4G) : 64-bit μp and 32-bit μc.

Classification based on Complexity and performance: Small-scale, Medium-scale, Large-scale

  • Small-scale: Simple applications where the performance requirements are not time-critical.
  • Medium-scale: Slightly complex in hardware and firmware requirement.
  • Large-scale: Highly complex hardware & firmware.

Classification based on deterministic behaviour

  • This classification is applicable for “Real Time” systems.

Classification based on triggering

  • Embedded systems which are “Reactive” in nature can be based on triggering.
  • Reactive systems can be Event triggered (or) Time triggered

ELEMENTS OF EMBEDDED SYSTEMS:

This class provides basic idea on the elements that are used for embedded systems

Sensors  connected to the input port  to sense/detect the changes in the input variables

 Converts input variables into electrical signals for any measurements/ control purpose

Actuators  connected at the output port

 Converts electrical signals into corresponding physical action .

Memory for the program: ROM

Memory for data: RAM

Input and output ports: P1, P2, P3…….

Address and data buses

Clock

Central processing unit

Timers

Watchdog timer

Communication interfaces

Non-volatile memory for data

Analog-to-digital converter

Digital-to-analog converter

Real-time clock

I/O INTERFACE – MEMORY MAPPED I/O, ENDIANNESS

This class deals on different mapping techniques and the way in which data is stored in memory by processor.

Memory mapped I/O

I/O devices are mapped into the system memory map. I.e. Common address space for memory and I/O ports (The I/O ports are viewed as memory locations and are addressed likewise)

Port mapped I/O

I/O devices are mapped into a separate address space. i.e., there is separate address space for memory and I/O ports.

Endianness specifies the order which the data is stored in the memory by processor operations in a multi byte system.

Little-endian means lower order data byte is stored in memory at the lowest address and the higher order data byte at the highest address.

Big-endian means the higher order data byte is stored in memory at the lowest and the lower order data byte at the highest address.

RISC VS CISC, VON-NEUMANN & HARVARD ARCHITECTURE

This class gives you the major difference between two sets of instructions that are used by the processor and the basic idea on two different architectures such as Harvard and Von-Neumann

RISC and CISC are the two common Instruction Set Architectures (ISA) available for processor design.

RISC (Reduced Instruction Set Computer)): Supports lesser number of instructions.

Supports few addressing modes for memory access and data transfer instructions.

CISC (Complex Instruction Set Computer): Supports greater number of instructions.

Supports many addressing modes for memory access and data transfer instructions.

Harvard or Von- Neumann.

Harvard

It has separate buses for instruction as well as data fetching. This means that, the data memory and program memory are separated.

Von- Neumann.

It shares single common bus for instruction and data fetching. This means that only one set of addresses covers both data memory and program memory. The memory map shows the addresses at which each type of memory is located.

MSP 430 – INTRODUCTION & FEATURES

Low Power RISC : MSP 430 – introduction & features

The MSP430 microcontroller from Texas Instruments (TI) is a 16-bit RISC based Mixed Signal Processor with Von-Neumann architecture, designed for low power and portable applications.

Characteristics of MSP430:

  • Flash (or) ROM-based low-power MCUs
  • CPU clock : 8/16 MHz
  • Operating voltage : 1.8–3.6 V
  • Power specification overview, as low as:
  • 0.1 μA RAM retention
  • 0.7 μA real-time clock mode peration
  • 160 - 250 µA/MIPS at active operation
  • Fast wake-up from standby mode in less than 1 µs.
  • Device parameters
  • Flash/ ROM options: 1 KB – 60 KB
  • RAM options: 128 B– 8 KB
  • GPIO options: 14 - 80 pins
  • Other integrated peripherals:
  • 10/12/16-bit Analogue-to-Digital Converter (ADC);
  • 12-bit dual Digital-to-Analogue Converter (DAC);
  • Comparator-gated Timers;
  • Watch Dog Timer
  • SPI, I2C, UART
  • Operational Amplifiers (OP Amps)
  • 16×16 multiplier
  • Comparator_A
  • Temp. sensor
  • LCD driver
  • Supply Voltage Supervisor (SVS)
  • Brown out Reset
  • 16 bit RISC CPU:
  • Instructions processing on either bits, bytes or words;
  • Compact core design reduces power consumption and cost;
  • Compiler efficient;
  • 27 core instructions;
  • 7 addressing modes;
  • Extensive vectored-interrupt capability.

VARIANTS OF MSP 430 FAMILY – 1XX, 2XX, 3XX, 4XX, 5XX:

This class deals on different variants of MSP430 family:

VARIANT OF FAMILY / POWER SPECIFICATIONS / DEVICE PARAMETERS / OTHER INTEGRATED PERIPHERALS
MSP430x1xx / 0.1 μA RAM retention
0.7 μA real-time clock mode
200 μA / MIPS active
Features fast wake-up from standby mode in less than 6 µs. / Flash/ROM options: 1–60 KB
RAM options: 128 B– 2 KB
GPIO options: 14/22/48 pins
ADC options: Slope, 10 & 12-bit SAR / 12-bit DAC, up to 2 16-bit timers, WDT, brown-out reset, SVS, USART module (UART, SPI), DMA, 16×16 multiplier, Comparator_A, Temp. sensor
MSP430F2xx / 0.1 μA RAM retention
0.3 μA standby mode (VLO)
0.7 μA real-time clock mode
220 μA / MIPS active
Feature ultra-fast wake-up from standby mode in less than 1 μs / Flash/ROM options: 1 KB–60 KB
RAM options: 128 B – 8 KB
GPIO options: 10/16/24/32/48 pins
ADC options: Slope, 10 & 12-bit SAR, 16 & 24-bit Sigma Delta / operational amplifiers, 12-bit DAC, up to 2 16-bit timers, watchdog timer, brown-out reset, SVS, USI module (I²C, SPI), USCI module, DMA, 16×16 multiplier, Comparator_A+, Temperature sensor
MSP430x3xx / 0.1 μA RAM retention
0.9 μA real-time clock mode
160 μA / MIPS active
Features fast wake-up from standby mode in less than 6 µs. / ROM options: 2–32 KB
RAM options: 512 B–1 KB
GPIO options: 14/40 pins
ADC options: Slope, 14-bit SAR / LCD controller, multiplier
MSP430x4xx / 0.1 μA RAM retention
0.7 μA real-time clock mode
200 μA / MIPS active
Features fast wake-up from standby mode in less than 6 µs. / Flash/ROM options: 4 KB– 60 KB
RAM options: 256 B – 8 KB
GPIO options: 14/32/48/56/68/72/80 pins
ADC options: Slope, 10 & 12-bit SAR, 16-bit Sigma Delta / 12-bit DAC, Op Amps, RTC, up to two 16-bit timers, watchdog timer, basic timer, brown-out reset, SVS, USART module (UART, SPI), USCI module, LCD Controller, DMA, 16×16 & 32x32 multiplier, Comparator_A, Temp. sensor
MSP430x5xx / 0.1 μA RAM retention
2.5 μA real-time clock mode
165 μA / MIPS active
Features fast wake-up from standby mode in less than 5 µs. / Flash options: up to 512 KB
RAM options: up to 66 KB
ADC options: 10 & 12-bit SAR
GPIO options: 29/31/47/48/63/67/74/87 pins / High resolution PWM, 5 V I/O's, USB, backup battery switch, up to 4 16-bit timers, watchdog timer, Real-Time Clock, brown-out reset, SVS, USCI module, DMA, 32x32 multiplier, Comp B, temperature sensor
MSP430x6xx / 0.1 μA RAM retention
2.5 μA real-time clock mode
165 μA / MIPS active
Features fast wake-up from standby mode in less than 5 µs. / Flash options: up to 512 KB
RAM options: up to 66 KB
ADC options: 10 & 12-bit SAR
GPIO options: 74/90 pins / USB, LCD, DAC, Comparator_B, DMA, 32x32 multiplier, power management module (BOR, SVS, SVM, LDO), watchdog timer, RTC, Temp sensor

BLOCK DIAGRAM OF MSP430 F2013/ F2003 MICROCONTROLLER:

In this class you are going to learn the basic architecture of MSP430

CPU architecture registers and Memory map of MSP430

This class gives you basic idea on how the memory is organized in msp430 and cpu architecture which deals on special purpose and general purpose registers.

Memory map of MSP430 CPU Architecture

Addressing modes of MSP430:

This class deals different addressing modes that are used in MSP430 micro controller.

S.No. / Addressing Mode / Syntax / Description / As / Ad
1 / Register mode / Rn / Register contents are operand / 00 / 0
2 / Indexed mode / X(Rn) / (Rn + X) points to the operand. / 01 / 1
3 / Symbolic mode / PC relative / LABLE / (PC + X) points to the operand.
X = Offset address =
Address of LABLE - PC
Indexed mode X(PC) is used
4 / Absolute mode / &ADDR / The word following the instruction contains the absolute address.
Indexed mode X(SR) is used,
where X= ADDR, SR =0.
5 / Indirect register mode / @Rn / Rn is used as a pointer to the operand. / 10 / --
6 / Indirect autoincrement / @Rn+ / Rn is used as a pointer to the operand.
Rn is incremented afterwards by 1 for .B instructions and by 2 for .W instructions. / 11 / --
7 / Immediate mode / #N / The word following the instruction contains the immediate constant N.

Instruction formats and Instruction timings

  • An instruction is a command given to the processor/controller to perform a given task on specified data. Each instruction has 2- parts:

(a) The task to be performed – called as Operation code (Opcode)

(b) The data to be operated on – called as Operand.

Instruction

OPCODE / OPERAND
  • There are three core-instruction formats:

(i) Dual-operand

(ii) Single-operand

(iii) Jump

Instruction set of MSP430:

In class you will learn different instructions which are useful to program MSP430

(i) Movement Instructions (Data Transfer)

(ii) Arithmetic and Logic Instructions

(iii) Shift and Rotate Instructions

(iv) Control Transfer instructions (Branch/Subroutine/Interrupt)

Movement Instructions / Arithmetic and Logic Instructions / Arithmetic Instructions with One operand / Decimal Arithmetic Instructions / Logic Instructions with Two operands
mov.w src, dst / add.w src, dst / clr.w dst / dadd.w src, dst / and.w src, dst
push.w src / addc.w src, dst / dec.w dst / dadc.w dst / xor.w src, dst
pop.w dst / adc.w dst / decd.w dst / bit.w src, dst
sub.w src, dst / inc.w dst / bis.w src, dst
subc.w src, dst / incd.w dst / bic.w src, dst
sbc.w dst / tst.w dst
cmp.w src,dst
Logic Instructions with ONE operand & Byte manipulation
inv.w dst
swpb dst
sxt dst
Operations on Bits in Status Register / Shift and Rotate Instructions / Control Trasnfer Instructions
Clrc / rla dst / br src
Clrn / rra dst / call src
Clrz / rlc dst / ret
Setc / rrc dst / reti
Setn / nop
Setz
Dint
Eint
Control Trasnfer Instructions
jmp label
jc / jlo label
jnc / jhs label
Jz / jeq label
Jnz / jne label
jn label
jge label
jl label

SAMPLE EMBEDDED SYSTEM ON MSP 430:

In this class with the help of knowledge acquired from the previous classes you are going to analyse sample embedded system (weighing machine) as shown in below fig:

Main blocks used:

  • The sensor has four resistive elements arranged as a Wheatstone bridge. Ideally, this is balanced when there is no load, giving V+ = V− . Two of the resistances increase and two decrease when a weight is placed on the scale pan, driving the bridge out of balance.
  • A differential amplifier magnifies the difference in voltage between its input terminals, giving Vout = A(V+ −V−), where A is the gain.
  • The analog output of the amplifier is converted to a binary value by A/D converter.
  • The microcontroller multiplies the input by an appropriate factor so that the display gives the weight in grams or ounces and subtracts an offset so that the display reads zero when no weight is present. It also reads the buttons and supervises the complete system.
  • There is a serial interface between the microcontroller and the liquid crystal display, which has a built-in controller.

MSP430x5x series block diagram:

In this class you will learn variant of MSP430 family MSP430X5X

Memory map / Address space of MSP430x5xx:

On-chip peripherals (analog and digital)

• Memory for the program: Non-volatile (read-only memory, ROM), meaning that it retains its contents when power is removed.

• Memory for data: Known as random-access memory (RAM) and usually volatile.

• Input and output ports: To provide digital communication with the outside world.

• Address and data buses: To link these subsystems to transfer data and instructions.

• Clock: To keep the whole system synchronized. It may be generated internally or obtained from a crystal or external source; modern MCUs offer considerable choice of clocks.

• Timers: Most microcontrollers have at least one timer because of the wide range of functions that they provide.

• Watchdog timer: This is a safety feature, which resets the processor if the program becomes stuck in an infinite loop.

• Communication interfaces: A wide choice of interfaces is available to exchange information with another IC or system. They include serial peripheral interface (SPI), inter-integrated circuit (I²C or IIC), asynchronous (such as RS-232), universal serial bus (USB), controller area network (CAN), ethernet, and many others.

• Non-volatile memory for data: This is used to store data whose value must be retained when power is removed. Serial numbers for identification and network addresses are two obvious candidates.

• Analog-to-digital converter: This is very common because so many quantities in the real world vary continuously.

• Digital-to-analog converter: This is much less common, because most analog outputs can be simulated using PWM. An important exception used to be sound, but even here, the use of PWM is growing in what are called class D amplifiers.

• Real-time clock: These are needed in applications that must track the time of day. Clocks are obvious examples but data loggers are also an important case.

CPU architecture and Register sets:

In this class you will learn about the CPU architecture of msp430.

I/O ports pull up/down registers concepts:

In this class you will learn about different input and output ports which are used to interface I/O devices to micro controller and concepts regarding pull-up and pull down resisters.

MSP430x5xx devices have up to 12 digital I/O ports : P1 to P11 and PJ. Most ports have eight I/O pins

PxSEL(Port Selection) : selects either digital I/O (0) or an alternate function (1)

PxDIR(Port Direction) : configures the corresponding pin for input mode(0) or output mode(1)

PxIN(Port Input) : Reads the voltage levels on input pins, if they are configured as GPIO.

This is read-only register, and reflects the current status of port pins.

PxOUT (Port Input) : Sends the value to be driven to each pin, if it is configured as GPIO

PxREN ( Port Resistor Enable) : Enables pull-up / pull-down resistors on input pins.

1  Enables pull-up / pull-down resistors

0  Disables pull-up / pull-down resistors

If the pin is configured in input mode and PxREN is enabled then, the corresponding bit

in PxOUT register selects whether the resistors are pull-up (1) or pull-down (0)

PxIE (Interrupt Enable) : Each bit enables (1) or disables (0) the interrupt for that particular pin

PxIES ( Interrupt Edge Select) : Selects whether a pin will generate an interrupt on

the rising-edge (0) or the falling-edge (1)

PxIFG (Interrupt Flag) : Set whenever the interrupt is detectd on a particular pin