0% found this document useful (0 votes)
37 views36 pages

Unit 01

Uploaded by

Ravilla Vishnu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views36 pages

Unit 01

Uploaded by

Ravilla Vishnu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 36

Unit 01

ARCHITECTURE OF MSP430
Embedded Systems
• An embedded system is a combination of computer hardware and software designed for a
specific function. Embedded systems may also function within a larger system. The
systems can be programmable or have a fixed functionality. Industrial machines,
consumer electronics, agricultural and processing industry devices, automobiles, medical
equipment, cameras, digital watches, household appliances, airplanes, vending machines
and toys, as well as mobile devices, are possible locations for an embedded system.
Structure of embedded systems
Embedded systems vary in complexity but, generally, consist of three main elements:

• Hardware. The hardware of embedded systems is based around microprocessors and microcontrollers.
Microprocessors are very similar to microcontrollers and, typically, refer to a CPU (central processing
unit) that is integrated with other basic computing components such as memory chips and digital signal
processors (DSPs). Microcontrollers have those components built into one chip.

• Software and firmware. Software for embedded systems can vary in complexity. However, industrial-
grade microcontrollers and embedded IoT systems usually run very simple software that requires little
memory.

• Real-time operating system. These are not always included in embedded systems, especially smaller-
scale systems. RTOS es define how the system works by supervising the software and setting rules
during program execution.
A basic embedded system would consist of the following elements:

• Sensors convert physical sense data into an electrical signal.


• Analog-to-digital (A-D) converters change an analog electrical signal
into a digital one.
• Processors process digital signals and store them in memory.
• Digital-to-analog (D-A) converters change the digital data from the
processor into analog data.
• Actuators compare actual output to memory-stored output and
choose the correct one.
• MSP430 is a microcontroller portfolio that offers different varieties of sixteen-bit
Microcontrollers. These microcontrollers are integrated with ultra-low power and digital
and analog peripherals devices for sensing and measurement applications.

• This module consists of five low-power modes that increase battery life in portable
measurement applications.

• MSP430 has a feature of 16-bit registers, sixteen-bit RISC CPU and constant generators
which provides maximum code efficiency.

• The digitally controlled oscillator (DCO) of this module converts low power modes to
active mode in less than 6µs.

• The MSP430x11x series is an ultra-low power signal microcontrollers that consist of a 16-
bit timer and fourteen input and output pinouts.
These are the main features of MCP430,
• It is available in a 20 pin plastic small outline widebody package.
• Its operating voltage range is 2.5v to 5.5 v.
• Its active mode is 330 µA at 1 MHz, 3 V.
• Its stands by mode are 1.5 µA.
• It's off mode (Ram Retention) is 0.1 µA.
• This module is available in 16-bit architecture, 200ns instruction cycle time.
• This module consists of various internal resistors, single external resistor,32 kHz crystal,
high frequency, resonator and external clock source.
• It has a 16-bit timer with a three capture/compare registers.
• In this module, programme protection is done by a security fuse.
• It has serial onboard programming.
• This module has 16 kb flash, 512 B RAM, 10-bit ADC, two 16-bit timer
Introduction, MSP430
a. Powerful processing capability
• MSP430 series microcontroller is a 16-bit microcontroller, using a compact
instruction set (RISC) structure, with a rich addressing mode (7 source operand
addressing, 4 destination operand addressing), concise 27 kernel instructions, and a
large number of analog instructions; a large number of registers and on-chip data
memory can participate in a variety of operations; there is also a highly efficient
look-up table processing instructions. These features ensure that highly efficient
source programs can be produced.
b. Fast computing speed
• In terms of computing speed, the MSP430 series microcontroller can achieve 125ns
instruction cycle driven by 8MHz crystal. 16-bit data width, 125ns instruction cycle
and multi-function hardware multiplier (multiply and add) together, can achieve some
algorithms of digital signal processing (such as FFT, etc.)
c. More interrupt sources
• MSP430 series microcontroller has more interrupt sources and can be arbitrarily nested, flexible
and convenient to use. When the system is in a power-saving standby state, it only takes 6us to
wake it up with an interrupt request.
d. Ultra-low power consumption
• MSP430 microcontroller has ultra-low power consumption because of its unique features in
reducing the chip's supply voltage and flexible and controllable operating clock.
• First, the MSP430 series microcontroller power supply voltage is 1.8 ~ 3.6V voltage. Therefore,
it can run at MHz clock conditions. The chip current will be about 200 ~ 400uA, the clock off
mode of the lowest power consumption of 0.1uA.
• Second, the unique clock system design. In the MSP430 family, there are two different system
clock systems: the basic clock system and frequency-locked loop (FLL and FLL+) clock system
or DCO digital oscillator clock system. Some use one crystal oscillator (32768Hz) and some use
two crystal oscillators). The clocks required for each function are generated by the system clock
system. And these clocks can be turned on and off under the control of instructions, thus
enabling control of the overall power consumption.
e. Stable system operation
• After power-on reset, the CPU is first started by DCOCLK to ensure that the
program starts to execute from the correct position and that the crystal oscillator
has enough starting and stabilization time. Then the software can set the control
bits of the appropriate registers to determine the final system clock frequency. If
the crystal oscillator fails when used as the CPU clock MCLK, the DCO will
automatically start to ensure the system works properly; if the program runs away,
the watchdog can be used to reset it.
f. Rich on-chip peripheral modules
• Members of the MSP430 series microcontroller are integrated with rich on-chip
peripherals. They are watchdog (WDT), analog comparator A, timer A (TimerA),
timer B (TimerB), serial ports 0, 1 (USART0, 1), hardware multiplier, LCD driver,
l 0-bit/l 2-bit ADC, I2C, bus direct data access (DMA), port 0 (P0), ports 1 to 6
(P1 to P6), basic timer (Bas i c Timer) and some other peripheral modules in
different combinations.
g. Convenient and efficient development environment
• At present, the MSP430 series has three types of devices, OPT type(Optane type
memory), FLASH type, and ROM type. These devices have different development means.
For OPT type and ROM type devices are developed using emulators after the successful
burn-in or mask chip. FLASH type has a very convenient development and debugging
environment. Because the device has an on-chip JTAG(Joint Test Action Group) debug
interface and electrically erasable FLASH memory, we use the method of developing by
downloading the program to FLASH first, then controlling the operation of the program
through software in the device, and reading the information in the chip by the JTAG
interface for the designer to debug. This approach requires only a PC and a JTAG
debugger instead of an emulator and programmer.
h. Adapt to the industrial-grade operating environment
• MSP430 series devices are industrial-grade, operating environment temperature of
40 ~ +85 degrees Celsius. The products can be designed for use in industrial
environments.
Architecture of MSP430
Main characteristics of a MSP430 microcontroller

• microcontroller can be characterized by: ▪ 16 bit RISC CPU:


• Low power consumption: Instructions processing on either bits, bytes or
• 0.1 µA for RAM data retention; words;
Compact core design reduces power consumption
• 0.8 µA for real time clock mode operation;
and cost;
• 250 µA/MIPS at active operation.
Compiler efficient;
• Low operation voltage (from 1.8 V to 3.6 V). 27 core instructions;
microcontroller 7 addressing modes;
• < 1 µs clock start-up.
• < 50 nA port leakage. Extensive vectored-interrupt capability.
Flexibility:
• Zero-power Brown-Out Reset (BOR).
Up to 256 kB In-System Programmable (ISP) Flash;
• On-chip analogue devices: Up to 100 pin options;
• 10/12/16-bit Analogue-to-Digital Converter (ADC); USART, I2C, Timers;
• 12-bit dual Digital-to-Analogue Converter (DAC); LCD driver;
• Comparator-gated timers; Embedded emulation.
• Operational Amplifiers (OP Amps);
• Supply Voltage Supervisor (SVS).
Anatomy of microcontroller
Processor Core:
The CPU is the main component of the controller. It contains the arithmetic logic unit
and the registers, stack pointer, program counter, accumulator register, register file, etc.
Memory:
A microcontroller has two types of memory: program memory and data memory. The
program memory, also known as flash memory, holds the code that the microcontroller
executes. Data memory, also known as RAM, holds variables and data that the
microcontroller uses during operation.
Microcontrollers/Microprocessors are manufactured with three types of memories:
Flash memory
RAM Memory
EEPROM memory
The memory is divided into program memory and data memory. DMA controller handles
data transfers between peripherals components and the memory.
Interrupt Controller:
By setting the relevant bits in the interrupt controller registers, an interrupt controller
offers a programmable governing policy that enables software to choose which
peripheral or device can interrupt the processor at any given time.
• Timer / Counter:
Most controllers have at least one and more Timers / Counters. A timer is a
type of clock that is used to measure time intervals. A counter is a device that
records the number of times a specific event or process occurred about a clock
signal.
• Digital I/O:
This is one of the main features of the microcontroller. A digital I/O board is an
interface board that allows a computer to input and output digital signals in
parallel. I/O pins vary from 3-4 to over 90.
• Analog I/O:
Most Of Microcontrollers Have Integrated Analog / Digital Converters.
• Interfaces:
The serial interface can be used to download the program and for general
communication with the development PC. Serial interfaces can also
communicate with external peripheral devices. Most controllers include a
variety of interfaces such as SPI, SCI, PCI, USB, and Ethernet.
• Debugging Unit:
The process of debugging involves finding and fixing current and potential flaws
commonly known as “bugs” in software code that may cause it to act erratically or
crash. Some controllers include additional hardware that enables remote
debugging of the chip from a PC.
• Central Processing Unit (CPU):
The CPU is the core of the microcontroller and is responsible for executing
instructions and performing calculations. It is typically a low-power, low-speed
processor optimized for embedded systems.
• Input/Output (I/O) Peripherals:
Microcontrollers have various input/output peripherals that allow them to
interface with the external world. These include digital and analog input/output
pins, timers, counters, communication interfaces (such as UART, SPI, I2C, and USB),
and pulse width modulation (PWM) outputs.
• Power Management:
Microcontrollers require a stable and consistent power supply to operate correctly.
Power management components, such as voltage regulators, are included on the
chip to ensure that the microcontroller receives the correct voltage and current.
Memory: The "Store"
The MCU’s memory is used to store program code and data. There are two main types of
memory: ROM and RAM.
• ROM (Read-only Memory)
This memory retains its content even while power is off. This memory is for reading only;
it cannot be erased or overwritten. ROM is typically used to store the start-up program
(executed immediately after power-on or reset), and to store constant values that may
be freely accessed by running programs.
Many Renesas MCUs use flash memory in place of ROM. Like ROM, flash memory retains
its content even while power is off. Unlike ROM, this content can be overwritten
• RAM (Random-access Memory)
This memory can be freely rewritten. Its disadvantage is that it loses its content when
the power goes off. This memory is mainly used to store program variables.
Many single-chip MCUs1 use static RAM (SRAM) for their internal RAM. SRAM offers two
advantages it supports faster access, and it does not require periodic refreshment. The
disadvantage is that the internal circuitry is complex, making it difficult to pack large
quantities on the chip’s limited space. SRAM is not suitable for implementing large
memory sizes.
Pinout of 20 pin MSP430G2553
• While there are many pins on the MSP430G2553, here are some of the essential ones:
• P1.0 to P1.7: General-purpose I/O pins on Port 1.
• P2.0 to P2.7: General-purpose I/O pins on Port 2.
• P1.1 (TA0.0): Timer A0, Channel 0 output.
• P1.2 (TA0.1): Timer A0, Channel 1 output.
• P1.6 (TA0.1): Timer A0, Channel 1 input capture.
• P2.0 (UCA0TXD): UART communication (transmit).
• P2.1 (UCA0RXD): UART communication (receive).
• P2.2 (UCB0CLK): SPI(Serial Peripheral Interface) clock.
• P2.3 (UCB0SIMO): SPI data out (master).
• P2.4 (UCB0SOMI): SPI data in (master).
• P2.5 (UCB0STE): SPI chip select (master).
• P2.6 (TA0.0): Timer A0, Channel 0 input capture.
• P2.7 (TA1.0): Timer A1, Channel 0 output.
• P2.7 (TA1.1): Timer A1, Channel 1 output.
• P1.0 to P1.7 (Port 1):
These are general-purpose I/O (input/output) pins on Port 1. You can configure them as either
inputs or outputs. Use them for tasks like reading sensors, driving LEDs, or interfacing with other
digital devices.
• P2.0 to P2.7 (Port 2):
Similar to Port 1, these pins are also general-purpose I/O pins. You can use them for various tasks,
such as connecting buttons, switches, or other peripherals.
• P1.1 (TA0.0):
This pin serves as Timer A0, Channel 0 output. You can use it for generating PWM (pulse-width
modulation) signals, timing events, or measuring intervals.
• P1.2 (TA0.1):
Another timer-related pin! Timer A0, Channel 1 output. Like the previous one, it’s useful for timing
and generating waveforms.
• P1.6 (TA0.1):
This pin is also associated with Timer A0, Channel 1, but it’s used for input capture. You can
measure external events’ timing using this feature.
• P2.0 (UCA0TXD):
UART communication (transmit) pin. Connect it to the corresponding receive pin (usually P2.1) of
another device for serial communication.
• P2.1 (UCA0RXD):
UART communication (receive) pin. Pair it with the transmit pin of another device to establish a UART link.
• P2.2 (UCB0CLK):
SPI (Serial Peripheral Interface) clock pin. Used for synchronous communication with other SPI devices.
• P2.3 (UCB0SIMO):
SPI data out (master) pin. When configured as an SPI master, data flows from this pin to other SPI devices.
• P2.4 (UCB0SOMI):
SPI data in (master) pin. In SPI master mode, data is received from other devices through this pin.
• P2.5 (UCB0STE):
SPI chip select (master) pin. Use it to select specific SPI devices during communication.
• P2.6 (TA0.0):
Timer A0, Channel 0 input capture. Useful for measuring external events’ timing.
• P2.7 (TA1.0):
Timer A1, Channel 0 output. Another timer-related pin for generating waveforms.
• P2.7 (TA1.1):
Timer A1, Channel 1 output. Yet another timer output pin.
The Functional block diagram of MSP430G2553
• The main blocks are linked by the memory address bus (MAB) and memory data bus (MDB).

• These devices have flash memory, 1KB in the F2003 or 2KB in the F2013, and 128 bytes of RAM.

• Six blocks are shown for peripheral functions (there are many more in larger devices). All MSP430s
include input/output ports, Timer_A, and a watchdog timer, although the details differ. The universal
serial interface (USI) and sigma–delta analog-to-digital converter (SD16_A) are particular features of this
device.

• The brownout protection comes into action if the supply voltage drops to a dangerous level. Most
devices include this but not some of the MSP430x1xx family.

• There are ground and power supply connections. Ground is labeled VSS and is taken to define 0V. The
supply connection is VCC. For many years, the standard for logic was VCC =+5V but most devices now
work from lower voltages and a range of 1.8–3.6V is specified for the F2013. The performance of the
device depends on VCC. For example, it is unable to program the flash memory if VCC
Memory

Little-endian ordering: The low-order byte is stored at the lower address and the high-order byte at
the higher address. This is used by the MSP430 and is the more common format.

Big-endian ordering: The high-order byte is stored at the lower address. This is used by the
Freescale HCS08, for instance.
Memory Map
A brief description of each region
• Special function registers: Mostly concerned with enabling functions of some modules and
enabling and signaling interrupts from peripherals. Peripheral registers with byte access and
peripheral
• Registers with word access: Provide the main communication between the CPU and peripherals.
Some must be accessed as words and others as bytes. They are grouped in this way to avoid
wasting addresses. If the bytes and words were mixed, numerous unused bytes would be needed
to ensure that the words were correctly aligned on even addresses.
• Random access memory: Used for variables. This always starts at address 0x0200 and the upper
limit depends on the size of the RAM. The F2013 has 128B.
• Code memory: Holds the program, including the executable code itself and any constant data.
The F2013 has 2KB but the F2003 only 1KB.
• Interrupt and reset vectors: Used to handle “exceptions,” when normal operation of the
processor is interrupted or when the device is reset. This table was smaller and started at 0xFFE0
in earlier devices
• Bootstrap loader: Contains a program to communicate using a standard serial protocol, often with the COM
port of a PC. This can be used to program the chip but improvements in other methods of communication
have made it less important than in the past, particularly for development.

• Information memory:A256B block of flash memory that is intended for storage of nonvolatile data. This
might include serial numbers to identify equipment—an address for a network, for instance—or variables that
should be retained even when power is removed. For example, a printer might remember the settings from
when it was last used and keep a count of the total number of pages printed. The information memory is laid
out with smaller segments of flash than the code memory, which makes it more convenient to erase and
rewrite.
Central Processing Unit
• The central processing unit (CPU) executes the instructions stored in memory.

• It steps through the instructions in the sequence in which they are stored in memory until it
encounters a branch or when an exception occurs (interrupt or reset).

• includes the arithmetic logic unit (ALU), which performs computation, a set of 16 registers
designated R0–R15 and the logic needed to decode the instructions and implement them.

• The CPU can run at a maximum clock frequency f MCLK of 16MHz in the MSP430F2xx family
and some newer MSP430x4xx devices, and 8MHz in the others.

• It is built using static logic, which means that there is no minimum frequency of operation: The
CPU can be stopped and will retain its state until it is restarted.

• This is essential for low-power operation to be straightforward.


The CPU contains the usual stack pointer, program counter, and condition code (status) register. In
addition, there is a single accumulator for data and two index registers for addresses. These three
dedicated registers can be compared with the 12 general-purpose registers in the MSP430, which
can be used for either addresses or data.
Program counter, PC: This contains the address of the next instruction to be executed, “points to” the
instruction in the usual jargon. Instructions are composed of 1–3 words, which must be aligned to even
addresses, so the LSB of the PC is hard-wired to 0.

Stack pointer, SP: When a subroutine is called, the CPU jumps to the subroutine, executes the code there,
then returns to the instruction after the call. It must therefore keep track of the contents of the PC before
jumping to the subroutine, so that it can return afterward. This is the primary purpose of the stack. Some
processors use separate hardware for the stack but the MSP430 uses the top (high addresses) of the main
RAM. The stack pointer holds the address of the most recently added word and is automatically adjusted as
the stack grows downward in memory or shrinks upward
• Status register, SR: This contains a set of flags (single bits), whose functions fall into
three categories. The most commonly used flags are C, Z, N, and V, which give
information about the result of the last arithmetic or logical operation. The Z flag is set if
the result was zero and cleared if it was nonzero, for instance. Decisions that affect the
flow of control in the program can be made by testing these bits.

• Constant generator: This provides the six most frequently used values so that they need
not be fetched from memory whenever they are needed. It uses both R2 and R3 to provide
a range of useful values by exploiting the CPU’s addressing modes.

• General purpose registers: The remaining 12 registers, R4–R15, are general working
registers. They may be used for either data or addresses because both are 16-bit values,
which simplifies the operation significantly
Memory-Mapped Input and Output
• Port P1 input, P1IN: Reading returns the logical values on the inputs if they are
configured for digital input and output. This register is read-only. It is also volatile, which
means that it may change at a time that a program cannot predict. This is of course why
the input port is there, so that the MCU can react to its surroundings. You want to know
when a user presses a button, for instance. This is a reminder that P1IN is not just a
simple memory and that some care is needed when programming in C .

• Port P1 output, P1OUT: Writing sends the value to be driven onto the pin if it is
configured as a digital output. If the pin is not currently an output, the value is stored in a
buffer and appears on the pin if it is later switched to be an output.

• Port P1 direction, P1DIR:Abit of 0 configures the pin as an input, which is the default.
Writing a 1 switches the pin to become an output
Clock Generator
• Crystal: Accurate and stable. Crystals for microcontrollers typically run at either a high frequency of a few
MHz to drive the main bus or a low frequency of 32,768Hz for a real-time clock. The disadvantages are that
crystals are expensive and delicate, the oscillator draws a relatively large current, particularly at high
frequency, and the crystal is an extra component and may need two capacitors as well. Crystal oscillators also
take a long time to start up and stabilize, often around 105 cycles, which is an unavoidable side effect of their
high stability.

• Resistor and capacitor (RC): Cheap and quick to start but used to have poor accuracy and stability. The
components can be external but are now more likely to be integrated within the MCU. The quality of
integrated RC oscillators has improved dramatically in recent years and the F20xx provides four frequencies
calibrated at the factory to within ±1%.

• Master clock, MCLK, is used by the CPU and a few peripherals.

• Subsystem master clock, SMCLK, is distributed to peripherals.

• Auxiliary clock, ACLK, is also distributed to peripherals.


Exceptions: Interrupts and Resets
Execution of a program usually proceeds predictably, but there are two classes of exception to this rule:
interrupts and resets.

1.Interrupts: Usually generated by hardware (although they can be initiated by software) and often indicate that an
event has occurred that needs an urgent response. A packet of data might have been received, for instance, and needs
to be processed before the next packet arrives. The processor stops what it was doing, stores enough information
(the contents of the program counter and status register) for it to resume later on and executes an interrupt service
routine (ISR). It returns to its previous activity when the ISR has been completed. Thus an ISR is something like a
subroutine called by hardware (at an unpredictable time) rather than software. A second use of interrupts, which is
particularly important in the MSP430, is to wake the processor from a low-power state.

2.Resets: Again usually generated by hardware, either when power is applied or when something catastrophic has
happened and normal operation cannot continue. This can happen accidentally if the watchdog timer has not been
disabled, which is easy to forget. A reset causes the device to (re)start from a well-defined state.

You might also like