Hello, guys,
I'm making a program which uses radio and uart0 on the telosb mote.
Since the radio and uart0 share bus on telosb, I had to deal with resource
arbitration.
The thing is, when I made an uart0 manager like this, it dosen't work.
More specifically, after some time, I never receive sendDone() signal after
I send() and got a SUCCESS return value,
So the entire program is collapsed.
----------------------------------------------------------------------------
------
task void requestTask()
{
call UartResource.request();
}
async event void UartRequested.requested()
{
UartResource.releaseTask();
post requestTask();
}
async event void UartRequested.immediateRequested()
{
UartResource.releaseTask();
post requestTask();
}
----------------------------------------------------------------------------
------
I know it's greedy, because everytime it releases, it requests again.
But as I know about CC2420 on telosb, it should work.
Anyway, I tried another case like following, and it works!
----------------------------------------------------------------------------
------
event void RadioSend.sendDone[am_id_t id](message_t* msg, error_t error) {
post requestTask();
}
task void requestTask()
{
call UartResource.request();
}
async event void UartRequested.requested()
{
UartResource.releaseTask();
}
async event void UartRequested.immediateRequested()
{
UartResource.releaseTask();
}
----------------------------------------------------------------------------
------
It seems much less greedy since it only tries to grab the resource after
sendDone() has signaled.
Does anybody can answer me about the problem with case 1?
And in addition, why the CC2420 releases the resource between send() and
sendDone()?
Thanks.
With Kind Regards,
Kirak
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help