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.

=20

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

=20

Thanks,

Shaun

=20

=20

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

=20

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.=20

=20

-Shaun

=20

From: Michiel Konstapel [mailto:m.konstapel at sownet.nl]=20
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

=20

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

Michiel

=20

From: Eric Decker [mailto:cire831 at gmail.com]=20
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

=20

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 =3D=3D RES_BUSY && resId =3D=3D id) {
        if(call Queue.isEmpty() =3D=3D FALSE) {
          reqResId =3D call Queue.dequeue();
          resId =3D NO_RES;
          state =3D RES_GRANTING;
          post grantedTask();
          call ResourceConfigure.unconfigure[id]();
        }
        else {
          resId =3D default_owner_id;
          state =3D 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:

=20

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

    atomic {

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

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

          reqResId =3D call Queue.dequeue();

          state =3D RES_GRANTING;

          post grantedTask();

        }

        else {

          resId =3D default_owner_id;

          state =3D RES_CONTROLLED;

          signal ResourceDefaultOwner.granted();

        }

        call ResourceConfigure.unconfigure[id]();

      }

    }

    return FAIL;

  }

=20

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

Michiel

=20

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

=20

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.

=20

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

=20

Here is the code I am using:

  task void release()

  {

     call SpiResource.release();      =20

      =20

     if (!call SpiResource.isOwner())

       call Leds.led1Toggle();

     else

       call Leds.led2Toggle();     =20

  }

=20

event void SpiResource.granted()=20

  {

    post release();

  }

=20

async command error_t Spi.convert()

  {

    if (!call SpiResource.isOwner())

      call SpiResource.request();=20

   =20

    return SUCCESS; =20

  }

 =20

=20

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

=20

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.

=20

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.

=20

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

=20

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?

=20

Thanks in Advance.

=20

-Shaun

=20


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




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


------_=_NextPart_001_01C964DB.B4762491
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:x=3D"urn:schemas-microsoft-com:office:excel" =
xmlns:p=3D"urn:schemas-microsoft-com:office:powerpoint" =
xmlns:a=3D"urn:schemas-microsoft-com:office:access" =
xmlns:dt=3D"uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" =
xmlns:s=3D"uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" =
xmlns:rs=3D"urn:schemas-microsoft-com:rowset" xmlns:z=3D"#RowsetSchema" =
xmlns:b=3D"urn:schemas-microsoft-com:office:publisher" =
xmlns:ss=3D"urn:schemas-microsoft-com:office:spreadsheet" =
xmlns:c=3D"urn:schemas-microsoft-com:office:component:spreadsheet" =
xmlns:odc=3D"urn:schemas-microsoft-com:office:odc" =
xmlns:oa=3D"urn:schemas-microsoft-com:office:activation" =
xmlns:html=3D"http://www.w3.org/TR/REC-html40" =
xmlns:q=3D"http://schemas.xmlsoap.org/soap/envelope/" xmlns:D=3D"DAV:" =
xmlns:x2=3D"http://schemas.microsoft.com/office/excel/2003/xml" =
xmlns:ois=3D"http://schemas.microsoft.com/sharepoint/soap/ois/" =
xmlns:dir=3D"http://schemas.microsoft.com/sharepoint/soap/directory/" =
xmlns:ds=3D"http://www.w3.org/2000/09/xmldsig#" =
xmlns:dsp=3D"http://schemas.microsoft.com/sharepoint/dsp" =
xmlns:udc=3D"http://schemas.microsoft.com/data/udc" =
xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema" =
xmlns:sub=3D"http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/"=
 xmlns:ec=3D"http://www.w3.org/2001/04/xmlenc#" =
xmlns:sp=3D"http://schemas.microsoft.com/sharepoint/" =
xmlns:sps=3D"http://schemas.microsoft.com/sharepoint/soap/" =
xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" =
xmlns:udcxf=3D"http://schemas.microsoft.com/data/udc/xmlfile" =
xmlns:wf=3D"http://schemas.microsoft.com/sharepoint/soap/workflow/" =
xmlns:mver=3D"http://schemas.openxmlformats.org/markup-compatibility/2006=
" xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns:mrels=3D"http://schemas.openxmlformats.org/package/2006/relationshi=
ps" =
xmlns:ex12t=3D"http://schemas.microsoft.com/exchange/services/2006/types"=
 =
xmlns:ex12m=3D"http://schemas.microsoft.com/exchange/services/2006/messag=
es" xmlns:Z=3D"urn:schemas-microsoft-com:" xmlns:st=3D"&#1;" =
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV=3D"Content-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:0cm;
	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:0cm;
	mso-margin-bottom-alt:auto;
	margin-left:0cm;
	font-size:12.0pt;
	font-family:"Times New Roman","serif";}
span.EmailStyle18
	{mso-style-type:personal;
	font-family:"Calibri","sans-serif";
	color:windowtext;}
span.EmailStyle19
	{mso-style-type:personal;
	font-family:"Calibri","sans-serif";
	color:#1F497D;}
span.EmailStyle20
	{mso-style-type:personal;
	font-family:"Calibri","sans-serif";
	color:#1F497D;}
span.EmailStyle21
	{mso-style-type:personal-reply;
	font-family:"Calibri","sans-serif";
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;}
@page Section1
	{size:612.0pt 792.0pt;
	margin:70.85pt 70.85pt 70.85pt 70.85pt;}
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"'>I
don&#8217;t know why your approach isn&#8217;t working (it should =
&#8211; I see Eric Decker has
also replied and might have some ideas) but I wanted to offer an =
alternative. It&#8217;s
very easy to do SPI in software on any spare I/O pins. That might be =
easier
than trying to share the hardware SPI.<o:p></o:p></span></p>

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

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

<div style=3D'border:none;border-left:solid blue 1.5pt;padding:0cm 0cm =
0cm 4.0pt'>

<div>

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

<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"'>
tinyos-help-bounces at millennium.berkeley.edu
[mailto:tinyos-help-bounces at millennium.berkeley.edu] <b>On Behalf Of =
</b>Shaun
Lawrence<br>
<b>Sent:</b> maandag 22 december 2008 21:36<br>
<b>To:</b> tinyos-help at millennium.berkeley.edu<br>
<b>Subject:</b> Re: [Tinyos-help] SPI Resource =
Help<o:p></o:p></span></p>

</div>

</div>

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

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
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&#8217;t want to
mess with that.<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'>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.<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'>Anyone know if you can do this the way I&#8217;m =
thinking?<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'>Thanks,<o:p></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>

<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>

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

<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"'>
tinyos-help-bounces at millennium.berkeley.edu
[mailto:tinyos-help-bounces at millennium.berkeley.edu] <b>On Behalf Of =
</b>Shaun
Lawrence<br>
<b>Sent:</b> Monday, December 22, 2008 10:37 AM<br>
<b>To:</b> tinyos-help at millennium.berkeley.edu<br>
<b>Subject:</b> Re: [Tinyos-help] SPI Resource =
Help<o:p></o:p></span></p>

</div>

</div>

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

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
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. <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>

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

<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"'> Michiel =
Konstapel
[mailto:m.konstapel at sownet.nl] <br>
<b>Sent:</b> Monday, December 22, 2008 9:41 AM<br>
<b>To:</b> Eric Decker<br>
<b>Cc:</b> Shaun Lawrence; tinyos-help at millennium.berkeley.edu<br>
<b>Subject:</b> RE: [Tinyos-help] SPI Resource =
Help<o:p></o:p></span></p>

</div>

</div>

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

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif"'>Ah,
I&#8217;m looking at the 2.0 release snapshot, I =
think.<o:p></o:p></span></p>

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

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

<div style=3D'border:none;border-left:solid blue 1.5pt;padding:0cm 0cm =
0cm 4.0pt'>

<div>

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

<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> maandag 22 december 2008 16:10<br>
<b>To:</b> Michiel Konstapel<br>
<b>Cc:</b> Shaun Lawrence; tinyos-help at millennium.berkeley.edu<br>
<b>Subject:</b> Re: [Tinyos-help] SPI Resource =
Help<o:p></o:p></span></p>

</div>

</div>

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

<p class=3DMsoNormal 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 class=3DMsoNormal>On Mon, Dec 22, 2008 at 1:26 AM, Michiel Konstapel =
&lt;<a
href=3D"mailto:m.konstapel at sownet.nl">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:0cm =
0cm 0cm 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 0cm 0cm 0cm;
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> 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 0cm 0cm 0cm;
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> 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 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>

</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>

</div>

</div>

</body>

</html>

------_=_NextPart_001_01C964DB.B4762491--


More information about the Tinyos-help mailing list