+ All Categories
Home > Documents > CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ......

CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ......

Date post: 13-Feb-2018
Category:
Upload: vuongkiet
View: 212 times
Download: 0 times
Share this document with a friend
72
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.
Transcript
Page 1: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

1

Introductory SessionBy 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.

Page 2: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

2

Applications and examples of ESThis 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 SystemGeneral 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:

Page 3: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

3

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

Page 4: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

4

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: ROMMemory for data: RAMInput and output ports: P1, P2, P3…….Address and data busesClockCentral processing unitTimersWatchdog timerCommunication interfacesNon-volatile memory for dataAnalog-to-digital converterDigital-to-analog converterReal-time clock

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

Page 5: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

5

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

Page 6: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

6

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 & FEATURESLow Power RISC : MSP 430 – introduction & features

Page 7: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

7

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 MHzOperating voltage : 1.8–3.6 VPower 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:

Page 8: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

8

VARIANT OF FAMILY

POWER SPECIFICATIONS DEVICE PARAMETERS OTHER INTEGRATED PERIPHERALS

MSP430x1xx

0.1 μA RAM retention0.7 μA real-time clock mode200 μA / MIPS activeFeatures fast wake-up from standby mode in less than 6 µs.

Flash/ROM options: 1–60 KBRAM options: 128 B– 2 KBGPIO options: 14/22/48 pinsADC 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 retention0.3 μA standby mode (VLO)0.7 μA real-time clock mode220 μA / MIPS activeFeature ultra-fast wake-up from standby mode in less than 1 μs

Flash/ROM options: 1 KB–60 KBRAM options: 128 B – 8 KBGPIO options: 10/16/24/32/48 pinsADC 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 retention0.9 μA real-time clock mode160 μA / MIPS activeFeatures fast wake-up from standby mode in less than 6 µs.

ROM options: 2–32 KBRAM options: 512 B–1 KBGPIO options: 14/40 pinsADC options: Slope, 14-bit SAR

LCD controller, multiplier

MSP430x4xx

0.1 μA RAM retention0.7 μA real-time clock mode200 μA / MIPS activeFeatures fast wake-up from standby mode in less than 6 µs.

Flash/ROM options: 4 KB– 60 KBRAM options: 256 B – 8 KBGPIO options: 14/32/48/56/68/72/80 pinsADC 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 retention2.5 μA real-time clock mode165 μA / MIPS activeFeatures fast wake-up from standby mode in less than 5 µs.

Flash options: up to 512 KBRAM options: up to 66 KBADC options: 10 & 12-bit SARGPIO 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 retention2.5 μA real-time clock mode165 μA / MIPS activeFeatures fast wake-up from standby mode in less than 5 µs.

Flash options: up to 512 KBRAM options: up to 66 KBADC options: 10 & 12-bit SARGPIO options: 74/90 pins

USB, LCD, DAC, Comparator_B, DMA, 32x32 multiplier, power management module (BOR, SVS, SVM, LDO), watchdog timer, RTC, Temp sensor

Page 9: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

9

BLOCK DIAGRAM OF MSP430 F2013/ F2003 MICROCONTROLLER:In this class you are going to learn the basic architecture of MSP430

Page 10: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

10

CPU architecture registers and Memory map of MSP430This 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

Page 11: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

11

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 / 13 Symbolic mode

/ PC relative LABLE(PC + X) points to the operand.X = Offset address = Address of LABLE - PCIndexed mode X(PC) is used

4 Absolute mode &ADDRThe 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.

Page 12: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

12

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

Page 13: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

13

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, dstpop.w dst adc.w dst decd.w dst bit.w src, dst

sub.w src, dst inc.w dst bis.w src, dstsubc.w src, dst incd.w dst bic.w src, dstsbc.w dst tst.w dstcmp.w src,dst

Page 14: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

14

Logic Instructions with ONE operand & Byte manipulationinv.w dst

swpb dstsxt dst

Operations on Bits in Status Register

Shift and Rotate

Instructions

Control Trasnfer Instructions

Clrc rla dst br src Clrn rra dst call srcClrz rlc dst retSetc rrc dst retiSetn nopSetzDintEint

Page 15: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

15

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:

Control Trasnfer

Instructions

jmp label

jc / jlo label

jnc / jhs label

Jz / jeq label

Jnz / jne label

jn label

jge labeljl label

Page 16: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

16

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

Page 17: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

17

Page 18: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

18

Memory map / Address space of MSP430x5xx:

On-chip peripherals (analog and digital)

Page 19: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

19

• 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.

Page 20: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

20

CPU architecture and Register sets:In this class you will learn about the CPU architecture of msp430.

Page 21: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

21

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 resistors0 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

Page 22: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

22

Interrupts and interrupt programming:This class gives basic idea on processing and handling interrupts :

Page 23: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

23

Interrupt handling mechanism

Watchdog timer:

Its main function is to protect the system against malfunctions but it can instead be used as an interval timer if this protection is not needed.

Page 24: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

24

System clocks:• The MSP430 MCU clock system has the ability to enable and disable

various clocks and oscillators which allow the device to enter various low-power modes (LPMs). The flexible clocking system optimizes overall current consumption by only enabling the required clocks when appropriate.

• Main Clock (MCLK) : CPU source that may be driven by the internal Digitally Controlled Oscillator (DCO) up to 25 MHz or with external crystal.

• Auxiliary Clock (ACLK) : Source for individual peripheral modules driven by the internal low-power oscillator or external crystal

• Sub-Main Clock (SMCLK) : Source for faster individual peripheral modules that may be driven by the internal DCO up to 25 MHz or with external crystal

Page 25: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

25

• ACLK: Auxiliary clock. ACLK is divided by 1, 2, 4, or 8 and is software selectable for individual peripheral modules.

• MCLK: Master clock. MCLK is divided by 1, 2, 4, or 8 and is used by the CPU and system.

• SMCLK: Sub-main clock. SMCLK is divided by 1, 2, 4, or 8 and is software selectable for individual peripheral modules.

Low power modes- Active vs Standby current consumption:

• The MSP430 MCU utilizes six different Low-Power Modes, which can disable unused clocks and CPU.

• This allows the MSP430 to sleep, while its peripherals continue to work without the need for an energy hungry processor.

• Additionally, the MSP430 is capable of wake-up times below 1µs, allowing the microcontroller to stay in sleep mode longer, minimizing its average current consumption.

• The low power modes can be switched by programming the status register.

• In addition to the low power modes MSP 430 can also program two other low power modes as LPM 3.5 and LPM 4.5.

Page 26: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

26

• These LPM 3.5 and LPM 4.5 are present in microcontrollers which consists the inbuilt voltage regulator.

SCG1 SCG0 OSCOFF CPUOFF Mode CPU and Clocks Status

0 0 0 0 Active CPU is active, all enabled clocks are active

0 0 0 1 LPM0 CPU & MCLK are disabled.

SMCLK & ACLK are active

0 1 0 1 LPM1

CPU & MCLK are disabled. ACLK is active.DCO and DC generator are disabled if it is not used for SMCLK

1 0 0 1 LPM2

CPU, MCLK, SMCLK are disabled.DC generator remains enabled. ACLK is active.

1 1 0 1 LPM3 CPU, MCLK, SMCLK, DCO & DC generators

are disabled. ACLK is active. 1 1 1 1 LPM4 CPU and all clocks disabled

FRAM vs Flash for low power & reliability:

Page 27: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

27

Timers of MSP430:

Page 28: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

28

Timer_A Registers :

Register Short Form

Register Type

Timer_A control TACTL Read/writeTimer_A counter TAR Read/writeTimer_A capture/compare control x ( x= 0,1,2…) TACCTLx Read/writeTimer_A capture/compare x ( x= 0,1,2…) TACCRx Read/writeTimer_A interrupt vector TAIV Read only

Page 29: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

29

PWM control, timing generation and measurements: The idea behind PWM is very simple: The load is switched on and off

periodically so that the average voltage has the desired value. There are two main parameters that must be chosen before suitable values

can be selected for PWM:(a) The time period of the output PWM waveform = (TACCR0 +1)

counts The duty cycle of PWM output depends on TACCR1

Page 30: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

30

The frequency of the output waveform

The duty cycle is given by

The average voltage across the output is given by

Real Time Clock (RTC) :The Real-Time Clock (RTC) module provides a clock with calendar that can also be configured as a general purpose counter. It provides seconds, minutes, hours, days, months, and years.

Page 31: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

31

The current time and date are

held in a set of registers that contain the following bytes:

RTCSEC : SecondsRTCMIN : Minute RTCHOUR : Hour which runs from 0–23 (24-hour format).RTCDOW : Day of week which runs from 0–6.RTCDAY : Day of month (1-31)RTCMON : Month (1-12)RTCYEARL : Year, asuming BCD format.RTCYEARH : Century, assuming BCD format.

Page 32: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

32

Comparator in MSP430: An analog comparator compares the voltages on its two input terminals, V+

and V−. The comparator is used to compare a variable input voltage with a reference.

COMPARATOR_A CONTROL REGISTER (CACTL)

Page 33: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

33

Analog interfacing and data acquisition:ADC Specifications:

Accuracy

Resolution or precision

The quantization error

Input range

Noise and filtering

Page 34: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

34

The ADC10 : Successive Approximation ADC:

Features:

16-bit sigma-delta architecture Up to 7- independent, simultaneously-sampling ADC channels. Up to 8 -multiplexed differential analog inputs per channel Software selectable internal or external reference Built-in temperature sensor accessible by all channels Up to 1.1 MHz modulator input frequency High impedance input buffer Selectable low-power conversion mode

Page 35: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

35

Data transfer using DMA: The direct memory access (DMA) controller transfers data from one address

to another, without CPU intervention, across the entire address range. For example, the DMA controller can move data from the ADC10 conversion memory to RAM.

The DMA controller has 4 addressing modes. Fixed address to fixed address Fixed address to block of addresses Block of addresses to fixed address Block of addresses to block of addresses

Page 36: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

36

Case study: Remote Controller of Air Conditioner:• ultra-low power, general purpose, infrared remote controller solution

• Design Features:-

Ultra Low Power with FRAM Technology

Infrared Code Sending with Optimized Timer

Matrix Key Scan for 14 Buttons

Segment LCD

• Featured Applications:-

• Infrared LCD Remote Controller

Page 37: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

37

Software implementation:

• software implements an interrupt-driven structure:-

main loop, the MCU stays in LPM3.5 mode

Interrupts from the button, RTC, and timer wake up the MCU for task processing

Inputs from the button are processed in task KeyProcess : LCD display and infrared signal

RTC generates a 3S interval interrupt to inform the system of battery voltage measurement.

Page 38: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

38

Serial communication basics:

Within a micro-computer system, the data transfer is in parallel because it is the fastest method. But transferring the data over long distances, the parallel data transmission requires too many wires and it is complicated and expensive. Therefore, the data to be sent for long distances is converted into serial form so that it can be sent on a single wire.

Methods of serial data transmission:

1. Simplex Ex: CPU to CRT display, Key board to CPU, Radio signal

2. Half-duplex Ex: Walkie Talkie

3. Full-duplex Ex: Telephone communication

Page 39: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

39

Communication Interfaces -Synchronous/Asynchronous:

Synchronous data transmission Asynchronous data transmission

Transmitter and Receiver are operated with same CLK frequency.

SYNC pulses are required

A group of characters can be transmitted after sending the SYNC pulses

It is used in high speed data transmission

Generally used between CPU and other devices on the same PCB, as the same power supply and CLK are used.

Ex: SPI, I2C

Transmitter and Receiver can operated with different CLK frequency.

START and STOP bits are required

For each character, the START & STOP bits are required.

It is used in low speed data transmission

It is used to exchange data with other equipment such as PC.

Ex: UART

Page 40: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

40

UART protocol:• In MSP430 serial communication is handled by an on chip peripheral called USCI

(Universal Serial Communication Interface). It has two USCI modules names as USCI_A0 and USCI_B0 for handling multiple communication formats. USCI_A0 can be configured to handle IrDA, SPI and UART while USCI_B0 can handle SPI and I2C.

Page 41: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

41

I2C protocol: The I²C bus was introduced by Philips (now NXP) Semiconductors. The I²C bus uses only two bidirectional lines - Serial data (SDA) and Serial

clock (SCL). Of course there must be a connection for ground as well. It is often called the two-wire interface. Thus I²C provides the full functionality of a bus while using fewer lines than

SPI. Transfers on the bus take place between a master and a slave. Each slave has a unique address, which is usually 7 bits long. The master starts the transfer, provides the clock, addresses a particular

slave, manages the transfer, and finally terminates it. There may be more than one master on the bus although only one can be in

control at a time.

Page 42: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

42

SPI protocol:

SPI was introduced by Motorola It is the simplest synchronous full duplex communication

protocol. SPI is a single master multi-slave system SPI works on the principle of ‘Shift Registers’.

Page 43: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

43

Implementing and programming UART, I2C, SPI interface using MSP430UART PROGRAMMING:

Page 44: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

44

SPI PROGRAMMING:

Page 45: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

45

Case study - A Low-Power Battery less Wireless Temperature and Humidity Sensor with Passive Low Frequency RFID

• Several applications require hermetically sealed environments, where physical parameter measurements such as temperature, humidity, or pressure are measured and, for several reasons, a battery-less operation is required

• In such applications, a wireless data and power transfer is necessary

• This can be implementing with wireless humidity and temperature sensor comprising a SHT21 from Sensrion, a MSP430F2274 microcontroller, and a TMS37157 PaLFI (passive low-frequency interface).

The application is divided in four steps:

1. Charge phase2. Downlink phase3. Measurement and recharge phase4. Uplink phase

Page 46: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

46

Hardware Description:

MSP430F2274

• The MSP430F2274 is a 16-bit microcontroller from the 2xx family of the ultra-low-power MSP430™ family

• The supply voltage for this microcontroller ranges from 1.8 V to 3.6V. The MCU is capable of operating at frequencies up to 16 MHz.

• It has internal VLO that operates at 12 kHz at room temperature

• It has two timers (Timer_A and Timer_B), each with three capture/compare registers.

• An integrated 10-bit analog-to-digital converter (ADC10) supports conversion rates of up to 200 ksps.

• The current consumption of 0.7 mA during standby mode (LPM3) and 250 mA during active mode makes it an excellent choice for battery-powered applications.

TMS37157 PaLFI

• The TMS37157 PaLFI(Passive low frequency ) is a dual interface passive RFID product from Texas Instruments. The device can communicate via the RF and the SPI (wired) interfaces.

• It offers 121 bytes of programmable EEPROM memory.

• SHT21 Humidity and Temperature Sensor:

• The extremely small SHT21 digital humidity and temperature sensor integrates sensors, calibration memory, and digital interface on 3x3 mm footprint.

• This results in cost savings, because no additional components are need and no investments in calibration equipment or process are necessary.

• One-chip integration allows for lowest power consumption, thus enabling energy harvesting and passive RFID solutions

Page 47: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

47

Page 48: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

48

IoT overview IoT is the internetworking of physical devices (also referred to as connected devices and smart devices), vehicles, buildings and other items embedded with electronics, software, sensors, actuators and network connectivity that enable them to collect and exchange data.

IOT technologies in detail:

Sensors and Actuators: These form the front end of the IoT devices.Processors: Analysis & processing: Processors are the brain of the IoT system.Gateways: Gateways are responsible for routing the processed data and send it to proper locations for its (data) proper utilization.Management: This functional block provides various functions to govern the IoT system.

Page 49: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

49

Applications: Applications form another end of an IoT system. Applications are essential for proper utilization of all the data collected.

IoT architecture and services:

Page 50: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

50

CC3100: Simple Link Wi-Fi Network Processor:The CC3100 device is the industry's first Wi-Fi Certified chip used in the wireless networking solution. The CC3100 device is part of the new Simple Link Wi-Fi family that dramatically simplifies the implementation of Internet connectivity.

CC3100 Hardware CC3100 Software

Features of CC3100:1. Dedicated ARM MCU 2. Wi-Fi Driver and Multiple Internet Protocols in ROM3. TCP/IP and TLS/SSL stacks4. ROM Code Memory size is 7KB and Data memory RAM is 700 Bytes.5. Power Management System: VBAT Wide-Voltage Mode: 2.1 to 3.6 V

Pre-regulated 1.85-V Mode5. Advanced Low-Power Modes6. Clock Source: 32.768 kHz Crystal or External RTC Clock

Page 51: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

51

7. Ambient Temperature Range: –40°C to 85°C

Adding Wi-Fi capability to the Microcontroller- Embedded Wi-Fi:

Microcontroller based design can be easily connected to the internet with Wi-Fi using the TI Simple Link CC3000/CC3100 network processor module.

The TI CC3100 module is a self-contained wireless network processor that simplifies the implementation of Internet connectivity, and it allows your device to connect on a network using a smart phone, PC or tablet.

INTERFACING CC3100 TO MICRO CONTROLLER UNIT

Page 52: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

52

User APIs for Wireless and Networking applications

Device API – Manages hardware-related functionality such as start, stops, set, and get deviceconfigurations.WLAN API – Manages WLAN, 802.11 protocol-related functionality such as device mode (station,AP, or P2P), setting provisioning method, adding connection profiles, and setting policy.Socket API – The most common API set for user applications, and adheres to BSD socket APIs. NetApp API – Enables different networking services including the Hypertext Transfer Protocol (HTTP) server service, DHCP server service, and MDNS client\server service.NetCfg API – Configures different networking parameters, such as setting the MAC address,acquiring the IP address by DHCP, and setting the static IP address. File System API – Provides access to the serial flash component for read and write operations of networking or user proprietary data.

Host Interface : Interfaces over a 4-wire serial peripheral interface (SPI) with any MCU or a

processor at a clock speed of 20 MHz. Interfaces over UART with any MCU with a baud rate up to 3 Mbps. Simple APIs enable easy integration with any single-threaded or

multithreaded application. The CC3100BOOST and the MSP430F5529 are connected via the SPI interface

as shown in below.

Page 53: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

53

Case study: Implementing Wi-Fi Connectivity in a Smart Electric Meter:

• System Description : A smart meter is an electronic device that records consumption of electric energy in intervals of an hour or less and communicates that information at least daily back to the utility for monitoring and billing.

• Smart meters enable two-way communication between the meter and the central system. Unlike home energy monitors, smart meters can gather data for remote reporting.

• The software energy library supports calculation of various parameters for up to 3-phase energy measurement.

• The key parameters calculated during energy measurements are: RMS current and voltage, active and reactive power and energies, power factor, and frequency.

• For the Simple Link Wi-Fi transceiver, the CC3100 is used. This simplifies the implementation of Internet connectivity.

• The CC3100 device integrates all protocols for Wi-Fi and Internet, which greatly minimizes host MCU software requirements.

Page 54: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

54

Foreground Process:

Page 55: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

55

BACKGROUND PROCESS:

Page 56: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

56

Page 57: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

57

Page 58: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

58

Page 59: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

59

Page 60: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

60

Page 61: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

61

Page 62: CLASS - Web viewUnderstand the concept Real time clock and PWM based applications. 4. ... Monitoring, Control, Application specific user ... stepper motor controllers for a robotic

IV B.Tech. I Sem (R13) ECE :EMBEDDED SYSTEMSCLASS

62


Recommended