Maybe I'm not programming in the spirit of tinyos, but I don't ever call
resource release under normal circumstances.  I certainly see no reason
to do it in code where there is only one place where sampling is done and
the sample rate is fairly high.

Your code looks like it should work, but it is complex enough that I
could be wrong.
I think if you reduce your sample period by a factor of 10, it should work.

Eric






On Wed, Mar 26, 2008 at 10:18 AM, Sandip Bapat <[EMAIL PROTECTED]> wrote:
>
>
>
>
> Hi
>
> I am using MultiChannel sampling on the msp430 ADC as shown in
> tinyos-2.x/apps/tests/msp430/Adc12. When I run the program, it runs
> correctly for a non-deterministic length of time (sometimes minutes,
> sometimes a day) and then appears to be stuck. Debugging with LEDs and UART
> shows that the timer for sampling continues to fire, but the
> Resource.reserve call returns an EBUSY error type after this time and no
> more granted events are signalled.
>
> Also, there's no other ADC client in my application. I only use the timer,
> UART and this ADC getData call. The MultiChannel interface is wired to the
> Msp430Adc12ClientAutoRVGC component. I've seen this happen for sampling
> rates of 1kHz down to 167 Hz, but haven't tested for lower sampling rates.
>
> The code I am using looks like this
>
> event Timer.fired(){                      // this fires every 6ms
>     result = call Resource.request();    // returns SUCCESS upto some
> non-deterministic time, during which Resource is granted and I can read ADC
> correctly, after which always returns EBUSY, no more Resource.granted events
> are signalled
> }
>
>
>
> task void releaseResource(){
>
>     call Resource.release();
>
> }
>
>
>
> task void processData(){
>
>     .. send samples to UART
>
> }
>
>
> event Resource.granted(){
>     if (MultiChannel.configure(&config, &memCtl, 1, buffer, BUFFER_SIZE, 0)
> == SUCCESS)
>
>         if (call MultiChannel.getData() != SUCCESS)
>
>             post releaseResource();
>
>     else
>
>         post releaseResource();
>
> }
>
>
>
> event MultiChannel.dataReady(bufptr){
>
>     call Resource.release();
>
>     ...make local copy;
>
>     post processData();
>
> }
>
>
>
> If anyone has observed this or notices something I'm doing wrong, please let
> me know.
>
>
>
> Thank you
>
> Sandip
>  ________________________________
> Looking for last minute shopping deals? Find them fast with Yahoo! Search.
> _______________________________________________
>  Tinyos-help mailing list
>  [email protected]
>  https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to