16 Feb 2012 ... Understanding the multiplexing scheme of MSP430 pins ... Steps in installing
Code Composer Studio (CCS) ... Launch CCS v4 Core Edition.
LECTURE - 5 Using Code Composer Studio (CCS), Pin-Multiplexing scheme, Low Power Modes (LPM) in MSP430 Atul Lele, Ramakrishna Reddy K, MSP430 Design, Texas Instruments India Pvt Ltd.
2/16/2012
1
Post your queries to Dr.C P Ravikumar, Director, University Relations, Texas Instruments India Ltd
[email protected] and elearning.vtu.ac.in
[email protected] 2
Outline of today’s session • What have we learnt in the last sessiom • Agenda for this session – Lab 1: Building a CCS project for blinking a LED – Lab2A: Using polled flags to determine an interrupt event – Understanding the multiplexing scheme of MSP430 pins – Low Power Modes (LPM) in MSP430 – Lab2B: Using Ultra Low Power (ULP) Principles
• Wrap-Up • Q&A 2/16/2012
3
What have we learnt in the last session
2/16/2012
4
What have we learnt in the last session • Programming MSP430 in Assembly, C, Assembly +C • Discussed the digital IO • Interrupt processing in MSP430 • MSP430 tool chain • Steps in installing Code Composer Studio (CCS) for MSP430
5
Lab 1: Building a CCS project for blinking a LED
6
In the lab we will use…
7
Code Composer Studio v4 • Code Composer Studio v4: A single development platform for all TI processors • CCE users will feel at home • Enhancements since CCE: – – – – –
Speed Code size improvements Auto-updating License manager Support for all TI MCUs
• FREE 16KB-limited edition
• www.ti.com/ccs go here! 8
MSP430FG461x/F20xx Experimenter’s 7 Segment LCD Board • EXP Board includes: – MSP430FG4618/9 – MSP430F2013
• • • • • • •
LED
Interface to Chipcon radios Buzzer Microphone Bread-board area Serial connection interface Cap-touch pad Switches/ LEDs
Switches 9
Schematic of the Board
10
Open CCS • Launch CCS v4 Core Edition • Select a “Workspace” – Browse to Desktop\MSP430Training\Labs
Desktop\MSP430Training\Labs
• Exit from Welcome Screen when CCS opens 11
Create a CCS Project • • • • •
File > New > CCS Project Project Name: Flash_the_LED Project Type: MSP430 Additional Project Settings: …
12
Create a CCS Project (continued…) • Device Variant: MSP430F4XXX, MSP430FG4618 • Click
Select the target device: “MSP430FG4618”
Note: An additional step needed for the ASM-only project
13
Add a File to the CCS Project • • •
Right click project and “Add Files…” Navigate to Desktop\MSP430Training\Labs\Lab1 And select Flash_the_LED.c
14
Build & Debug a CCS Project
Click the “BUG” to build the code & launch the debugger
15
CCS Window – C/C++ Perspective Overview 1-click project Debug
Independent Debug and C/C++ Project Perspectives
Project Outline • Shortcut to project parts
Project View • List of all Projects
Problems View • Information, Warnings, Errors Console • Build Information
Code Window • Real-time breakpoints, Syntax highlighting 16
CCS Window – Debug Perspective Overview 1-click project Debug
Independent Debug and C/C++ Project Perspectives
Highly configurable window layout • User preferences • Plugin support
Target control • Start • Stop • Halt • Stepping • Stack Trace
Real-time, in-system MSP430 information • Register access • Flash, RAM, Info segment access • Disassembly view
Program Size Info
Code Window • Real-time breakpoints, Syntax highlighting 17
Is the LED blinking?
18
Lab 1 Check List
Open, Use and Explore CCS Play with lab hardware – MSP430EXPFG4618 Use the programmer – MSP-FET430UIF Establish communication with the MSP430 device Blink an LED
15 mins
19
Lab2A: Using polled flags to determine an interrupt event
20
Lab2A Goals • Create a new CCS project titled LAB2A (same as LAB1) Lab2A: Using polled flags to determine an interrupt event Use source code lab2_poll.c Configure switch S1 (P1.0) to accept an interrupt Poll P1IFG.0 to determine if a switch press has occurred Toggle LED4 (P5.1) on switch press Measure power when JP3 (near LED4) is open 21
Schematic of the Board
22
Create a CCS Project • • • • •
File > New > CCS Project Project Name: LAB2A Project Type: MSP430 Additional Project Settings: …
23
Add a File to the CCS Project • Right click project and “Add Files…” • Navigate to Desktop\MSP430Training\Labs\Lab2 • And select lab2_poll.c
24
Complete the Source Code
Setup P1.0 for an interrupt on a HI/LOW transition
Test P1IFG.BIT0 flag for event Toggle P5.1
Source file : lab2_poll.c 25
Complete the Source Code
Setup P1.0 for an interrupt on a HI/LOW transition
Test P1IFG.BIT0 flag for event Toggle P5.1
Source file : lab2_poll_solution.c 26
Build & Debug a CCS Project
Click the “BUG” to build the code & launch the debugger
27
Current measurement with polling JP3
LED ON(mA)
LED OFF(mA)
BATT
3.6
0.89
JP3
2.728
~0
A
Current consumed by device when polling A BATT28
Understanding the multiplexing scheme of MSP430 pins
2/16/2012
29
From F4618 datasheet
30
Source: http://www.ti.com/lit/ds/slas675/slas675.pdf
Taking only P1.0
0
0 Timer_A3.TA0 .0
.0
Timer_A3.CCI0A
.0 .0 .0 .0 .0
31
P1.0 as Digital Input (primary function)
DVSS 0
0 =0
0 0 Timer_A3.TA0 .0 =0 0 .0
0 0
Timer_A3.CCI0A
.0 .0 .0 .0 .0
32
P1.0 as Digital Output (primary function)
DVSS 1
0 =1
1 0 0
Timer_A3.TA0 .0 =0 1 .0
0 1
Timer_A3.CCI0A
.0 .0 .0 .0 .0
33
P1.0 in secondary function, timer capture input
DVSS 0
0 =0
0 0 0
Timer_A3.TA0 .0 =1 0 .0
0 0
Timer_A3.CCI0A
.0 .0 .0 .0 .0
34
P1.0 in secondary function, timer compare output
DVSS 1
0 =1
1 0 0
Timer_A3.TA0 .0 =1 1 .0
0 1
Timer_A3.CCI0A
.0 .0 .0 .0 .0
35
Pin-multiplexing in pad with analog functionality
36
For analog functionality, P6.1alone 1
1
1
1
1
1
37
P6.1 when P6.1 input function is selected 1
1
1
0
=0
0
0
1
1 =0
0 1
0 0
38
P6.1 when P6.1 output function is selected 1
1
1
1
=1
0
1
1
1 =0
1 1
0 1
39
P6.1 when A1 function is selected 1 =1
1
1 1
0
1
1 =1
1 1
1
1
40
Low Power Modes (LPM) in MSP430
2/16/2012
41
Low Power Requirements P = V2 /R Multiplying and dividing by C P = V2 C/RC = V2 C/ T = V2 C f Source: Microelectronic Circuits, Sedra and Smith, Oxford University Press, 1998
P = (V2 C f) AF 42
Voltage • Operating voltage from1.8V to 3.3V • Analog modules, peripherals from 2.2V* to 3.3V • For flash programming, it is 2.7V minimum
* Refer to the device datasheet 43
Frequency Clocks •
ACLK (Auxiliary Clock) – Clock for peripherals – Provides reference clock for FLL
•
SMCLK (Subsystem Main Clock) – Clock for peripherals
•
MCLK (Main Clock) – Clock for CPU and few peripherals
•
Peripheral Clocks (e.g. ADC10/12CLK) –
Clocks dedicated to certain peripheral e.g. ADC
44
Frequency (Contd) F2xx Flexible Clock System • Very-Low-Power Oscillator (VLO) – Embedded 12kHz – 500nA standby
• Crystal oscillator – Programmable capacitors – Failsafe OSC_Fault – Minimum pulse filter
• Improved DCO –