Hi Michele, On Wednesday 23 May 2007 09:51, Michele Paselli wrote: > I'm working with a platform based on the msp430 and I need to use one of > the two internal timers (A or B) in order to generate an external clock. > The problem is that they're both already used by TinyOS, TimerA for the ADC > and TimerB for the internal timing. My question is, could I switch one of > these two timers with the watchdog timer provided by the msp430? Are there > any drawbacks in doing that? Would this require a lot of work? > Thanks for the help.
I'm assuming TinyOS 2.0 and an msp430 like the '1611. Both timer peripherals implement multiple capture/compare registers. You can use a CCR to pass through its Timer's source clock (/ 2) by setting the CCR to 0 and configuring its control so that it toggles an output each time the Timer register wraps. To get a reasonably stable clock, you'll probably need a crystal source. TimerB already has one in most msp430 designs. One can be added for use by TimerA (XT2, generating ACLK). TimerA without a crystal sources from the DCO which isn't very stable over time and temperature. You can generate other clock frequencies by altering the CCR value after each compare event using a bit of code in the ISR. The big problem is that the reliability of the clock is now dependent upon the uC's ability to service the interrupt in time to get the CCR value changed before the Timer register reaches that next value. So, it's probably usable only for relatively low clock frequencies. IMO, TimerB is the best to use if you can, since it is always running in most tos programs and the necessary TinyOS componentry exists to use its CCR's. TimerA will require some more coding, but the TimerB code could effectively be copied. You can allocate a CCR, with wiring like this, if using Timer B: components new Msp430Timer32khzC() as Timer; YourModuleP.Msp430TimerControl -> Timer; YourModuleP.Msp430Compare -> Timer; BTW, the ADC12's will run fine without using TimerA, with some limitations.Create a component providing AdcConfigure<const msp430adc12_channel_config_t*> that sets adc12ssel to any value *other* than SHT_SOURCE_ACLK. You can use all the standard ADC read interfaces, but if you use ReadStream, you must use zero (0) for the usPeriod field (if usPeriod > 0, then TimerA is used to generate SAMPCON). Hope this helps, Steve _______________________________________________ Tinyos-help mailing list [email protected] https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
