[Tinyos-devel] Bug found in TinyOS-1.15 ADC HPL
Leo Selavo
selavo at cs.virginia.edu
Wed Oct 18 14:06:02 PDT 2006
Folks,
I got hit by the following ADC bug in TinyOS 1.x. Please take a note, it
may save you a few days of debugging.
Platform and source:
TinyOS 1.x (1.15+), mica2, micaz: HPLADCM.nc
The symptoms
-----------------------------
Mote freezes. Commenting out ADCControl.init() hides the freezing problem.
Unexpected event ADC.getData(). In some cases may lead to system halt.
The cause
-----------------------------
When initializing ADC in the ADC HAL source code, pending ADC interrupts
are not cleared although may be present. By enabling the ADC interrupts
and not clearing possible pending interrupts you may get an
ADC.dataReady() event without calling ADC.getData(). Depending on your
code in ADC.dataReady() strange things may happen, or not.
HPLADCM.init() should clear the pending interrupts on initialization.
The fix
-----------------------------
In the files:
platform/micaz/HPLADCM.nc and platform/mica2/HPLADCM.nc
in the procedure:
"async command result_t ADC.init() { ..."
before enabling the ADC interrupt add the following:
sbi(ADCSR, ADIF); // LS: Clear pending ADC interrupts
Or use the source code file attached to this email.
Version and location:
-----------------------------
The bug was found in tinyos-1.15.
The problem is in the files:
tinyos-1.x/tos/platform/micaz/HPLADCM.nc and
tinyos-1.x/tos/platform/mica2/HPLADCM.nc
These files are included in the compilation when you use ADCControl
component on MICAz and MICA2 platforms.
As far as I can see the problem persists in the latest TinyOS 1.x
version on
SourceForge.
Best,
--
Leo Selavo
Research Associate
Department of Computer Science
University of Virginia
151 Engineer's Way, P.O.Box 400740
Charlottesville, VA 22904-4740, USA
Phone: +1-434-982-2203
Fax: +1-434-982-2214
Web: http://www.cs.virginia.edu/~ls2ef
More information about the Tinyos-devel
mailing list