[Tinyos-help] CCA Check in application layer.
David Moss
dmm at rincon.com
Thu Jul 17 11:11:24 PDT 2008
If you want to check the channel *before* sending a packet, you can sample
the CCA pin directly. This GeneralIO is provided by HplCC2420PinsC.
The code you're looking at here actually sends a packet, if the channel is
immediately found to be clear. If you're not doing so already, you must
also acquire the SPI bus resource before sending commands over SPI.
-David
-----Original Message-----
From: Hui Kang [mailto:hukang at ic.sunysb.edu]
Sent: Thursday, July 17, 2008 10:26 AM
To: David Moss
Cc: tinyos-help at millennium.berkeley.edu
Subject: CCA Check in application layer.
Dear All:
In my tinyos-2.x application, I would like to check the channel before
sending a packet. By copying the following code from CC2420TransmitP.nc,
I found the congest is always set as TRUE even I have only one mote turn
on. Could anyone help to solve this problem or any other smarter way to
check CCA? Thanks.
uint8_t status;
bool congestion = TRUE;
atomic{
call CSN.clr();
status = call STXONCCA.strobe();
if ( !( status & CC2420_STATUS_TX_ACTIVE ) ) {
status = call SNOP.strobe();
if ( status & CC2420_STATUS_TX_ACTIVE ) {
congestion = FALSE;
}
}
call CSN.set();
}
- Hui
More information about the Tinyos-help
mailing list