Why Keliang’s code maybe did (or maybe didn’t) work … or High (impedance) Anxiety.

Slides:



Advertisements
Similar presentations
Chapter 6 General Purpose Input/Output
Advertisements

Chapter 9 Data Acquisition Comparator_A
Chapter 8 LCD Controller
Lab 1 I/O, timers, interrupts on the eZ430-RF2500 Thomas Watteyne EE290Q – Spring 2010
Pulse Width Modulation and Motor Control
Serial Communications (Chapter 10)
ECE 382 Lesson 14 Lesson Outline Polling Multiplexing Intro to Logic Analyzer Debouncing Software Delay Routines Admin Assignment 3b due BOC today Assignment.
Outline MSP430 LaunchPad MSP430 Microcontroller
Interrupts, Low Power Modes and Timer A (Chapters 6 & 8)
Chung-Ta King National Tsing Hua University
Chung-Ta King National Tsing Hua University
Chung-Ta King National Tsing Hua University
ECE 447 Fall 2009 Lecture 9: TI MSP430 Interrupts & Low Power Modes.
LAB 6: Serial Communication
Notes on the ez430-RF2500. Sources
8-Bit Timer/Counter 0 Counter/Timer 0 and 2 (TCNT0, TCNT2) are nearly identical. Differences: -TCNT0 can run off an external 32Khz clock (Tosc) or the.
KEG-012 A.K.A. EMMA AND DAVE’S GROUPS Design Projects.
CS4101 嵌入式系統概論 Timers and Clocks 金仲達教授 國立清華大學資訊工程學系 Materials from MSP430 Microcontroller Basics, John H. Davies, Newnes, 2008.
MSP Ultra-Low Power | High Integration | Easy-to-Use “How To” Series: Clock System.
CS4101 嵌入式系統概論 Software UART Revisited Prof. Chung-Ta King Department of Computer Science National Tsing Hua University, Taiwan ( Materials from MSP430.
Chung-Ta King National Tsing Hua University
Timers. Range of timers Watchdog timer: Included in all devices (watchdog timer+). Its main function is to protect the system against malfunctions but.
LAB 7: WDT+ and Low-Power Optimization
Lecture 18: ADC Implementation Lecturers: Professor John Devlin.
Network and Systems Laboratory nslab.ee.ntu.edu.tw.
Renesas Electronics Europe GmbH A © 2010 Renesas Electronics Corporation. All rights reserved. RL78 Clock Generator.
MSP430 Mixed Signal Microcontroller – Parte 2 Afonso Ferreira Miguel Source: slau056d – Texas instruments.
CPE 323 Introduction to Embedded Computer Systems: Watchdog Timer, Timer A Instructor: Dr Aleksandar Milenkovic Lecture Notes.
CS4101 嵌入式系統概論 Analog-to-Digital Converter 金仲達教授 國立清華大學資訊工程學系 ( Materials from MSP430 Microcontroller Basics, John H. Davies, Newnes, 2008 )
CPE 323 Introduction to Embedded Computer Systems: ADC12 and DAC12 Instructor: Dr Aleksandar Milenkovic Lecture Notes.
SIGMA-DELTA ADC SD16_A Sigma-Delta ADC Shruthi Sujendra.
Lecture 11: TI MSP430 Timers Compare Modes
LAB 8: Program Design Pattern and Software Architecture
Ultra-low Power Motion Detection using the MSP430F2013.
Arch1 LCD Lab Eric Freudenthal. Topics Score Demo LCD Panel Geometry Utilities to draw to the display Drawing characters Buttons Nuisance: multiple versions.
ELE22MIC Lecture 18 The AVR Sleep Modes The ATMEGA128’s Timer System
Network and Systems Laboratory nslab.ee.ntu.edu.tw.
Week 7 Low-Power Modes MSP430 Teaching Materials Hacettepe University Copyright 2009 Texas Instruments All Rights Reserved.
67015 ACLK (32.768kHz) Timer count (ex. TA0R) Interrupt Note: Timer Settings : Upmode / CCR0=7 / CCR1 =7/ CCR2=1 Interrupts Enabled: CCR1/CCR2/overflow.
C Examples 6. Download Links MPLAB IDE dsPIC30F4011/4012 Data Sheet dsPIC30F Family Reference Manual MikroC MikroC Manual MikroC Quick Reference.
UNIT 2. CPUXV2 20-bit addressing User-definable Boot Strap Loader RAM starts at 0x1C00 Beginning of MAIN flash moves according to RAM Vector table starts.
ECE 382 Lesson 32 Lesson Outline Lab 6 Introduction Pulse Width Modulation Capture / Compare Example Lab 6 Tips Admin Lab#6 “prelab” due BOC lesson 33.
Recall the Container Thermometer
Recall the Container Thermometer
Introduction to MSP430G2553 and MPU6050
Introduction Why low power?
Introduction Why low power?
CS4101 嵌入式系統概論 General Purpose IO
Lecture 8: TI MSP430 Interrupts, ISRs
CS4101 嵌入式系統概論 Interrupts Prof. Chung-Ta King
Lesson Outline Interrupts Admin Assignment #9 due next lesson
Code review: GPIO, timer, and ISR
PWM and DC Motor Control
CS4101 Introduction to Embedded Systems Lab 6: Low-Power Optimization
Chapter 6 General Purpose Input/Output
CS4101 Introduction to Embedded Systems Lab 1: General Purpose IO
Prof. Chung-Ta King Department of Computer Science
ECE 3430 – Intro to Microcomputer Systems
CS4101 嵌入式系統概論 General Purpose IO
Instructor: Dr Aleksandar Milenkovic Lecture Notes
MSP432 ARM Timer Programming
CS4101 Introduction to Embedded Systems Lab 4: Interrupt
ECE 3430 – Intro to Microcomputer Systems
Lecture 9: TI MSP430 Interrupts & Low Power Modes
Example 18 Pulse Train Using Interrupts
CS4101 Introduction to Embedded Systems Lab 2: Basic IO and Timer
Prof. Chung-Ta King Department of Computer Science
MSP430 Clock System and Timer
ECE 3567 Microcontrollers Lab
A modular robot for use in the RoboSumo lab
Presentation transcript:

Why Keliang’s code maybe did (or maybe didn’t) work … or High (impedance) Anxiety

The code void main(void){ WDTCTL = WDTPW + WDTHOLD; // Kill Watchdog P1DIR |= 0x01; // P1.0 output TACTL |= TASSEL_1 + ID_0 + MC_1; // Select ACLK, select up mode, select divider to be 1 TACCR0 = 6000; // Count up to CCTL0 = CCIE; // CCR0 interrupt enabled _BIS_SR(LPM3_bits + GIE); // Go into lpm3 and enable interrupts } // Timer A0 interrupt service routine #pragma vector=TIMER0_A0_VECTOR __interrupt void Timer_A (void) { P1OUT ^= 0x01; // Toggle P1.0 } The idea was to use VLO clock (about 12 kHz) to generate interrupts after every 6000 counts When running on Launchpad the interrupts were happening about twice as fast as expected, but specs say VLO can be as high as 20 kHz so this seemed OK. When running on daughterboard, code didn’t work at all. Light would sometimes flash depending on touching circuit… Setting pin 2.6 as output also stopped code from working (even on Launchpad)

Timer A module TACTL |= TASSEL_1 + ID_0 + MC_1; // Select ACLK, select up mode, select divider to be 1 TACCR0 = 6000; // Count up to CCTL0 = CCIE; // CCR0 interrupt enabled

Clock Module At power up LXFT1Sx=00 so input is from XIN.

XIN/P2.6 (Page 3 of datasheet) (Page 53 of datasheet) (Page 341 of User’s Guide) P2Sel.6 = 1, P2Sel.7=1 P2Sel2.6=0, P2Sel2.7=0 Pin 19 is XIN

XIN is input (high impedance)! Touching (or getting near) pins can change value. That explains daughterboard behavior. But why did code work otherwise on Launchpad (though faster than expected)? Making P2.6 an output keeps line from oscillating, so light didn’t blink. This explains part of Launchpad behavior.

Launchpad PCB Front (as seen from front)Back (as seen from front) 0Ω resistors Test line from debugger Test line from debugger oscillates at 25kHz (a bit more than max on VLO freq of 20 kHz). Capacitance between Test and P2.6 (XIN) caused it to oscillate. Putting finger on PCB near P2.6 stopped light from blinking because of extra capacitance (voltage divider). Also – powering Launchpad from battery (so debugger isn’t on) stopped program from working.

The Fix void main(void){ WDTCTL = WDTPW + WDTHOLD; // Kill Watchdog P1DIR |= 0x01; // P1.0 output TACTL |= TASSEL_1 + ID_0 + MC_1; // Select ACLK, select up mode, select divider to be 1 TACCR0 = 6000; // Count up to CCTL0 = CCIE; // CCR0 interrupt enabled BCSCTL3 |= BIT5; // Set ACLK to be VLO _BIS_SR(LPM3_bits + GIE); // Go into lpm3 and enable interrupts }