Hello,
I'm new to the list but have been developing for TinyOS for a couple of months
now. I've searched the archives but can't find any reference to the problem
I'm having.
I'm running TinyOS 2.0.0beta2-3 on Linux (Mandrake/kernel 2.6.11) and using
the rpm's for mspgcc, tinyos-tools, etc from the installing tinyos web page.
All of the sample applications work fine, as does, at least functionally,
several applications I am developing. The hardware is a TelosB (TMote Sky).
I've created modified Msp430Adc12 peripheral code that implements support for
multi-channel repeating ADC sequences. Once I get it working, perhaps it
will be a candidate for merging into a later version of TinyOS... I've set
the peripheral to repeatedly convert as fast as possible a sequence of 3
input channels, all from Port 6 pins. Upon completion of each sequence
conversion, the peripheral code signals the async event
Msp430Adc12.sequenceReady() in my application code. The application code
uses an AlarmMilliC (so it can be started in async code) to accepts sequence
conversion results for 500msec before stopping. It then sends the results
over the radio to a PC with a mote running BaseStation. The results include
the number of sequence conversions performed during the period. I have
verified that the actual conversion duration is ~500 msec by driving an
external pin via LedsC and monitoring with a storage scope.
Now, finally, to the problem. If, in the code below, I leave OUT the 'if'
conditional (surrounded by the #if), I will see 13,400 sequence conversions
per second, give or take. If I leave IN the 'if' conditional, I see 5-12
sequence conversions per second!
I'm quite baffled! Any suggestions on how to begin tracking this down?
Thanks,
Steve
--- code ---
async event bool Msp430Adc12.sequenceReady(uint16_t *data, uint8_t len)
{
if (state == STATE_SAMPLE) {
if (!pending) {
uint16_t newX, newY, newZ, newMag;
newX = data[0]; newY = data[1]; newZ = data[2];
/* Use hardware multiplier to square each axis. New magnitude is the
* sum of the squares.
*/
MPYS = newX;
OP2 = newX;
newMag = RESLO;
MPYS = newY;
OP2 = newY;
newMag += RESLO;
MPYS = newZ;
OP2 = newZ;
newMag += RESLO;
#if 1 /* if this code is compiled IN, we get SLOW */
if (newMag <= result.magnitude)
return TRUE;
#endif
result.x = newX;
result.y = newY;
result.z = newZ;
result.count++;
result.magnitude = newMag;
return TRUE;
} else if (pending & PEND_STOP) {
samplingStopped();
return FALSE;
} else if (pending & PEND_ALARM) {
pending |= PEND_RESULT;
post sendResults();
samplingStopped();
return FALSE;
} else /* if (pending & PEND_ALARM) */ {
/* we get slightly better performance if we read here for reasons that
* are unclear.
*/
bogus = data[2];
return TRUE;
}
}
return FALSE;
}
--- end of code ----
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help