Women in Technology

Hear us Roar



Article:
  Black Box with a View, Part 2
Subject:   Oops
Date:   2006-02-28 22:44:15
From:   georgebelotsky
Response to: Oops

The easyWeb2 specs do claim a 32kHz crystal.


Upon closer scrutiny, however, there is no such crystal on the schematic. In any case, the diagram shows an 8MHz crystal connected to XIN/XOUT instead.


I also asked a really smart person (Chris Paynter, who designs circuits, PCB layouts, etc. professionally) for a second opinion. He confirmed the above.


This probably explains your experiences (strangely, the interrupt code always worked well during the numerous tests that I carried out).


To be safe, try using SMCLK as the source. By default, it runs from the DCOCLK at about 800 kHz. Although the DCO is not very accurate, it does not matter for the examples here. The approach is quite simple to set up; just modify "LED_timer_driver.c" as follows.


  1. Replace the line #define TIMER_PERIOD 100 with #define TIMER_PERIOD (51200-1)

  2. Replace the line TACTL = TASSEL_1 | MC_1; with TACTL = TASSEL_2 | MC_1 | ID_1 | ID_2;


The TASSEL_2 bit by itself selects SMCLK as the input clock. The two ID_X bits cause the input clock to be divided by 8. So, you get ~800kHz / 8 / 51200 = ~2 (i.e. the LED will be toggled around twice per second). Thus, the LED will flash approximately once per second.