Hi Shuo,
If no preamble is detected there will be no packet received at all. The only
way to detect this is to determine how many packets you sent compared to how
many packets you actually received (regardless of correct crc). One way of
doing this is to put a counter into the following event contained in the module
CC2420ReceiveP.nc (found at ...tinyos-2.x\tos\chips\cc2420)
async event void InterruptFIFOP.fired() {
if ( m_state == S_STARTED )
beginReceive();
else
m_missed_packets++;
}
Be wary of false positives though. If a value is detected that is the same as
your preamble then the CC2420 may think it is a packet when in fact it isn't.
If you leave address decoding enabled this should sift out most of these packets
though. Also you will need to add an interface if you want to access
the count outside this particular component.
As a point to note, in the same component you will find the line of code:
if ( ( buf[ length ] >> 7 ) && rx_buf ) {...}
The buf[ length ] >> 7 accesses the crc metadata and determines if the packet
should be passed up the stack. If you were to remove this then a packet with a
corrupt crc would still get passed up however it may get stopped along the way
if errors happen to have occurred in certain header values such as the AM type
etc.
Regards,
Damien
Quoting Shuo Xiao <[EMAIL PROTECTED]>:
> Hi all,
>
> There is one sender mote and one receiver mote. When the receiver doesnot
> receive a certain packet, the cause may be no preamble detected or crc
> error. How can I distinguish these two causes?
>
> I am currently using MicaZ sensor platform and TinyOS2.0.1. And I checked
> that by default CRC is verified by the Chipcon CC2420 hardware, but there is
>
> a metadata called crc. I also tried to retrieve this crc value from
> metadata. The only value I got is 1 even if there were packet losses, and it
>
> seems this method didnot work. Any other method to solve this problem?
>
> Thanks a lot and kindly regards,
>
> Shuo
>
> _________________________________________________________________
> Advertisement: Search for local singles online at Lavalife
>
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Flavalife9%2Eninemsn%2Ecom%2Eau%2Fclickthru%2Fclickthru%2Eact%3Fid%3Dninemsn%26context%3Dan99%26locale%3Den%5FAU%26a%3D29892&_t=764581033&_r=email_taglines_Search&_m=EXT
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help