No subject


Wed Dec 10 10:11:30 PST 2008


then do the SPI commands (Request->Granted->SPI Send->SPI SendDone->Release)
then start up the UART again to send the data to the PC over the serial
connection. I am using a custom mote very similar to the TelosB.


What I have in my tree is a wrapper around the serial driver that also does
a request/grant kind of thing.  Then I let the arbiter handle resource
contention.  The arbiter also handles configuration and unconfiguration.

Keep in mind the original serial code is very old and predates  arbitration
and the Resource interface stuff.   That's why we added a wrapper.

Anyone know if you can do this the way I'm thinking? 


My code works so the existence proof exists  :-)

eric
 

 

Thanks,

Shaun

 

 

From: tinyos-help-bounces at millennium.berkeley.edu
[mailto:tinyos-help-bounces at millennium.berkeley.edu] On Behalf Of Shaun
Lawrence
Sent: Monday, December 22, 2008 10:37 AM


To: tinyos-help at millennium.berkeley.edu

Subject: Re: [Tinyos-help] SPI Resource Help

 

Seems I had an old snapshot too. I just updated to the 2.1 snapshot. Still
trying to battle getting the UART1 and SPI1 bus on the MSP430 to cooperate. 

 

-Shaun

 

From: Michiel Konstapel [mailto:m.konstapel at sownet.nl] 
Sent: Monday, December 22, 2008 9:41 AM
To: Eric Decker
Cc: Shaun Lawrence; tinyos-help at millennium.berkeley.edu
Subject: RE: [Tinyos-help] SPI Resource Help

 

Ah, I'm looking at the 2.0 release snapshot, I think.

Michiel

 

From: Eric Decker [mailto:cire831 at gmail.com] 
Sent: maandag 22 december 2008 16:10
To: Michiel Konstapel
Cc: Shaun Lawrence; tinyos-help at millennium.berkeley.edu
Subject: Re: [Tinyos-help] SPI Resource Help

 

I'm not sure what version of the code you are looking at but the following
is
from the current T2 tree and it is different.  And will return SUCCESS if
the
resource has been appropriately released.

Eric

  async command error_t Resource.release[uint8_t id]() {
    atomic {
      if(state == RES_BUSY && resId == id) {
        if(call Queue.isEmpty() == FALSE) {
          reqResId = call Queue.dequeue();
          resId = NO_RES;
          state = RES_GRANTING;
          post grantedTask();
          call ResourceConfigure.unconfigure[id]();
        }
        else {
          resId = default_owner_id;
          state = RES_CONTROLLED;
          call ResourceConfigure.unconfigure[id]();
          signal ResourceDefaultOwner.granted();
        }
        return SUCCESS;
      }
    }
    return FAIL;
  }

On Mon, Dec 22, 2008 at 1:26 AM, Michiel Konstapel <m.konstapel at sownet.nl>
wrote:

If you dig deep enough, you eventually get down to tos/system/ArbiterP.nc
which implements the Resource interface:

 

  async command error_t Resource.release[uint8_t id]() {

    atomic {

      if(state == RES_BUSY && resId == id) {

        if(call Queue.isEmpty() == FALSE) {

          reqResId = call Queue.dequeue();

          state = RES_GRANTING;

          post grantedTask();

        }

        else {

          resId = default_owner_id;

          state = RES_CONTROLLED;

          signal ResourceDefaultOwner.granted();

        }

        call ResourceConfigure.unconfigure[id]();

      }

    }

    return FAIL;

  }

 

So basically. it always return FAIL, which I think is a bug.

Michiel

 

From: tinyos-help-bounces at millennium.berkeley.edu
[mailto:tinyos-help-bounces at millennium.berkeley.edu] On Behalf Of Shaun
Lawrence
Sent: vrijdag 19 december 2008 21:02
To: tinyos-help at millennium.berkeley.edu
Subject: Re: [Tinyos-help] SPI Resource Help

 

Ok I figured out that the release is happening but for some reason it's
returning FAIL instead of SUCCESS.  Since I am not the owner initially the
request is handled and granted and after the release led1 is toggled showing
that I am no longer the owner. If I comment out "call
SpiResource.release();" then led2 is toggled. So everything is expected but
for some odd reason the .release() is not returning what I thought.

 

Anyone know what might cause this? I am running the telosB.. this request is
happening on Msp430Spi1.

 

Here is the code I am using:

  task void release()

  {

     call SpiResource.release();       

       

     if (!call SpiResource.isOwner())

       call Leds.led1Toggle();

     else

       call Leds.led2Toggle();      

  }

 

event void SpiResource.granted() 

  {

    post release();

  }

 

async command error_t Spi.convert()

  {

    if (!call SpiResource.isOwner())

      call SpiResource.request(); 

    

    return SUCCESS;  

  }

  

 

From: tinyos-help-bounces at millennium.berkeley.edu
[mailto:tinyos-help-bounces at millennium.berkeley.edu] On Behalf Of Shaun
Lawrence
Sent: Friday, December 19, 2008 8:10 AM
To: tinyos-help at millennium.berkeley.edu
Subject: [Tinyos-help] SPI Resource Help

 

I'm having a little trouble with the SPI Resources, I need to setup
arbitration but that will come later. Just need to make sure I can get the
following to work first.

 

First I want to say that only one device is on the SPI bus, the one I'm
trying to control. So the problem isn't that something else already has
control.

 

I call SpiResource.request() and in turn the SpiResource.granted() is called
like its suppose to, I have already verified this. 

 

However, when I try to call SpiResource.release() it's coming back as FAIL
but I have verified that the SpiResource.isOwner() is coming back as TRUE.
Does anyone know why the release() is failing?

 

Thanks in Advance.

 

-Shaun

 


_______________________________________________
Tinyos-help mailing list
Tinyos-help at millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help




-- 
Eric B. Decker
Senior (over 50 :-) Researcher
Autonomous Systems Lab
Jack Baskin School of Engineering
UCSC


_______________________________________________
Tinyos-help mailing list
Tinyos-help at millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help




-- 
Eric B. Decker
Senior (over 50 :-) Researcher
Autonomous Systems Lab
Jack Baskin School of Engineering
UCSC


------=_NextPart_000_002B_01C96510.F0A902A0
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
p
	{mso-style-priority:99;
	mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	font-size:12.0pt;
	font-family:"Times New Roman","serif";}
span.EmailStyle18
	{mso-style-type:personal-reply;
	font-family:"Calibri","sans-serif";
	color:#1F497D;}
.MsoChpDefault
	{mso-style-type:export-only;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
	{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext=3D"edit">
  <o:idmap v:ext=3D"edit" data=3D"1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Eric,<o:p></o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Did you ever stop and restart the UART through the =
SplitControl
of SerialActiveMessageC? That is where I found the problem to be. Once I =
added
the following it worked:<o:p></o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Added txInit(); rxInit(); and ackInit(); inside of
SplitContorl.start() from SerialP.nc. <o:p></o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Seems it never re-initialized txState causing the =
sendDone() event
never to be signaled. I&#8217;m not sure if this is a bug or if =
I&#8217;m calling
the routines incorrectly. If anyone has any thoughts of the above please =
let me
know.<o:p></o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>-Shaun<o:p></o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div style=3D'border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt =
0in 0in 0in'>

<p class=3DMsoNormal><b><span =
style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span>=
</b><span
style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Eric =
Decker
[mailto:cire831 at gmail.com] <br>
<b>Sent:</b> Monday, December 22, 2008 6:12 PM<br>
<b>To:</b> Shaun Lawrence<br>
<b>Cc:</b> tinyos-help at millennium.berkeley.edu<br>
<b>Subject:</b> Re: [Tinyos-help] SPI Resource =
Help<o:p></o:p></span></p>

</div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal style=3D'margin-bottom:12.0pt'>Hi Shaun,<br>
<br>
I too have a custom mote that is very similar to the telosb.&nbsp; I =
have the
following devices on USART1: SERIAL (direct connect), GPS (there is a =
serial
mux that I also have to wiggle to get the right things to happen), SD =
(mass
storage) via SPI1 and eventually we will also put the radio out there as =
well.<br>
<br>
I'm making heavy use of Resource contention via Arbiters.&nbsp; I am =
based on
the current tip of the T2.1 cvs tree.<br>
<br>
If you make it possible for me to see your source tree I maybe able to =
figure
out what is going on.<o:p></o:p></p>

<div>

<p class=3DMsoNormal>On Mon, Dec 22, 2008 at 1:35 PM, Shaun Lawrence =
&lt;<a
href=3D"mailto:slawrence at invocon.com">slawrence at invocon.com</a>&gt; =
wrote:<o:p></o:p></p>

<div>

<div>

<p><span style=3D'font-size:11.0pt;color:#1F497D'>Has anyone tried to =
share the
UART1/SPI1 ? I cant use the UART0/SPI0 bus because that is being used =
solely
for the radio, don't want to mess with that.</span><o:p></o:p></p>

<p><span =
style=3D'font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span style=3D'font-size:11.0pt;color:#1F497D'>From my understanding =
I can
stop the UART with (SplitControl.stop()) and then do the SPI commands
(Request-&gt;Granted-&gt;SPI Send-&gt;SPI SendDone-&gt;Release) then =
start up
the UART again to send the data to the PC over the serial connection. I =
am
using a custom mote very similar to the TelosB.</span><o:p></o:p></p>

</div>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-bottom:12.0pt'><br>
What I have in my tree is a wrapper around the serial driver that also =
does a
request/grant kind of thing.&nbsp; Then I let the arbiter handle =
resource
contention.&nbsp; The arbiter also handles configuration and =
unconfiguration.<br>
<br>
Keep in mind the original serial code is very old and predates&nbsp;
arbitration and the Resource interface stuff.&nbsp;&nbsp; That's why we =
added a
wrapper.<o:p></o:p></p>

</div>

<blockquote style=3D'border:none;border-left:solid #CCCCCC =
1.0pt;padding:0in 0in 0in 6.0pt;
margin-left:4.8pt;margin-right:0in'>

<div>

<div>

<p><span style=3D'font-size:11.0pt;color:#1F497D'>Anyone know if you can =
do this
the way I'm thinking? </span><o:p></o:p></p>

</div>

</div>

</blockquote>

<div>

<p class=3DMsoNormal><br>
My code works so the existence proof exists&nbsp; :-)<br>
<br>
eric<br>
&nbsp;<o:p></o:p></p>

</div>

<blockquote style=3D'border:none;border-left:solid #CCCCCC =
1.0pt;padding:0in 0in 0in 6.0pt;
margin-left:4.8pt;margin-right:0in'>

<div>

<div>

<p><o:p>&nbsp;</o:p></p>

<p><span =
style=3D'font-size:11.0pt;color:#1F497D'>Thanks,</span><o:p></o:p></p>

<p><span =
style=3D'font-size:11.0pt;color:#1F497D'>Shaun</span><o:p></o:p></p>

<p><span =
style=3D'font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span =
style=3D'font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<div>

<div style=3D'border:none;border-top:solid windowtext =
1.0pt;padding:3.0pt 0in 0in 0in;
border-color:-moz-use-text-color -moz-use-text-color'>

<p><b><span style=3D'font-size:10.0pt'>From:</span></b><span =
style=3D'font-size:
10.0pt'> <a href=3D"mailto:tinyos-help-bounces at millennium.berkeley.edu"
target=3D"_blank">tinyos-help-bounces at millennium.berkeley.edu</a> =
[mailto:<a
href=3D"mailto:tinyos-help-bounces at millennium.berkeley.edu" =
target=3D"_blank">tinyos-help-bounces at millennium.berkeley.edu</a>]
<b>On Behalf Of </b>Shaun Lawrence<br>
<b>Sent:</b> Monday, December 22, 2008 10:37 AM<o:p></o:p></span></p>

<div>

<p class=3DMsoNormal><span style=3D'font-size:10.0pt'><br>
<b>To:</b> <a href=3D"mailto:tinyos-help at millennium.berkeley.edu" =
target=3D"_blank">tinyos-help at millennium.berkeley.edu</a><o:p></o:p></spa=
n></p>

</div>

<div>

<div>

<p class=3DMsoNormal><b><span =
style=3D'font-size:10.0pt'>Subject:</span></b><span
style=3D'font-size:10.0pt'> Re: [Tinyos-help] SPI Resource =
Help<o:p></o:p></span></p>

</div>

</div>

</div>

</div>

<div>

<div>

<p>&nbsp;<o:p></o:p></p>

<p><span style=3D'font-size:11.0pt;color:#1F497D'>Seems I had an old =
snapshot
too. I just updated to the 2.1 snapshot. Still trying to battle getting =
the
UART1 and SPI1 bus on the MSP430 to cooperate. </span><o:p></o:p></p>

<p><span =
style=3D'font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span =
style=3D'font-size:11.0pt;color:#1F497D'>-Shaun</span><o:p></o:p></p>

<p><span =
style=3D'font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<div>

<div style=3D'border:none;border-top:solid windowtext =
1.0pt;padding:3.0pt 0in 0in 0in;
border-color:-moz-use-text-color -moz-use-text-color'>

<p><b><span style=3D'font-size:10.0pt'>From:</span></b><span =
style=3D'font-size:
10.0pt'> Michiel Konstapel [mailto:<a =
href=3D"mailto:m.konstapel at sownet.nl"
target=3D"_blank">m.konstapel at sownet.nl</a>] <br>
<b>Sent:</b> Monday, December 22, 2008 9:41 AM<br>
<b>To:</b> Eric Decker<br>
<b>Cc:</b> Shaun Lawrence; <a =
href=3D"mailto:tinyos-help at millennium.berkeley.edu"
target=3D"_blank">tinyos-help at millennium.berkeley.edu</a><br>
<b>Subject:</b> RE: [Tinyos-help] SPI Resource =
Help</span><o:p></o:p></p>

</div>

</div>

<p>&nbsp;<o:p></o:p></p>

<p><span style=3D'font-size:11.0pt'>Ah, I'm looking at the 2.0 release =
snapshot,
I think.</span><o:p></o:p></p>

<p><span style=3D'font-size:11.0pt'>Michiel</span><o:p></o:p></p>

<p><span style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p>

<div style=3D'border:none;border-left:solid windowtext 1.5pt;padding:0in =
0in 0in 4.0pt;
border-color:-moz-use-text-color -moz-use-text-color -moz-use-text-color =
blue'>

<div>

<div style=3D'border:none;border-top:solid windowtext =
1.0pt;padding:3.0pt 0in 0in 0in;
border-color:-moz-use-text-color -moz-use-text-color'>

<p><b><span style=3D'font-size:10.0pt'>From:</span></b><span =
style=3D'font-size:
10.0pt'> Eric Decker [mailto:<a href=3D"mailto:cire831 at gmail.com" =
target=3D"_blank">cire831 at gmail.com</a>]
<br>
<b>Sent:</b> maandag 22 december 2008 16:10<br>
<b>To:</b> Michiel Konstapel<br>
<b>Cc:</b> Shaun Lawrence; <a =
href=3D"mailto:tinyos-help at millennium.berkeley.edu"
target=3D"_blank">tinyos-help at millennium.berkeley.edu</a><br>
<b>Subject:</b> Re: [Tinyos-help] SPI Resource =
Help</span><o:p></o:p></p>

</div>

</div>

<p>&nbsp;<o:p></o:p></p>

<p style=3D'margin-bottom:12.0pt'>I'm not sure what version of the code =
you are
looking at but the following is<br>
from the current T2 tree and it is different.&nbsp; And will return =
SUCCESS if
the<br>
resource has been appropriately released.<br>
<br>
Eric<br>
<br>
&nbsp; async command error_t Resource.release[uint8_t id]() {<br>
&nbsp;&nbsp;&nbsp; atomic {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(state =3D=3D RES_BUSY &amp;&amp; resId =
=3D=3D id) {<br>
&nbsp; &nbsp; &nbsp; &nbsp; if(call Queue.isEmpty() =3D=3D FALSE) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reqResId =3D call
Queue.dequeue();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; resId =3D =
NO_RES;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; state =3D =
RES_GRANTING;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; post =
grantedTask();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; call
ResourceConfigure.unconfigure[id]();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; resId =3D
default_owner_id;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; state =3D =
RES_CONTROLLED;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; call
ResourceConfigure.unconfigure[id]();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; signal
ResourceDefaultOwner.granted();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return SUCCESS;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; return FAIL;<br>
&nbsp; }<o:p></o:p></p>

<div>

<p>On Mon, Dec 22, 2008 at 1:26 AM, Michiel Konstapel &lt;<a
href=3D"mailto:m.konstapel at sownet.nl" =
target=3D"_blank">m.konstapel at sownet.nl</a>&gt;
wrote:<o:p></o:p></p>

<div>

<div>

<p>If you dig deep enough, you eventually get down to =
tos/system/ArbiterP.nc which
implements the Resource interface:<o:p></o:p></p>

<p>&nbsp;<o:p></o:p></p>

<p><span style=3D'font-size:10.0pt;color:black'>&nbsp; async command =
error_t
Resource.release[uint8_t id]() {</span><o:p></o:p></p>

<p><span style=3D'font-size:10.0pt;color:black'>&nbsp;&nbsp;&nbsp; =
atomic {</span><o:p></o:p></p>

<p><span =
style=3D'font-size:10.0pt;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><b><span
style=3D'font-size:10.0pt;color:#7F0055'>if</span></b><span =
style=3D'font-size:
10.0pt;color:black'>(state =3D=3D RES_BUSY &amp;&amp; resId =3D=3D id) =
{</span><o:p></o:p></p>

<p><span =
style=3D'font-size:10.0pt;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;
</span><b><span =
style=3D'font-size:10.0pt;color:#7F0055'>if</span></b><span
style=3D'font-size:10.0pt;color:black'>(call Queue.isEmpty() =3D=3D =
FALSE) {</span><o:p></o:p></p>

<p><span =
style=3D'font-size:10.0pt;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;
reqResId =3D call Queue.dequeue();</span><o:p></o:p></p>

<p><span =
style=3D'font-size:10.0pt;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;
state =3D RES_GRANTING;</span><o:p></o:p></p>

<p><span =
style=3D'font-size:10.0pt;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;
post grantedTask();</span><o:p></o:p></p>

<p><span =
style=3D'font-size:10.0pt;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;
}</span><o:p></o:p></p>

<p><span =
style=3D'font-size:10.0pt;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;
</span><b><span =
style=3D'font-size:10.0pt;color:#7F0055'>else</span></b><span
style=3D'font-size:10.0pt;color:black'> {</span><o:p></o:p></p>

<p><span =
style=3D'font-size:10.0pt;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;
resId =3D default_owner_id;</span><o:p></o:p></p>

<p><span =
style=3D'font-size:10.0pt;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;
state =3D RES_CONTROLLED;</span><o:p></o:p></p>

<p><span =
style=3D'font-size:10.0pt;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;
signal ResourceDefaultOwner.granted();</span><o:p></o:p></p>

<p><span =
style=3D'font-size:10.0pt;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;
}</span><o:p></o:p></p>

<p><span =
style=3D'font-size:10.0pt;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;
call ResourceConfigure.unconfigure[id]();</span><o:p></o:p></p>

<p><span =
style=3D'font-size:10.0pt;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
}</span><o:p></o:p></p>

<p><span style=3D'font-size:10.0pt;color:black'>&nbsp;&nbsp;&nbsp; =
}</span><o:p></o:p></p>

<p><span style=3D'font-size:10.0pt;color:black'>&nbsp;&nbsp;&nbsp; =
</span><b><span
style=3D'font-size:10.0pt;color:#7F0055'>return</span></b><span =
style=3D'font-size:
10.0pt;color:black'> FAIL;</span><o:p></o:p></p>

<p><span style=3D'font-size:10.0pt;color:black'>&nbsp; =
}</span><o:p></o:p></p>

<p><span =
style=3D'font-size:10.0pt;color:black'>&nbsp;</span><o:p></o:p></p>

<p>So basically&#8230; it always return FAIL, which I think is a =
bug.<o:p></o:p></p>

<p>Michiel<o:p></o:p></p>

<p>&nbsp;<o:p></o:p></p>

<div style=3D'border:none;border-left:solid windowtext 1.5pt;padding:0in =
0in 0in 4.0pt;
border-color:-moz-use-text-color -moz-use-text-color -moz-use-text-color =
blue'>

<div>

<div style=3D'border:none;border-top:solid windowtext =
1.0pt;padding:3.0pt 0in 0in 0in;
border-color:-moz-use-text-color'>

<p><b><span style=3D'font-size:10.0pt'>From:</span></b><span =
style=3D'font-size:
10.0pt'> <a href=3D"mailto:tinyos-help-bounces at millennium.berkeley.edu"
target=3D"_blank">tinyos-help-bounces at millennium.berkeley.edu</a> =
[mailto:<a
href=3D"mailto:tinyos-help-bounces at millennium.berkeley.edu" =
target=3D"_blank">tinyos-help-bounces at millennium.berkeley.edu</a>]
<b>On Behalf Of </b>Shaun Lawrence<br>
<b>Sent:</b> vrijdag 19 december 2008 21:02<br>
<b>To:</b> <a href=3D"mailto:tinyos-help at millennium.berkeley.edu" =
target=3D"_blank">tinyos-help at millennium.berkeley.edu</a><br>
<b>Subject:</b> Re: [Tinyos-help] SPI Resource =
Help</span><o:p></o:p></p>

</div>

</div>

<p>&nbsp;<o:p></o:p></p>

<p><span style=3D'color:#1F497D'>Ok I figured out that the release is =
happening
but for some reason it's returning FAIL instead of SUCCESS. &nbsp;Since =
I am
not the owner initially the request is handled and granted and after the
release led1 is toggled showing that I am no longer the owner. If I =
comment out
&quot;call SpiResource.release();&quot; then led2 is toggled. So =
everything is
expected but for some odd reason the .release() is not returning what I
thought.</span><o:p></o:p></p>

<p><span style=3D'color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span style=3D'color:#1F497D'>Anyone know what might cause this? I am =
running
the telosB.. this request is happening on =
Msp430Spi1.</span><o:p></o:p></p>

<p><span style=3D'color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span style=3D'color:#1F497D'>Here is the code I am =
using:</span><o:p></o:p></p>

<p><span style=3D'color:#1F497D'>&nbsp; task void =
release()</span><o:p></o:p></p>

<p><span style=3D'color:#1F497D'>&nbsp; {</span><o:p></o:p></p>

<p><span style=3D'color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp; call
SpiResource.release();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><o:p></o:p></p>

<p><span style=3D'color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><o:p></o:p></p>

<p><span style=3D'color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp; if (!call
SpiResource.isOwner())</span><o:p></o:p></p>

<p><span style=3D'color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
call Leds.led1Toggle();</span><o:p></o:p></p>

<p><span style=3D'color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp; =
else</span><o:p></o:p></p>

<p><span style=3D'color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
call
Leds.led2Toggle();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><o:p></o:p></p>

<p><span style=3D'color:#1F497D'>&nbsp; }</span><o:p></o:p></p>

<p><span style=3D'color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span style=3D'color:#1F497D'>event void SpiResource.granted() =
</span><o:p></o:p></p>

<p><span style=3D'color:#1F497D'>&nbsp; {</span><o:p></o:p></p>

<p><span style=3D'color:#1F497D'>&nbsp;&nbsp;&nbsp; post =
release();</span><o:p></o:p></p>

<p><span style=3D'color:#1F497D'>&nbsp; }</span><o:p></o:p></p>

<p><span style=3D'color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span style=3D'color:#1F497D'>async command error_t =
Spi.convert()</span><o:p></o:p></p>

<p><span style=3D'color:#1F497D'>&nbsp; {</span><o:p></o:p></p>

<p><span style=3D'color:#1F497D'>&nbsp;&nbsp;&nbsp; if (!call
SpiResource.isOwner())</span><o:p></o:p></p>

<p><span style=3D'color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; call
SpiResource.request(); </span><o:p></o:p></p>

<p><span style=3D'color:#1F497D'>&nbsp;&nbsp;&nbsp; =
</span><o:p></o:p></p>

<p><span style=3D'color:#1F497D'>&nbsp;&nbsp;&nbsp; return =
SUCCESS;&nbsp; </span><o:p></o:p></p>

<p><span style=3D'color:#1F497D'>&nbsp; }</span><o:p></o:p></p>

<p><span style=3D'color:#1F497D'>&nbsp; </span><o:p></o:p></p>

<p><span style=3D'color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<div>

<div style=3D'border:none;border-top:solid windowtext =
1.0pt;padding:3.0pt 0in 0in 0in;
border-color:-moz-use-text-color'>

<p><b><span style=3D'font-size:10.0pt'>From:</span></b><span =
style=3D'font-size:
10.0pt'> <a href=3D"mailto:tinyos-help-bounces at millennium.berkeley.edu"
target=3D"_blank">tinyos-help-bounces at millennium.berkeley.edu</a> =
[mailto:<a
href=3D"mailto:tinyos-help-bounces at millennium.berkeley.edu" =
target=3D"_blank">tinyos-help-bounces at millennium.berkeley.edu</a>]
<b>On Behalf Of </b>Shaun Lawrence<br>
<b>Sent:</b> Friday, December 19, 2008 8:10 AM<br>
<b>To:</b> <a href=3D"mailto:tinyos-help at millennium.berkeley.edu" =
target=3D"_blank">tinyos-help at millennium.berkeley.edu</a><br>
<b>Subject:</b> [Tinyos-help] SPI Resource Help</span><o:p></o:p></p>

</div>

</div>

<p>&nbsp;<o:p></o:p></p>

<p>I'm having a little trouble with the SPI Resources, I need to setup
arbitration but that will come later. Just need to make sure I can get =
the
following to work first.<o:p></o:p></p>

<p>&nbsp;<o:p></o:p></p>

<p>First I want to say that only one device is on the SPI bus, the one =
I'm
trying to control. So the problem isn't that something else already has
control.<o:p></o:p></p>

<p>&nbsp;<o:p></o:p></p>

<p>I call SpiResource.request() and in turn the SpiResource.granted() is =
called
like its suppose to, I have already verified this. <o:p></o:p></p>

<p>&nbsp;<o:p></o:p></p>

<p>However, when I try to call SpiResource.release() it's coming back as =
FAIL
but I have verified that the SpiResource.isOwner() is coming back as =
TRUE. Does
anyone know why the release() is failing?<o:p></o:p></p>

<p>&nbsp;<o:p></o:p></p>

<p>Thanks in Advance.<o:p></o:p></p>

<p>&nbsp;<o:p></o:p></p>

<p>-Shaun<o:p></o:p></p>

<p>&nbsp;<o:p></o:p></p>

</div>

</div>

</div>

<p><br>
_______________________________________________<br>
Tinyos-help mailing list<br>
<a href=3D"mailto:Tinyos-help at millennium.berkeley.edu" =
target=3D"_blank">Tinyos-help at millennium.berkeley.edu</a><br>
<a
href=3D"https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tiny=
os-help"
target=3D"_blank">https://www.millennium.berkeley.edu/cgi-bin/mailman/lis=
tinfo/tinyos-help</a><o:p></o:p></p>

</div>

<p style=3D'margin-bottom:12.0pt'><br>
<br clear=3Dall>
<br>
-- <br>
Eric B. Decker<br>
Senior (over 50 :-) Researcher<br>
Autonomous Systems Lab<br>
Jack Baskin School of Engineering<br>
UCSC<o:p></o:p></p>

</div>

</div>

</div>

</div>

</div>

<p class=3DMsoNormal><br>
_______________________________________________<br>
Tinyos-help mailing list<br>
<a =
href=3D"mailto:Tinyos-help at millennium.berkeley.edu">Tinyos-help at millenniu=
m.berkeley.edu</a><br>
<a
href=3D"https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tiny=
os-help"
target=3D"_blank">https://www.millennium.berkeley.edu/cgi-bin/mailman/lis=
tinfo/tinyos-help</a><o:p></o:p></p>

</blockquote>

</div>

<p class=3DMsoNormal style=3D'margin-bottom:12.0pt'><br>
<br clear=3Dall>
<br>
-- <br>
Eric B. Decker<br>
Senior (over 50 :-) Researcher<br>
Autonomous Systems Lab<br>
Jack Baskin School of Engineering<br>
UCSC<o:p></o:p></p>

</div>

</body>

</html>

------=_NextPart_000_002B_01C96510.F0A902A0--




More information about the Tinyos-help mailing list