Hello all. Its been quite some time since I was on an email list.

I have been programming most of my life, everything from Assembler to 
FoxPro. But I am brand new to NESC and TinyOS.

I have a question concerning the CC2420. I am using a MicaZ mote, Linux 
and TOS 2.1 something?? I'm not exactly sure as I have for some reason 
removed all the .svn folders from my source. But I checked it out only 
about a month ago.

Anyway, I am attempting to write code that detects wireless traffic 
patterns (any wireless). I am using CCA interrupts to detect when 
traffic begins and ends and basically just output the time between the 
CCA pin going low (channel becomes clear) and going high (channel 
becomes busy).

I humbly ask the following questions:

1. What is the best way to recover data from a mote? I am getting the 
data currently by means of the printf library (I post a task from within 
the interrupt to do this) This is fine for me unless it causes problems 
that I am unaware of (extremely slow?).

2. My code seems to be working but I added a sanity check where when an 
interrupt is fired the first thing I do is check the status of the CCA 
pin, and about 1% of the time (pure guesswork here) the pin indicates 
the opposite status of the interrupt I just received. Is this normal? I 
have posted the relevant code below.

       async event void InterruptCCA.fired()
       {
         atomic
         {
             bool pin = call CCA.get();
             switch(ccaState)
             {
                 // Caught a rising edge, so we are beginning a new 
whitespace period.
                 case NOT_CLEAR:
                     if (!pin) printf("STRANGENESS: CCA PIN CHANGED, BY 
TIME INTERRUPT WAS CALLED!\n");

                     ccaState = CLEAR;

                     // Timestamp a new white space data structure in 
the queue.
                     beginWhiteSpace();

                     // Reset the interrupt for when channel becomes 
busy (pin goes low).
                     call InterruptCCA.enableFallingEdge();

                     break;

                 // Caught a falling edge, this indicates the end of the 
whitespace period.
                 case CLEAR:
                     if (pin) printf("STRANGENESS: CCA PIN CHANGED, BY 
TIME INTERRUPT WAS CALLED!\n");

                     ccaState = NOT_CLEAR;

                     // Finish the previous whitespace data structure in 
the queue.
                     endWhiteSpace();

                     // Reset interrupt for when the channel becomes 
clear (pin goes high).
                     // This will indicate the beginning of a new white 
space.
                     call InterruptCCA.enableRisingEdge();

                     break;
             }
         }
     }

Thank you all.

Ted Ward

_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to