Dr Hui, at first I thank you very much for your explanation.
Based on your answer to 1.2, buf[ length ] is crc. But why buf[ length ] >> 7 being one indicates a good crc?
Based on your answer to 1.2, buf[ length ] is crc. But why buf[ length ] >> 7 being one indicates a good crc?
On 9/28/06, Jonathan Hui <[EMAIL PROTECTED]> wrote:
On 9/28/06, Tie Luo <[EMAIL PROTECTED]> wrote:
> 1) CC2420ReceiveP.nc , in event void RXFIFO.readDone(uint8_t* rx_buf, uint8_t
> rx_len, error_t error )
> 1.1) line 197:
> if ( length > 10 ) {...} (where length is header[0])
> Q: why use constant 10? Does it mean sizeof(cc2420_header_t)? If so,
> will it always be true, since length include a 11-byte header and a payload?
This is simply for timestamping information. The CC2420 is doing
hardware address rejection, so any packets that are rejected should
not be considered.
> 1.2) line 207,208:
> // pass packet up if crc is good
> if ( ( buf[ length ] >> 7 ) && rx_buf ) {...}
> Q: buf[ length ] is the byte beyond the last byte of header+payload,
> so why judge on that? and what does it being shift by 7 bits mean? How does
> this related to crc (see the comment above)
The crc comes after the payload. Please see the CC2420 datasheet.
> 2) in message_t, length=header+payload+footer, right? But in
> CC2420TransmitP.nc line 243 is:
> call TXFIFO.write( (uint8_t*)header, header->length - 1 );
> Q: why -1?
The length byte is not included in the length of the packet. Please
see the 802.15.4 spec.
> 3) related to (2), in the same file at line 421: msg_metadata->rssi =
> ack_buf[ length - 1 ]; while rssi is define as the 2nd field of
> typedef nx_struct cc2420_metadata_t {
> nx_uint8_t tx_power;
> nx_uint8_t rssi;
> nx_uint8_t lqi;
> nx_bool crc;
> nx_bool ack;
> nx_uint16_t time;
> } cc2420_metadata_t;
> So why ack_buf[ length - 1 ] is rssi?
The crc is replaced with rssi when in auto crc mode. Please see the
CC2420 datasheet.
> These questions really make us blue, can you help us out? Thanks a ton!
If not obvious already, I *strongly* recommend that you read the
CC2420 datasheet and the 802.15.4 spec. They will clear a lot of these
issues up.
http://www-s.ti.com/sc/ds/cc2420.pdf
http://standards.ieee.org/getieee802/download/802.15.4-2003.pdf
--
Jonathan Hui
[EMAIL PROTECTED]
--
Regards,
Tie
_______________________________________________ Tinyos-help mailing list [email protected] https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
