MSP430 eZ430-rf2500
Guillaume Salagnac
November 29, 2011
1
Embedded Systems
WikipediaAn embedded system is a computer system designed for specific controlfunctions within a larger system, often with real-time computing constraints.It is embedded as part of a complete device often including hardware andmechanical parts.
2
Consumer Electronics
3
ez430-RF2500 SLAU227A.pdf p.2
2
1. eZ430-RF2500 Overview. Wireless Made Easy.
The eZ430-RF2500 is a complete USB-based MSP430 wireless development tool providing all the hardware and software to evaluate the MSP430F2274 microcontroller and CC2500 2.4-GHz wireless transceiver.
The eZ430-RF2500 uses the IAR Embedded Workbench Integrated Development Environment (IDE) or Code Composer Essentials (CCE) to write, download, and debug an application. The debugger is unobtrusive, allowing the user to run an application at full speed with both hardware breakpoints and single stepping available while consuming no extra hardware resources.
The eZ430-RF2500T target board is an out-of-the box wireless system that may be used with the USB debugging interface, as a stand-alone system with or without external sensors, or may be incorporated into an existing design.
The new USB debugging interface enables the eZ430-RF2500 to remotely send and receive data from a PC using the MSP430 Application UART.
eZ430-RF2500 features:
• USB debugging and programming interface featuring a driverless installation and application backchannel
• 21 available development pins
• Highly integrated, ultra-low-power MSP430 MCU with 16-MHz performance
• Two general-purpose digital I/O pins connected to green and red LEDs for visual feedback
• Interruptible push button for user feedback
Figure 1. eZ430-RF2500
MSP430F2274
18 Accessible Pins
Chip Antenna
CC25002x LEDsPushbutton
USB Powered
Spy Bi-Wire &
MSP430 Appliation UART
4
ez430-RF2500 SLAU227A.pdf p.3
3
Figure 2. eZ430-RF2500 Battery Board
2. Kit Contents, eZ430-RF2500
• The hardware includes:
• Two eZ430-RF2500T target boards
• One eZ430-RF USB debugging interface
• One AAA battery pack with expansion board (batteries included)
• One MSP430 Development Tool CD-ROM containing documentation and new development software for eZ430-RF2500:
• MSP430x2xx Family User’s Guide, SLAU144
• eZ430-RF2500 User’s Guide, SLAU227
• Code Composer Essentials (CCE), SLAC063
• IAR Embedded Workbench (KickStart Version), SLAC050
• eZ430-RF2500 Sensor Monitor (Code and Visualizer), SLAC139
NOTE: Please visit Texas Instrument’s website for latest versions www.ti.com/msp430
5
Low-power Operation
Power
Time
1mW
0.1µW
6
Outline
1 Introduction
2 Schematics and Pinout
3 Internal structure
4 Digital Input/Output
5 Interrupts
6 Managing time
7 Serial Communication
8 Analog Input/Output
9 Conclusion
7
Target board schematics SLAU227A.pdf p.16
16
Figure 10. eZ
430-RF
2500T, T
arget Board and B
attery Board, S
chematic
8
Target board PCB layout SLAU227A.pdf p.17
17
Figure 11. eZ430-RF, USB Debugger, PCB Components Layout
Figure 12. eZ430-RF, USB Debugger, PCB Layout
Figure 13. eZ430-RF2500T, Target Board, PCB Layout
Top Layer Bottom Layer
9
Debugger board schematics SLAU227A.pdf p.14
14
13. eZ430-R
F2500 Schem
atics
F
igure 8. eZ430-R
F, U
SB
Debugging Interface, S
chematic
10
Debugger board schematics SLAU227A.pdf p.15
15
F
igure 9. eZ430-R
F, U
SB
Debugging Interface, S
chematic
11
MSP430F2274 device pinout SLAS504B.pdf p.5
MSP430x22x2, MSP430x22x4MIXED SIGNAL MICROCONTROLLER
SLAS504B ! JULY 2006 ! REVISED JULY 2007
5POST OFFICE BOX 655303 • DALLAS, TEXAS 75265POST OFFICE BOX 1443 • HOUSTON, TEXAS 77251!1443
MSP430x22x4 device pinout, RHA package
1DVSS
P1
.5/T
A0/
TM
S
P1.0/TACLK /ADC 10CLK
P1.1/TA 0
P1
.2/T
A1
P1
.3/T
A2
P1
.4/S
MC
LK
/TC
K
13
P2.4/TA 2/A4/VREF+/VeREF+/OA1I0
P2.
5/R
osc
DV
CC
TE
ST
/SB
WT
CK
P1
.6/T
A1/
TD
I/TC
LK
2
3
4
5
6
7
8
10
9
12 14 15 16 17 18 19
30
29
28
27
26
25
24
23
21
22
3839 37 36 35 34 33 32
XOUT /P2.7
XIN /P2.6
DVSS
RST/NMI/SBWTDIO
P2.0/ACLK /A0/OA 0I0
P2.1/TAINCLK /SMCLK /A1/OA 0O
P2.2/TA 0/A2/OA 0I1
P3.0/UCB 0STE /UCA 0CLK /A5
P3.1/UCB 0SIMO /UCB 0SDA
DV
CC
P1.
7/T
A2/
TD
O/T
DI
P2.3/TA 1/A3/VREF!/VeREF!/OA 1I1/OA1O
P3.7/A7/OA 1I2
P3.6/A6/OA 0I2
P3.5/UCA 0RXD /UCA 0SOMI
P3.4/UCA 0TXD /UCA 0SIMO
AV
CC
AV
SS
P3.
2/U
CB
0S
OM
I/UC
B0
SC
L
P3
.3/U
CB
0CL
K/U
CA
0S
TE
P4
.0/T
B0
P4
.1/T
B1
P4
.2/T
B2
P4
.3/T
B0
/A1
2/O
A0
O
P4
.4/T
B1
/A1
3/O
A1
O
P4
.5/T
B2
/A1
4/O
A0
I3
P4.6/TBOUTH/A15/OA 1I3
P4.7/TBCLK
12
MSP430F2274 Functional Block Diagram SLAS504B.pdf p.6
MSP430x22x2, MSP430x22x4MIXED SIGNAL MICROCONTROLLER
SLAS504B ! JULY 2006 ! REVISED JULY 2007
6 POST OFFICE BOX 655303 • DALLAS, TEXAS 75265POST OFFICE BOX 1443 • HOUSTON, TEXAS 77251!1443
MSP430x22x2 functional block diagram
Basic ClockSystem+
RAM
1kB512B512B
BrownoutProtection
RST/NMI
VCC VSS
MCLK
SMCLK
WatchdogWDT+
15/16!Bit
Timer_A3
3 CCRegisters
16MHzCPU
incl. 16Registers
Emulation(2BP)
XOUT
JTAGInterface
Flash
32kB16kB8kB
ACLK
XIN
MDB
MAB
Spy!Bi Wire
Timer_B3
3 CCRegisters,Shadow
Reg
USCI_A0:UART/LIN,IrDA, SPI
USCI_B0:SPI, I2C
ADC1010!Bit
12Channels,Autoscan,
DTC
Ports P1/P2
2x8 I/OInterrupt
capability,pull!up/down
resistors
Ports P3/P4
2x8 I/Opull!up/down
resistors
P1.x/P2.x
2x8
P3.x/P4.x
2x8
NOTE: See port schematics section for detailed I/O information.
MSP430x22x4 functional block diagram
Basic ClockSystem+
RAM
1kB512B512B
BrownoutProtection
RST/NMI
VCC VSS
MCLK
SMCLK
WatchdogWDT+
15/16!Bit
Timer_A3
3 CCRegisters
16MHzCPU
incl. 16Registers
Emulation(2BP)
XOUT
JTAGInterface
Flash
32kB16kB8kB
ACLK
XIN
MDB
MAB
Spy!Bi Wire
Timer_B3
3 CCRegisters,Shadow
Reg
USCI_A0:UART/LIN,IrDA, SPI
USCI_B0:SPI, I2C
OA0, OA1
2 Op Amps
ADC1010!Bit
12Channels,Autoscan,
DTC
Ports P1/P2
2x8 I/OInterrupt
capability,pull!up/down
resistors
Ports P3/P4
2x8 I/Opull!up/down
resistors
P1.x/P2.x
2x8
P3.x/P4.x
2x8
NOTE: See port schematics section for detailed I/O information.
13
MSP430 16-bit Memory Map SLAU144D.pdf p.1-4
14
Outline
1 Introduction
2 Schematics and Pinout
3 Internal structure
4 Digital Input/Output
5 Interrupts
6 Managing time
7 Serial Communication
8 Analog Input/Output
9 Conclusion
MSP430x22x2, MSP430x22x4MIXED SIGNAL MICROCONTROLLER
SLAS504B ! JULY 2006 ! REVISED JULY 2007
6 POST OFFICE BOX 655303 • DALLAS, TEXAS 75265POST OFFICE BOX 1443 • HOUSTON, TEXAS 77251!1443
MSP430x22x2 functional block diagram
Basic ClockSystem+
RAM
1kB512B512B
BrownoutProtection
RST/NMI
VCC VSS
MCLK
SMCLK
WatchdogWDT+
15/16!Bit
Timer_A3
3 CCRegisters
16MHzCPU
incl. 16Registers
Emulation(2BP)
XOUT
JTAGInterface
Flash
32kB16kB8kB
ACLK
XIN
MDB
MAB
Spy!Bi Wire
Timer_B3
3 CCRegisters,Shadow
Reg
USCI_A0:UART/LIN,IrDA, SPI
USCI_B0:SPI, I2C
ADC1010!Bit
12Channels,Autoscan,
DTC
Ports P1/P2
2x8 I/OInterrupt
capability,pull!up/down
resistors
Ports P3/P4
2x8 I/Opull!up/down
resistors
P1.x/P2.x
2x8
P3.x/P4.x
2x8
NOTE: See port schematics section for detailed I/O information.
MSP430x22x4 functional block diagram
Basic ClockSystem+
RAM
1kB512B512B
BrownoutProtection
RST/NMI
VCC VSS
MCLK
SMCLK
WatchdogWDT+
15/16!Bit
Timer_A3
3 CCRegisters
16MHzCPU
incl. 16Registers
Emulation(2BP)
XOUT
JTAGInterface
Flash
32kB16kB8kB
ACLK
XIN
MDB
MAB
Spy!Bi Wire
Timer_B3
3 CCRegisters,Shadow
Reg
USCI_A0:UART/LIN,IrDA, SPI
USCI_B0:SPI, I2C
OA0, OA1
2 Op Amps
ADC1010!Bit
12Channels,Autoscan,
DTC
Ports P1/P2
2x8 I/OInterrupt
capability,pull!up/down
resistors
Ports P3/P4
2x8 I/Opull!up/down
resistors
P1.x/P2.x
2x8
P3.x/P4.x
2x8
NOTE: See port schematics section for detailed I/O information.
15
GPIO Port Registers
P1DIR: direction, 0=in, 1=outP1OUT: set outputP1IN: read input
16
Figure 10. eZ
430-RF
2500T, T
arget Board and B
attery Board, S
chematic
16
Example
char *P5OUT = (char*) 0x0042;
*P5OUT = 0x13;
volatile unsigned char P5OUT = asm("0x0042");P5OUT = 0x13;
#include <io.h>P5OUT = 0x13;
17
GPIO Port Schematics Example (from another MSP430)
TI eZ430-RF2500
Schéma FET
Brochage et E/S!Brochage du MSP430f2274!Pilotage des Entrées / Sorties!Mapping mémoire desMSP430
!Exemple de port(MSP430f149)
!Exemple de port(MSP430f149)
Exemple
Suite
- p. 11/14
Exemple de port (MSP430f149)
input/output schematic (continued)
port P3, P3.1, input/output with Schmitt−trigger
P3.1/SIMO0
P3IN.1
Pad Logic
EN
D
P3OUT1
P3DIR.1
P3SEL.1
(SI)MO0
0
1
0
1
DCM_SIMO
SYNCMM
STESTC
From USART0
SI(MO)0To USART0
0: Input1: Output
P3SEL: 0=GPIO, 1=another peripheral
18
Pin Sharing SLAS504B.pdf p.9
MSP430x22x2, MSP430x22x4MIXED SIGNAL MICROCONTROLLER
SLAS504B ! JULY 2006 ! REVISED JULY 2007
9POST OFFICE BOX 655303 • DALLAS, TEXAS 75265POST OFFICE BOX 1443 • HOUSTON, TEXAS 77251!1443
Terminal Functions, MSP430x22x4
TERMINAL
NAMEDA RHA
I/ODESCRIPTION
NAMENO. NO.
I/ODESCRIPTION
P1.0/TACLK/ADC10CLK
31 29 I/O General-purpose digital I/O pinTimer_A, clock signal TACLK inputADC10, conversion clock
P1.1/TA0 32 30 I/O General-purpose digital I/O pinTimer_A, capture: CCI0A input, compare: OUT0 output/BSL transmit
P1.2/TA1 33 31 I/O General-purpose digital I/O pinTimer_A, capture: CCI1A input, compare: OUT1 output
P1.3/TA2 34 32 I/O General-purpose digital I/O pinTimer_A, capture: CCI2A input, compare: OUT2 output
P1.4/SMCLK/TCK
35 33 I/O General-purpose digital I/O pin / SMCLK signal outputTest Clock input for device programming and test
P1.5/TA0/TMS
36 34 I/O General-purpose digital I/O pin / Timer_A, compare: OUT0 outputTest Mode Select input for device programming and test
P1.6/TA1/TDI/TCLK
37 35 I/O General-purpose digital I/O pin / Timer_A, compare: OUT1 outputTest Data Input or Test Clock Input for programming and test
P1.7/TA2/TDO/TDI†
38 36 I/O General-purpose digital I/O pin / Timer_A, compare: OUT2 outputTest Data Output or Test Data Input for programming and test
P2.0/ACLK/A0/OA0I0 8 6 I/O General-purpose digital I/O pin / ACLK outputADC10, analog input A0 / OA0, analog input I0
P2.1/TAINCLK/SMCLK/A1/OA0O
9 7 I/O General-purpose digital I/O pin / Timer_A, clock signal at INCLKSMCLK signal outputADC10, analog input A1 / OA0, analog output
P2.2/TA0/A2/OA0I1
10 8 I/O General-purpose digital I/O pinTimer_A, capture: CCI0B input/BSL receive, compare: OUT0 outputADC10, analog input A2 / OA0, analog input I1
P2.3/TA1/A3/VREF!/VeREF!/OA1I1/OA1O
29 27 I/O General-purpose digital I/O pinTimer_A, capture CCI1B input, compare: OUT1 outputADC10, analog input A3 / negative reference voltage output/inputOA1, analog input I1 / OA1, analog output
P2.4/TA2/A4/VREF+/VeREF+/OA1I0
30 28 I/O General-purpose digital I/O pin / Timer_A, compare: OUT2 outputADC10, analog input A4 / positive reference voltage output/inputOA1, analog input I0
P2.5/ROSC
3 40 I/O General-purpose digital I/O pinInput for external DCO resistor to define DCO frequency
XIN/P2.6 6 3 I/O Input terminal of crystal oscillatorGeneral-purpose digital I/O pin
XOUT/P2.7 5 2 I/O Output terminal of crystal oscillatorGeneral-purpose digital I/O pin
P3.0/UCB0STE/UCA0CLK/A5
11 9 I/O General-purpose digital I/O pinUSCI_B0 slave transmit enable / USCI_A0 clock input/outputADC10, analog input A5
P3.1/UCB0SIMO/UCB0SDA
12 10 I/O General-purpose digital I/O pinUSCI_B0 slave in/master out in SPI mode, SDA I2C data in I2C mode
P3.2/UCB01SOMI/UCB0SCL
13 11 I/O General-purpose digital I/O pinUSCI_B0 slave out/master in in SPI mode, SCL I2C clock in I2C mode
P3.3/UCB0CLK/UCA0STE
14 12 I/O General-purpose digital I/O pinUSCI_B0 clock input/output / USCI_A0 slave transmit enable
P3.4/UCA0TXD/UCA0SIMO
25 23 I/O General-purpose digital I/O pinUSCI_A0 transmit data output in UART mode, slave in/master out in SPI mode
19
GPIO Port Schematics Example (from another MSP430)
TI eZ430-RF2500
Schéma FET
Brochage et E/S!Brochage du MSP430f2274!Pilotage des Entrées / Sorties!Mapping mémoire desMSP430
!Exemple de port(MSP430f149)
!Exemple de port(MSP430f149)
Exemple
Suite
- p. 12/14
Exemple de port (MSP430f149)
" Ports 1 et 2 avec interruptions" Registres PxIFG (flag) et PxIE (interrupt enable)
input/output schematicport P1, P1.0 to P1.7, input/output with Schmitt−trigger
P1.0/TACLK ..
P1IN.x
Module X IN
Pad Logic
InterruptFlag
EdgeSelect
Interrupt
P1SEL.xP1IES.x
P1IFG.x
P1IE.xP1IRQ.x
EN
D
SetEN
Q
P1OUT.x
P1DIR.x
P1SEL.x
Module X OUT
Direction ControlFrom Module
0
1
0
1P1.7/TA2
20
GPIO Example
#include <io.h>
#define BIT_GREEN (1 << 1)#define BIT_RED (1 << 0)
void wait(unsigned int n){int i;for(i=0;i<n;i++){asm(" nop;");asm(" nop;");
}}
int main(void){unsigned char b;P1DIR |= (BIT_GREEN | BIT_RED);P1SEL &= ~(BIT_GREEN | BIT_RED);P1OUT &= ~(BIT_GREEN | BIT_RED);b = 0x01;while (1){wait(50000); wait(50000);wait(50000); wait(50000);P1OUT = b;b <<= 1;if (b == 0x4)
b = 0x01;}return 0;
}
21
Bitwise Operators in C...illustrated with non-C syntax
A = 0b01101001
~A = 0b10010110
A<<2 = 0b10100100
A<<2 = 0b00011010
A|= 0b00000010 => A=0b01101011
A&=~0b00001000 => A=0b01100001
A^= 0b10001000 => A=0b11100001
22
Outline
1 Introduction
2 Schematics and Pinout
3 Internal structure
4 Digital Input/Output
5 Interrupts
6 Managing time
7 Serial Communication
8 Analog Input/Output
9 Conclusion
MSP430x22x2, MSP430x22x4MIXED SIGNAL MICROCONTROLLER
SLAS504B ! JULY 2006 ! REVISED JULY 2007
6 POST OFFICE BOX 655303 • DALLAS, TEXAS 75265POST OFFICE BOX 1443 • HOUSTON, TEXAS 77251!1443
MSP430x22x2 functional block diagram
Basic ClockSystem+
RAM
1kB512B512B
BrownoutProtection
RST/NMI
VCC VSS
MCLK
SMCLK
WatchdogWDT+
15/16!Bit
Timer_A3
3 CCRegisters
16MHzCPU
incl. 16Registers
Emulation(2BP)
XOUT
JTAGInterface
Flash
32kB16kB8kB
ACLK
XIN
MDB
MAB
Spy!Bi Wire
Timer_B3
3 CCRegisters,Shadow
Reg
USCI_A0:UART/LIN,IrDA, SPI
USCI_B0:SPI, I2C
ADC1010!Bit
12Channels,Autoscan,
DTC
Ports P1/P2
2x8 I/OInterrupt
capability,pull!up/down
resistors
Ports P3/P4
2x8 I/Opull!up/down
resistors
P1.x/P2.x
2x8
P3.x/P4.x
2x8
NOTE: See port schematics section for detailed I/O information.
MSP430x22x4 functional block diagram
Basic ClockSystem+
RAM
1kB512B512B
BrownoutProtection
RST/NMI
VCC VSS
MCLK
SMCLK
WatchdogWDT+
15/16!Bit
Timer_A3
3 CCRegisters
16MHzCPU
incl. 16Registers
Emulation(2BP)
XOUT
JTAGInterface
Flash
32kB16kB8kB
ACLK
XIN
MDB
MAB
Spy!Bi Wire
Timer_B3
3 CCRegisters,Shadow
Reg
USCI_A0:UART/LIN,IrDA, SPI
USCI_B0:SPI, I2C
OA0, OA1
2 Op Amps
ADC1010!Bit
12Channels,Autoscan,
DTC
Ports P1/P2
2x8 I/OInterrupt
capability,pull!up/down
resistors
Ports P3/P4
2x8 I/Opull!up/down
resistors
P1.x/P2.x
2x8
P3.x/P4.x
2x8
NOTE: See port schematics section for detailed I/O information.
23
Interrupts
An interrupt can only occur when bothbit General Interrupt Enable (GIE) set in status registerInterrupt Enable bit set in specific peripheral register
e.g. PxIE in ports 1 and 2
Acknowledgement isimplicit for single-source interruptsnecessary for multiple-source interrupts
e.g. PxIFG in port 1 and 2
Interrupt nesting is disabled by defaultGIE is cleared upon entering ISR
24
ISR Exampleusing GCC intrisincs
interrupt (PORT1_VECTOR) PORT1_ISR(void){
if (P1IFG & (P1IE & (1<<2) )){SWITCH_RED_LED();
}
P1IFG=0;}
25
MSP430 16-bit Memory Map SLAU144D.pdf p.1-4
26
MSP430F2274 Peripherals mapping SLAS504B.pdf p.22
MSP430x22x2, MSP430x22x4MIXED SIGNAL MICROCONTROLLER
SLAS504B ! JULY 2006 ! REVISED JULY 2007
22 POST OFFICE BOX 655303 • DALLAS, TEXAS 75265POST OFFICE BOX 1443 • HOUSTON, TEXAS 77251!1443
PERIPHERALS WITH BYTE ACCESS (continued)
Basic Clock System+ Basic clock system control 3Basic clock system control 2Basic clock system control 1DCO clock frequency control
BCSCTL3BCSCTL2BCSCTL1DCOCTL
053h058h057h056h
Port P4 Port P4 resistor enablePort P4 selectionPort P4 directionPort P4 outputPort P4 input
P4RENP4SELP4DIRP4OUTP4IN
011h01Fh01Eh01Dh01Ch
Port P3 Port P3 resistor enablePort P3 selectionPort P3 directionPort P3 outputPort P3 input
P3RENP3SELP3DIRP3OUTP3IN
010h01Bh01Ah019h018h
Port P2 Port P2 resistor enablePort P2 selectionPort P2 interrupt enablePort P2 interrupt edge selectPort P2 interrupt flagPort P2 directionPort P2 outputPort P2 input
P2RENP2SELP2IEP2IESP2IFGP2DIRP2OUTP2IN
02Fh02Eh02Dh02Ch02Bh02Ah029h028h
Port P1 Port P1 resistor enablePort P1 selectionPort P1 interrupt enablePort P1 interrupt edge selectPort P1 interrupt flagPort P1 directionPort P1 outputPort P1 input
P1RENP1SELP1IEP1IESP1IFGP1DIRP1OUTP1IN
027h026h025h024h023h022h021h020h
Special Function SFR interrupt flag 2SFR interrupt flag 1SFR interrupt enable 2SFR interrupt enable 1
IFG2IFG1IE2IE1
003h002h001h000h
27
Outline
1 Introduction
2 Schematics and Pinout
3 Internal structure
4 Digital Input/Output
5 Interrupts
6 Managing time
7 Serial Communication
8 Analog Input/Output
9 Conclusion
MSP430x22x2, MSP430x22x4MIXED SIGNAL MICROCONTROLLER
SLAS504B ! JULY 2006 ! REVISED JULY 2007
6 POST OFFICE BOX 655303 • DALLAS, TEXAS 75265POST OFFICE BOX 1443 • HOUSTON, TEXAS 77251!1443
MSP430x22x2 functional block diagram
Basic ClockSystem+
RAM
1kB512B512B
BrownoutProtection
RST/NMI
VCC VSS
MCLK
SMCLK
WatchdogWDT+
15/16!Bit
Timer_A3
3 CCRegisters
16MHzCPU
incl. 16Registers
Emulation(2BP)
XOUT
JTAGInterface
Flash
32kB16kB8kB
ACLK
XIN
MDB
MAB
Spy!Bi Wire
Timer_B3
3 CCRegisters,Shadow
Reg
USCI_A0:UART/LIN,IrDA, SPI
USCI_B0:SPI, I2C
ADC1010!Bit
12Channels,Autoscan,
DTC
Ports P1/P2
2x8 I/OInterrupt
capability,pull!up/down
resistors
Ports P3/P4
2x8 I/Opull!up/down
resistors
P1.x/P2.x
2x8
P3.x/P4.x
2x8
NOTE: See port schematics section for detailed I/O information.
MSP430x22x4 functional block diagram
Basic ClockSystem+
RAM
1kB512B512B
BrownoutProtection
RST/NMI
VCC VSS
MCLK
SMCLK
WatchdogWDT+
15/16!Bit
Timer_A3
3 CCRegisters
16MHzCPU
incl. 16Registers
Emulation(2BP)
XOUT
JTAGInterface
Flash
32kB16kB8kB
ACLK
XIN
MDB
MAB
Spy!Bi Wire
Timer_B3
3 CCRegisters,Shadow
Reg
USCI_A0:UART/LIN,IrDA, SPI
USCI_B0:SPI, I2C
OA0, OA1
2 Op Amps
ADC1010!Bit
12Channels,Autoscan,
DTC
Ports P1/P2
2x8 I/OInterrupt
capability,pull!up/down
resistors
Ports P3/P4
2x8 I/Opull!up/down
resistors
P1.x/P2.x
2x8
P3.x/P4.x
2x8
NOTE: See port schematics section for detailed I/O information.
28
Oscillators and clocks
29
Basic Clock Module SLAU144D.pdf p.5-3!"#$% &'(%) *(+,'-. /012(+,%1$(0
!"#!"#$% &'(%) *(+,'-.
3$4,2- 56678 !"#$% &'(%) *(+,'-. !'(%) 9$"42":
$%&%'()*+*,*-*.
$/012
!"#$
345677
879:+38;
$3638;
9/<
965:
$%&%'()*+*,*-*.
$/0=2
%!"#$
>3?+$/0>2
&"#$
=@%A >BCD(E 3FGHI
1J2%FF@)B 3FGHI
>JK >BCD(E 3FGHI
$36
$362
$3?(A()@DG)
>3?L M>N82
GOO
>N8>
+
L
>N8=2
LL
L+
+L
+++
L
+
L$%&%'()*+*,*-*.
=G'JF@DG)
+
LA
AP+
9:>
93142
879:+ 6CH%FF@DG)
87
L 0
876OO
L 0
=%AQ 4JFC7%FD()
879:+>2
=6$2
(FC(
+L=%AQ 4JFC(7%FD()
/AD()A@F84*87
08638;
9:,/<
9:,65:
9:,677
9:
=%AQ 4JFC(7%FD()
3GAA(HD(' GAFB RS(A9:, AGD T)(C(AD GA""HS%T
9:,>
033
+
L
$36M
6CH%FF@DG)U
9:+6OO
9:, 6CH%FF@DG)U
MGCHU
6>3677
9:U
'()*+, -+./0+1%2+0/3/0 "4)05 678/7*/)9:
1FF HFGHI O(@DJ)(C @)( AGD @&@%F@KF( GA @FF =>4-#L2,22 '(&%H(CQ
=>4-#L2,L22V 879:+ 'G(C AGD CJTTG)D W7EG'(X 9:, %C AGD T)(C(ADX M6>3%C AGD CJTTG)D('Q=>4-#L2,+2+V /AD()A@F 84*87 GCH%FF@DG) %C AGD T)(C(ADX 9:, %C AGD T)(C(ADXM6>3 %C AGD CJTTG)D('Q=>4-#L2,+2,V 9:, %C AGD T)(C(ADQ=>4-#L2,,22X =>4-#L2,#2LV 9:, %C AGD T)(C(ADQ
30
Digitally-Controlled Oscillator SLAU144D.pdf p.5-7
!"#$% &'(%) *(+,'-. /0-1"2$(3
!"#!"#$% &'(%) *(+,'-.
!"#$%&'() &*+ ,-. /0+1$+(23
$%&'( ) *+,- ./012 3 # )45 6,72 3 8- )99:;<4= &>' 6,7 &: ?&)(& )& )@<5"()4=' %('AB'4CDE F,1G )45 /F,1G )(' ?:B(C'5 %(:@ 6,7,1GEH'C)B?' &>' ,*+ '2'CB&'? C:5' %(:@ F,1G- ;><C> <? ?:B(C'5 %(:@ &>'%)?&"?&)(&<4=6,7- C:5' '2'CB&<:4 &DI<C)99D J'=<4? %(:@*+, <4 9'?? &>)4 K ?EL>' &DI<C)9 6,72 )45 ./012 ()4='? )45 ?&'I? )(' ?>:;4 <4 M<=B(' !""!E
L>' %('AB'4CD :% 6,7,1G <? ?'& JD &>' %:99:;<4= %B4C&<:4?N
! L>' %:B( ./012 J<&? ?'9'C& :4' :% ?<2&''4 4:@<4)9 %('AB'4CD ()4='? %:(&>' 6,7E L>'?' ()4='? )(' 5'%<4'5 %:( )4 <45<O<5B)9 5'O<C' <4 &>'5'O<C'"?I'C<%<C 5)&) ?>''&E
! L>' &>(''6,72J<&? 5<O<5' &>'6,7()4=' ?'9'C&'5JD &>'./012J<&? <4&:P %('AB'4CD ?&'I?- ?'I)()&'5 JD )II(:2<@)&'9D QRSE
! L>' %<O' F762 J<&?- ?;<&C> J'&;''4 &>' %('AB'4CD ?'9'C&'5 JD &>' 6,72J<&? )45 &>' 4'2& ><=>'( %('AB'4CD ?'& JD 6,72TQE U>'4 6,72 3 R#>-&>' F762 J<&? >)O' 4: '%%'C& J'C)B?' &>' 6,7 <? )9(')5D )& &>' ><=>'?&?'&&<4= %:( &>' ?'9'C&'5 ./012 ()4='E
4$5,1- 67768 9:0$%"' ;&/< ="35- "3+ =>?@< >2-0#
./013R
./01 3 Q!
6,73R 6,73#6,73V6,73Q 6,73K 6,738 6,73! 6,73W
%6,7
KRRRR XYZ
QRR XYZ
QRRR XYZ
./01 3 #
31
Sleep modes SLAU144D.pdf p.2-14
!"#$%&'() *+,#-
!"#$ ./-� 1#-#&-2 3(&#$$4"&-2 %(, !"#$%&'() *+,#-
!"# $%&'()*+, -./&0
%&' ()*$+, -./012 03 4'3056'4 -78 91:8.17;"<7;'8 .<<10=.:0763 .64 93'340--'8'6: 7<'8.:065 /74'3 3&7;6 06 >0598' !""?@
%&' 7<'8.:065 /74'3 :.A' 06:7 .==796: :&8'' 40--'8'6: 6''43B
! C1:8.17;"<7;'8
! )<''4 .64 4.:. :&8795&<9:
! (060/0D.:076 7- 0640E049.1 <'80<&'8.1 =988'6: =7639/<:076
%&' ()*$+, :2<0=.1 =988'6: =7639/<:076 03 3&7;6 06 >0598' !""F@
5')4$# 67789 :/"';%< =4$$#(& =+(-40"&'+( +> 6?@? A#B';#- B- !"#$%&'() *+,#-
+#G
H(
+,,
!I,
!!G#F,
#+G
?,$G
,J*(, J*(! J*(+ J*($
!,,
GG +!#I ## ,@? ,@I ,@# ,@#
KLL M + KKLL M !@! K
N<'8.:065 (74'3
O LLPH.:#(QD
%&' 17;"<7;'8 /74'3 , :7 $ .8' =76-0598'4 ;0:& :&' L*CN>>R N)LN>>R)LS,R .64 )LS# T0:3 06 :&' 3:.:93 8'503:'8 %&' .4E.6:.5' 7- 06=194065 :&'L*CN>>RN)LN>>R )LS,R .64)LS#/74'"=76:871 T0:3 06 :&' 3:.:93 8'503:'803 :&.: :&' <8'3'6: 7<'8.:065 /74' 03 3.E'4 76:7 :&' 3:.=A 498065 .6 06:'889<:3'8E0=' 879:06'@ *8758./ -17; 8':9863 :7 :&' <8'E0793 7<'8.:065 /74' 0- :&'3.E'4)UE.19' 03 67: .1:'8'4498065 :&' 06:'889<: 3'8E0=' 879:06'@*8758./ -17;=.6 T' 8':986'4 :7 . 40--'8'6: 7<'8.:065 /74' T2 /.60<91.:065 :&' 3.E'4 )UE.19' 76 :&' 3:.=A 06304' 7- :&' 06:'889<: 3'8E0=' 879:06'@ %&'/74'"=76:871 T0:3.64 :&' 3:.=A =.6 T' .=='33'4 ;0:& .62 063:89=:076@
V&'6 3'::065 .62 7- :&'/74'"=76:871 T0:3R :&' 3'1'=:'4 7<'8.:065/74' :.A'3'--'=: 0//'40.:'12@ *'80<&'8.13 7<'8.:065;0:& .62 403.T1'4 =17=A .8' 403.T1'496:01 :&' =17=A T'=7/'3.=:0E'@ %&'<'80<&'8.13/.2.137 T'403.T1'4;0:& :&'080640E049.1 =76:871 8'503:'8 3'::0653@ H11 OPN <78: <063 .64 UH(P8'503:'83 .8'96=&.65'4@ V.A' 9< 03 <7330T1' :&8795& .11 '6.T1'4 06:'889<:3@
32
Timers
A timer is a 16-bit counter whichcounts cycles from a selectable clock sourcein a certain way (up, down, continuous)
Can be used in two ways :memorize its value on certain events (capture mode)
ortrigger an interrupt when reaching a given value (compare mode)
Each timer has two interrupt lines:implicit acknowledgement: TxCCR0 vectorack. must be done by software: TxIV vector
33
Timer A SLAU144D.pdf p.12-3
!"#$%&' ()*%+,-.*"+)
!"#$!"#$%&'
/"0-%$ 123314 !"#$%&' 56+.7 8"90%9#
%&'()*)+&* "%%,
!- .
%%,/0
1234150
%)(+6*74&87
%40
/9:;
/%/
%1<=&>?;
16+(6+2:?+" 5 /7+ @A@2.
123
123" /?>:)=
B7C7+
DE5
<%%
%%,"F
%%,"G
A@2"
5?H?87*!I"IJIK
%&6:+4&87
!L##M?+ 3?'7*3FB
B%F%NO
/4%NO
3F%NO
,E%NO /7+ 3F,PD
!- .
3F//AN0 4%0,50
..
.!
!.
!!
%=7)*
3?'7* %=&;Q
A@2.
3?'7* %=&;Q
3?'7* %=&;Q
/%%, R FAE
!!"#
S1B
3F%NB
!!"$
%&'() *+,-.
..
.!
!.
!!
%FS
!
.
!
.
!!"/
/7+ 3F%%B"%%,PD
3F%%B"
34
Timer B SLAU144D.pdf p.13-3!"#$%&' ()*%+,-.*"+)
!"#"!"#$%&'
/"0-%$ 123314 !"#$%&' '5+.6 7"80%8#
!!"#
$%&'()(*%) +
$$,
!- .
/012/34
$('*5)62%76
$24
89:;
$/<=%>?;
/5*'5*0:?*+ 3 86* @A@0.
/01
/01+ 8?>:(=
B6C6*
D/B
A@0+
3?E?76)!FGFHFI
$%5:*2%76
!+##J?* 1?&6)1KB
86* 1K,LM
!- .2$4,34
$=6()
1K$NB
1?&6) $=%;O
!!"$
A@0.
1?&6) $=%;O
1?&6) $=%;O
<$$
1KBP.
0DF3/QRA@0.
$NN34
$R1N4
N%(7
!!"%
!!"&
!!"'
!!"(
!!")
*+,-. /0123
1K$$B+
B$!. !G !+I
1K$NMBD4
$$B-
$$BH
$$B!
M)%5'N%(7 N%>?;
M)%5'N%(7 N%>?;
1K88AN4
..
.!
!.
!!
MR3
<$$
$$,+S
$$,+K
..
.!
!.
!!
$$,84
..
.!
!.
!!
..
.!
!.
!!$SD
!
.
8$8
!
.
86* 1K$$B+$$,LM
$%&'()6 N(*;T 1K$N+
S$NU
82$NU
1K$NU
35
Timers: Up mode SLAU144D.pdf p.12-6
!"#$%&' ()$%*+",-
!"#$ !"#$%&'
!" #$%&
%&' ()*+,' -. (.', -/ 0&' 0-*'1 )'1-+,*(.0 2' ,-//'1'30 /1+* 45555& 6+(30.7%&' 0-*'1 1')'80',9: 6+(30. () 0+ 0&' ;89(' +/ 6+*)81' 1'<-.0'1 %=>>?4@A&-6& ,'/-3'. 0&' )'1-+,@ 8. .&+A3 -3 5-<(1' !"##"7 %&' 3(*2'1 +/ 0-*'16+(30. -3 0&' )'1-+, -. %=>>?4B!7 C&'3 0&' 0-*'1 ;89(' 'D(89. %=>>?4 0&'0-*'1 1'.0810. 6+(30-3< /1+* E'1+7 F/ () *+,' -. .'9'60', A&'3 0&' 0-*'1 ;89('-. <1'80'1 0&83 %=>>?4@ 0&' 0-*'1 -**',-80'9: 1'.0810. 6+(30-3< /1+* E'1+7
."/0%$ 123324 5) 6,7$
4&
45555&
%=>>?4
%&'%=>>?4>>F5G -30'11()0 /98< -. .'0A&'3 0&' 0-*'1 8,0-+9 0+ 0&' %=>>?4;89('7 %&' %=F5G -30'11()0 /98< -. .'0 A&'3 0&' 0-*'1 8,0-+9 /1+* %=>>?4 0+E'1+7 5-<(1' !"##H .&+A. 0&' /98< .'0 6:69'7
."/0%$ 1233:4 5) 6,7$ .;*/ <$++"-/
>>?4##! >>?4 4&
%-*'1 >9+6I
%-*'1
J'0 %=F5G
J'0 %=>>?4 >>F5G
!& >>?4##! >>?4 4&
!"#$%&$% '"( )(*&+, -(%&.'(* /0!!-1
C&'3 6&83<-3<%=>>?4A&-9' 0&' 0-*'1 -. 1(33-3<@ -/ 0&' 3'A)'1-+, -. <1'80'10&83+1 'D(89 0+ 0&'+9,)'1-+,@ +1 <1'80'1 0&83 0&'6(11'30 6+(30 ;89('@ 0&' 0-*'16+(30. () 0+ 0&' 3'A )'1-+,7 F/ 0&' 3'A )'1-+, -. 9'.. 0&83 0&' 6(11'30 6+(30;89('@ 0&' 0-*'1 1+99. 0+ E'1+7 K+A';'1@ +3' 8,,-0-+389 6+(30 *8: +66(1 2'/+1'0&' 6+(30'1 1+99. 0+ E'1+7
!"#$%&' ()$%*+",-
!"#$ !"#$%&'
!" #$%&
%&' ()*+,' -. (.', -/ 0&' 0-*'1 )'1-+,*(.0 2' ,-//'1'30 /1+* 45555& 6+(30.7%&' 0-*'1 1')'80',9: 6+(30. () 0+ 0&' ;89(' +/ 6+*)81' 1'<-.0'1 %=>>?4@A&-6& ,'/-3'. 0&' )'1-+,@ 8. .&+A3 -3 5-<(1' !"##"7 %&' 3(*2'1 +/ 0-*'16+(30. -3 0&' )'1-+, -. %=>>?4B!7 C&'3 0&' 0-*'1 ;89(' 'D(89. %=>>?4 0&'0-*'1 1'.0810. 6+(30-3< /1+* E'1+7 F/ () *+,' -. .'9'60', A&'3 0&' 0-*'1 ;89('-. <1'80'1 0&83 %=>>?4@ 0&' 0-*'1 -**',-80'9: 1'.0810. 6+(30-3< /1+* E'1+7
."/0%$ 123324 5) 6,7$
4&
45555&
%=>>?4
%&'%=>>?4>>F5G -30'11()0 /98< -. .'0A&'3 0&' 0-*'1 8,0-+9 0+ 0&' %=>>?4;89('7 %&' %=F5G -30'11()0 /98< -. .'0 A&'3 0&' 0-*'1 8,0-+9 /1+* %=>>?4 0+E'1+7 5-<(1' !"##H .&+A. 0&' /98< .'0 6:69'7
."/0%$ 1233:4 5) 6,7$ .;*/ <$++"-/
>>?4##! >>?4 4&
%-*'1 >9+6I
%-*'1
J'0 %=F5G
J'0 %=>>?4 >>F5G
!& >>?4##! >>?4 4&
!"#$%&$% '"( )(*&+, -(%&.'(* /0!!-1
C&'3 6&83<-3<%=>>?4A&-9' 0&' 0-*'1 -. 1(33-3<@ -/ 0&' 3'A)'1-+, -. <1'80'10&83+1 'D(89 0+ 0&'+9,)'1-+,@ +1 <1'80'1 0&83 0&'6(11'30 6+(30 ;89('@ 0&' 0-*'16+(30. () 0+ 0&' 3'A )'1-+,7 F/ 0&' 3'A )'1-+, -. 9'.. 0&83 0&' 6(11'30 6+(30;89('@ 0&' 0-*'1 1+99. 0+ E'1+7 K+A';'1@ +3' 8,,-0-+389 6+(30 *8: +66(1 2'/+1'0&' 6+(30'1 1+99. 0+ E'1+7
36
Timers: Continuous mode SLAU144D.pdf p.12-8
!"#$%&' ()$%*+",-
!"#$ !"#$%&'
!"# $% &'# ($)&*)+$+" ,$-#
%&' ()*+,*-)-./)0' (1* 2' -.'0 +) 3'*'41+' ,*0'5'*0'*+ +,/' ,*+'4617. 1*0)-+5-+ 84'9-'*(,'.: ;1(& +,/' 1* ,*+'4617 ,. ()/57'+'0< 1* ,*+'44-5+ ,.3'*'41+'0: %&' *'=+ +,/' ,*+'4617 ,. 100'0 +) +&' %>??@= 4'3,.+'4 ,* +&',*+'44-5+ .'46,(' 4)-+,*': A,3-4' !"##B .&)C. +C).'5141+' +,/' ,*+'4617. +D 1*0+! 2',*3 100'0 +) +&' (15+-4'E()/514' 4'3,.+'4.: F* +&,. -.13'< +&' +,/',*+'4617 ,. ()*+4)77'0 2G &140C14'< *)+ .)8+C14'< C,+&)-+ ,/51(+ 84)/ ,*+'44-5+71+'*(G: H5 +) +&4'' ,*0'5'*0'*+ +,/' ,*+'4617. )4 )-+5-+ 84'9-'*(,'. (1* 2'3'*'41+'0 -.,*3 177 +&4'' (15+-4'E()/514' 4'3,.+'4.:
."/0%$ 123345 6,-+"-0,07 8,9$ !"#$ :-+$%;*<7
DAAAA&
%>??@D1
%>??@D2 %>??@D( %>??@D0
+!
+D +D
%>??@!1
%>??@!2 %>??@!(
%>??@!0
+! +!
+D
%,/' ,*+'4617. (1* 2' 54)0-('0 C,+& )+&'4 /)0'. 1. C'77< C&'4' %>??@D ,.-.'0 1. +&' 5'4,)0 4'3,.+'4: %&',4 &1*07,*3 ,. /)4' ()/57'= .,*(' +&' .-/ )8+&' )70 %>??@= 01+1 1*0 +&' *'C 5'4,)0 (1* 2' &,3&'4 +&1* +&' %>??@D617-': I&'* +&' 54'6,)-. %>??@= 617-' 57-. += ,. 34'1+'4 +&1* +&' %>??@D01+1< %>??@D J ! /-.+ 2' .-2+41(+'0 +) )2+1,* +&' ()44'(+ +,/' ,*+'4617:
37
Timers: Up-down mode SLAU144D.pdf p.12-10
!"#$%&' ()$%*+",-
!"#!$ !"#$%&'
!"#$%&$% '"( )(*&+, -(%&.'(* /0!!-1
%&'( )&*(+,(+ -.//0$ 1&,2' 3&' 3,4'5 ,6 57((,(+8 *(9 ):7(3,(+ ,( 3&' 9:1(
9,5')3,:(8 3&' 3,4'5 ):(3,(7'6 ,36 9'6)'(3 7(3,2 ,3 5'*)&'6 ;'5:< -&' =*27' ,(
-.//0$ ,6 2*3)&'9 ,(3: -./>$ ,44'9,*3'2?8 &:1'='5 3&' ('1 @'5,:9 3*A'6
'BB')3 *B3'5 3&' ):7(3'5 ):7(36 9:1( 3: ;'5:<
%&'( 3&' 3,4'5 ,6 ):7(3,(+ ,( 3&' 7@ 9,5')3,:(8 *(9 3&' ('1 @'5,:9 ,6 +5'*3'5
3&*(:5 'C7*2 3: 3&':29@'5,:98 :5 +5'*3'5 3&*( 3&')755'(3 ):7(3 =*27'8 3&' 3,4'5
):7(36 7@ 3: 3&' ('1 @'5,:9 D'B:5' ):7(3,(+ 9:1(<%&'( 3&' 3,4'5 ,6 ):7(3,(+
,( 3&' 7@ 9,5')3,:(8 *(9 3&' ('1 @'5,:9 ,6 2'66 3&*( 3&' )755'(3 ):7(3 =*27'8 3&'
3,4'5 D'+,(6 ):7(3,(+ 9:1(< E:1'='58 :(' *99,3,:(*2 ):7(3 4*? :))75 D'B:5'
3&' ):7(3'5 D'+,(6 ):7(3,(+ 9:1(<
!"# $% &'# !()*$+, -$.#
-&' 7@F9:1( 4:9' 67@@:536 *@@2,)*3,:(6 3&*3 5'C7,5' 9'*9 3,4'6 D'31''(
:73@73 6,+(*26 GH'' 6')3,:( !"#$%&' (.+).+ /-"+I< J:5 'K*4@2'8 3: *=:,9
:='52:*9 ):(9,3,:(68 31: :73@736 95,=,(+ *( E#D5,9+' 4763 ('='5 D' ,( * &,+&
63*3' 6,4723*(':762?< L( 3&' 'K*4@2' 6&:1( ,( J,+75' !"##M 3&' 39'*9 ,6N
39'*9 O 33,4'5 G-.//0! ## -.//0"I
%,3&N 39'*9 -,4' 975,(+ 1&,)& D:3& :73@736 (''9 3: D' ,(*)3,='
33,4'5 /?)2' 3,4' :B 3&' 3,4'5 )2:)A
-.//0K /:(3'(3 :B )*@375'F):4@*5' 5'+,63'5 K
-&' -.//0K 5'+,63'56 *5' (:3 D7BB'5'9< -&'? 7@9*3' ,44'9,*3'2? 1&'(
15,33'( 3:< -&'5'B:5'8 *(? 5'C7,5'9 9'*9 3,4' 1,22 (:3 D' 4*,(3*,('9
*73:4*3,)*22?<
0"1.%$ 234456 (.+).+ /-"+ "- /)78,9- :,;$
$&
$JJJJ&
-.LJP
Q73@73 R:9' "N -:++2'F0'6'3
Q73@73 R:9' SN -:++2'FH'3
-.//0$
-.//0!
TUV!-.LJP L(3'557@3 T='(36TUV!
TUV$TUV! TUV!
TUV$
-.//0"
TUV" TUV"TUV" TUV"
W'*9 -,4'
38
Outline
1 Introduction
2 Schematics and Pinout
3 Internal structure
4 Digital Input/Output
5 Interrupts
6 Managing time
7 Serial Communication
8 Analog Input/Output
9 Conclusion
MSP430x22x2, MSP430x22x4MIXED SIGNAL MICROCONTROLLER
SLAS504B ! JULY 2006 ! REVISED JULY 2007
6 POST OFFICE BOX 655303 • DALLAS, TEXAS 75265POST OFFICE BOX 1443 • HOUSTON, TEXAS 77251!1443
MSP430x22x2 functional block diagram
Basic ClockSystem+
RAM
1kB512B512B
BrownoutProtection
RST/NMI
VCC VSS
MCLK
SMCLK
WatchdogWDT+
15/16!Bit
Timer_A3
3 CCRegisters
16MHzCPU
incl. 16Registers
Emulation(2BP)
XOUT
JTAGInterface
Flash
32kB16kB8kB
ACLK
XIN
MDB
MAB
Spy!Bi Wire
Timer_B3
3 CCRegisters,Shadow
Reg
USCI_A0:UART/LIN,IrDA, SPI
USCI_B0:SPI, I2C
ADC1010!Bit
12Channels,Autoscan,
DTC
Ports P1/P2
2x8 I/OInterrupt
capability,pull!up/down
resistors
Ports P3/P4
2x8 I/Opull!up/down
resistors
P1.x/P2.x
2x8
P3.x/P4.x
2x8
NOTE: See port schematics section for detailed I/O information.
MSP430x22x4 functional block diagram
Basic ClockSystem+
RAM
1kB512B512B
BrownoutProtection
RST/NMI
VCC VSS
MCLK
SMCLK
WatchdogWDT+
15/16!Bit
Timer_A3
3 CCRegisters
16MHzCPU
incl. 16Registers
Emulation(2BP)
XOUT
JTAGInterface
Flash
32kB16kB8kB
ACLK
XIN
MDB
MAB
Spy!Bi Wire
Timer_B3
3 CCRegisters,Shadow
Reg
USCI_A0:UART/LIN,IrDA, SPI
USCI_B0:SPI, I2C
OA0, OA1
2 Op Amps
ADC1010!Bit
12Channels,Autoscan,
DTC
Ports P1/P2
2x8 I/OInterrupt
capability,pull!up/down
resistors
Ports P3/P4
2x8 I/Opull!up/down
resistors
P1.x/P2.x
2x8
P3.x/P4.x
2x8
NOTE: See port schematics section for detailed I/O information.
39
Serial Communication
Examples of serial protocols:Morse code, USB, Firewire, USB, Ethernet, RS232, I2C, SPI...
The MSP430F2274 has two UARTs (both interrupt-capable):USCI_A0: UART, I2C, SPI, IrDAUSCI_B0: SPI, I2C
Asynchronous communication (UART) :Both ends have to agree on the communication protocol:encoding, frame length, reference frequency, ...
40
Asynchronous Serial Protocol SLAU144D.pdf p.15-5
!"#$ %&'()*+,-. !/01 2,3'
!"#"!-+4'(5)6 "'(+)6 #,778-+9)*+,- $-*'(:)9'; !/01 2,3'
!"#$ %&'( )*+,-./012 %345 607+
$% &'() *+,-. /0- &12$ /34%5*6/5 4%, 3-7-68-5 704347/-35 4/ 4 96/ 34/-45:%703+%+;5 /+ 4%+/0-3 ,-867-< )6*6%= >+3 -470 704347/-3 65 945-, +% /0-5-?-7/-, 94;, 34/- +> /0- &12$< )0- /34%5*6/ 4%, 3-7-68- >;%7/6+%5 ;5- /0-54*- 94;, 34/- >3-@;-%7:<
!"#$#! %&'( (1/./-8/9-./01 -17 4+:+.
)0- &12$ 65 3-5-/ 9: 4 A&2 +3 9: 5-//6%= /0- &21B(1) 96/< '>/-3 4 A&2. /0-&21B(1) 96/ 65 4;/+*4/674??: 5-/. C--D6%= /0- &12$ 6% 4 3-5-/ 7+%,6/6+%<B0-%5-/. /0-&21B(1)96/ 3-5-/5 /0-&2'E(F$G.&2'E)F$G.&2'E(F$HI.&2(FG((. &2J(K. &2AG. &2LG. &2HG. &21)LG 4%, &2J)LG 96/5 4%,5-/5 /0- &2'E)F$HI 96/< 2?-436%= &21B(1) 3-?-45-5 /0- &12$ >+3+D-34/6+%<
;0.+2 (1/./-8/9/1< 0, 4+='01>/<?,/1< .@+ %&'( 607?8+
)0- 3-7+**-%,-, &12$ 6%6/64?6M4/6+%N3-#7+%>6=;34/6+% D3+7-55 65O!P 1-/ &21B(1) Q!"#$! %&'#()#*+,&'-.'*/0P
RP $%6/64?6M- 4?? &12$ 3-=65/-35 S6/0 &21B(1) T ! Q6%7?;,6%= &2'E2)U!P
VP 2+%>6=;3- D+3/5<
WP 2?-43 &21B(1) 864 5+>/S43- Q!"'$! %&'#()#*+,&'-.'*/0P
"P G%49?- 6%/-33;D/5 Q+D/6+%4?P 864 &2'E(F$G 4%,N+3 &2'E)F$G
!"#$#A '@-,-B.+, C0,D-.
)0- &'() 704347/-3 >+3*4/. 50+S% 6% H6=;3- !"##R. 7+%565/5 +> 4 5/43/ 96/.5-8-% +3 -6=0/ ,4/4 96/5. 4% -8-%N+,,N%+ D436/: 96/. 4% 4,,3-55 96/ Q4,,3-55#96/*+,-P. 4%, +%- +3 /S+ 5/+D 96/5< )0- &2X1J 96/ 7+%/3+?5 /0- ,63-7/6+% +> /0-/34%5>-3 4%, 5-?-7/5 U1J +3 X1J >635/< U1J#>635/ 65 /:D674??: 3-@;63-, >+3 &'()7+**;%674/6+%<
<+=8(' >?@@AB #C)()9*'( <,(7)*
YA436/: J6/. &2AGZ T ![
Y',,3-55 J6/. &2XL\GE T !][
X43C
1D47-\] \^ \_ '\ A' 1A 1A
YLD/6+%4? J6/. 2+%,6/6+%[
YR%, 1/+D J6/. &21AJ T ![
Y`/0 \4/4 J6/. &2_J$) T ][
1)
41
USCI Block Diagram: UART Mode SLAU144D.pdf p.15-4!"#$ $%&'()*+&,(%- !./0 1()2
!"#$ !%,32'456 "2',56 #(77*%,+5&,(% $%&2'85+29 !./0 1()2
:,;*'2 <=>><? !"#[email protected] B6(+C D,5;'57- !./0 1()2 E!#"FG# H IJ
%&'()*+&,
-./0
1%./0
1%./0
22
2!
!2
!!
3.114/5
3.2./0
6,789*)7,:;<=<'7,
>797<=7 ?*(',*+7 @7A7,*+&,
3.2?>5
!B
3.?>C5
$
3.?>15
D
3.E1!B
3.>F4>>4,,&, C)*G8
17+ C)*G8
3.643.C43.E4
3.-?4H
>797<=7 1I<J+ >7G<8+7,
>797<=7 ?(JJ7, 3.2>F?3C
>797<=7 1+*+7 %*9I<A7
!
2
3.K>4H
3.64H 3.6-> 3.%1? 3.L?KM
3.;E>%3.%E;45
N
3.16?
17+ 3.?>0
17+ 3.-;;>:3.K;/4
2
!
3./K1M4H
3.2>F
!
2
3.K>>F6/
K,;- ;79&'7,
3.K>>FC43.K>>FC/5
B
M,*A8O<+ ?(JJ7, 3.2MF?3C
M,*A8O<+ 1+*+7 %*9I<A7
3.MF-;;>
3.MF?>0
M,*A8O<+ 1I<J+ >7G<8+7,
3.64H 3.6-> 3.%1? 3.L?KM 3.K>4H
3.K>MF6/5
B
2
!K,;- 4A9&'7,
3.2MF
M,*A8O<+ .)&9P
>797<=7 .)&9P?>./0
3.%E;45
N
3.16?
3.>F4K4
3.>F?>0K4
17+ 3.2>FKC@
17+ 3.2MFKC@
17+ >FKC@
42
USCI Block Diagram: SPI Mode SLAU144D.pdf p.14-4!"#$ $%&'()*+&,(%- ".$ /()0
!"#$ !%,10'234 "0',34 #(55*%,+3&,(% $%&0'63+07 ".$ /()0
8,9*'0 :;<<:= !"#$ >4(+? @,39'35- ".$ /()0
%&'(
)*&'(
)*&'(
++
+!
!+
!!
,&))-'.
/0%
123456732089:9;32
<9= &7>5? @3A326=>2
,&.<B.
!"
B3539:3 )C9D= B3E94=32
B3539:3 <FDD32 ,&.BG<,H
B3539:3 )=6=3 *65C9A3
,&*)< ,&I<JK
!
+
,&*)K
,&.)L*J
K26A4M9= <FDD32 ,&.KG<,H
K26A4M9= )=6=3 *65C9A3
K26A4M9= )C9D= B3E94=32
,&*)< ,&I<JK
<B&'(
)3= ,&.BGJH@
)3= ,&.KGJH@
+
!
,&'J)K-/
&7>5? 89235=9>AN1C643 6A; 1>7629=O
,&&(1P ,&&(1'
,&.)J*L
,&.&'(
)3= ,&L-
K26A4M9= -A6Q73&>A=2>7
R
,&*L8-.
,&.)K-
)3= ,&H-
43
USCI Block Diagram: I2C Mode SLAU144D.pdf p.17-4
!"#$ $%&'()*+&,(%- $.# /()
!"#$ !%,01'234 "1',34 #(55*%,+3&,(% $%&1'63+17 $.# /()1
8,9*'1 :;<<:= !"#$ >4(+? @,39'35- $.# /()1
%&'(
)*&'(
)*&'(
++
+!
!+
!!
,&))-'.
,&!&'(
/0123451067898:10
;8< &5=3> ?1@104<=0
,&.;A.
!B
;A&'(
)5491 %::0122 ,&!)%
C04@2D8< )E8F< A1G82<10
,&*)C
C04@2D8< ;HFF10 ,&!CI;,J
KL& )<4<1 *43E8@1
MN@ %::0122 ,&!M%
A131891 )E8F< A1G82<10
,&%!+
A131891 ;HFF10 ,&!AI;,J
,&?&-O
,&.)7%
,&.)&'
,&)'%!+
44
Outline
1 Introduction
2 Schematics and Pinout
3 Internal structure
4 Digital Input/Output
5 Interrupts
6 Managing time
7 Serial Communication
8 Analog Input/Output
9 Conclusion
MSP430x22x2, MSP430x22x4MIXED SIGNAL MICROCONTROLLER
SLAS504B ! JULY 2006 ! REVISED JULY 2007
6 POST OFFICE BOX 655303 • DALLAS, TEXAS 75265POST OFFICE BOX 1443 • HOUSTON, TEXAS 77251!1443
MSP430x22x2 functional block diagram
Basic ClockSystem+
RAM
1kB512B512B
BrownoutProtection
RST/NMI
VCC VSS
MCLK
SMCLK
WatchdogWDT+
15/16!Bit
Timer_A3
3 CCRegisters
16MHzCPU
incl. 16Registers
Emulation(2BP)
XOUT
JTAGInterface
Flash
32kB16kB8kB
ACLK
XIN
MDB
MAB
Spy!Bi Wire
Timer_B3
3 CCRegisters,Shadow
Reg
USCI_A0:UART/LIN,IrDA, SPI
USCI_B0:SPI, I2C
ADC1010!Bit
12Channels,Autoscan,
DTC
Ports P1/P2
2x8 I/OInterrupt
capability,pull!up/down
resistors
Ports P3/P4
2x8 I/Opull!up/down
resistors
P1.x/P2.x
2x8
P3.x/P4.x
2x8
NOTE: See port schematics section for detailed I/O information.
MSP430x22x4 functional block diagram
Basic ClockSystem+
RAM
1kB512B512B
BrownoutProtection
RST/NMI
VCC VSS
MCLK
SMCLK
WatchdogWDT+
15/16!Bit
Timer_A3
3 CCRegisters
16MHzCPU
incl. 16Registers
Emulation(2BP)
XOUT
JTAGInterface
Flash
32kB16kB8kB
ACLK
XIN
MDB
MAB
Spy!Bi Wire
Timer_B3
3 CCRegisters,Shadow
Reg
USCI_A0:UART/LIN,IrDA, SPI
USCI_B0:SPI, I2C
OA0, OA1
2 Op Amps
ADC1010!Bit
12Channels,Autoscan,
DTC
Ports P1/P2
2x8 I/OInterrupt
capability,pull!up/down
resistors
Ports P3/P4
2x8 I/Opull!up/down
resistors
P1.x/P2.x
2x8
P3.x/P4.x
2x8
NOTE: See port schematics section for detailed I/O information.
45
ADC10!"#$% &'()*+,-(.*'
!"#$!"#$%
/.0,)1 2%33$4 !"#$% 56*-7 ".80)89
%&'()*&+,-.), /"##012 %34 5161,*7
8/ 99 8:
3;<<
3<=>
?<=>
%?<=>
35</"%<
@3/
@3"
5&2& @7&+AB*7<.+27.))*7 43?C D)&AEC F*71(E*71&)A
;4## ;4G
;*4HDG
;4HDG
35</"IJ
KJ<-L
4HDMN4%@
35</"%%H=L
35</"5K;L
%-%L
35</"%-@L ?%<
HJ<MN%O
35</"5D
35</"<=>
%4HD!
35</"@M 35</"M/35</"<@
K%%-
35</"%4
35</"I%<
4*BPL
%8- <.+6*72
%3?F<IJ
/
"
%Q+R%&'()* @1'*78S8:8/T8TS
%-K
35</"%3
+
S
3"3/3!3$3S3U3T3V
4HDIJKJ<-LW"3E
!PU;
/9U; .7 !9U;4*B*7*+R*
.+
4*BPL
%4HD/
""
"/
/"
//
""
"/
/"
//
""
"/
/"
//
""
"/
/"
//
"""///
"/
%4HD"/"
<IJ%HXL
3;%%
/
"
KJ<-LW"ME
3Y2.
35</"?H?
4
4
"
/
4HDIN@%4HD/
/""//"""
""/""""/
""//"/"""/"/"//""///
""""
/"///"/"
"""/
///////"//"///""3/!Z
3/$Z
3/SZ
3/UZ
Z?%FS$"L!!LL ,*61R*A .+)Q9 <E&++*)A 3/!#3/U 21*, 2. RE&++*) 3// 1+ .2E*7 ,*61R*A[@3/ .+ ?%FS$"L!"L! ,*61R*A
;4HD##8;*4HD##3;<<
3;%%
3;<<
@3![
46
Conclusion: MSP430 eZ430-rf2500
Development platformcheapvery limited resources
Microcontroller architectureall peripherals are memory-mappedlow-power modes
Not presented: CC2500 Radio Modulewireless communication
47