[Tinyos-help] CCA Check in application layer.
Hui Kang
hukang at ic.sunysb.edu
Thu Jul 17 10:25:35 PDT 2008
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