Since the data[] array is bytes, only one byte (the LSB) is assigned.
One quick fix it is to do two assignments, knowing that everybody
expects multi-byte data to be in little-endian order:
data[2] = strength & 0xff;
data[3] = strength >> 8;
MS
RamKishore wrote:
Hi Michael,
You pointed the right problem.The assumption that
packet length will be automatically get adjusted at base station was
wrong.When full length messages were sent ,it really worked.*Thank you
very very much*.One small question regarding RSSI values read and
interpretation.
I was trying to read counter value sent by
transmitter, RSSI and crc values with message length set to 6 .As per
AM.h file,strength and crc fields are 16 bit .To achieve this the
following additions are made to previous code.
gRxBufPoolTbl[gRxHeadIndex]->data[2] = Msg->strength;
gRxBufPoolTbl[gRxHeadIndex]->data[3] = Msg->crc;
The output is shown below:
length counter RSSI crc FF FF 00
7D 06 02 00 39 42 00 00
FF FF 00 7D 06 03 00 2D E2 00 00
FF FF 00 7D 06 04 00 2D 02 00 00
FF FF 00 7D 06 05 00 2E A2 00 00
As seen, rssi and crc values are 8bit only.I thought crc is being
over-written on remaining RSSI 8 bits, I made the following changes to
code:
gRxBufPoolTbl[gRxHeadIndex]->data[2] = Msg->strength;
gRxBufPoolTbl[gRxHeadIndex]->data[4] = Msg->crc;
I have the corresponding output:
length counter RSSI CRC FF FF 00
7D 06 02 00 39 00 42 00 00
FF FF 00 7D 06 03 00 2D 00 E2 00 00
FF FF 00 7D 06 04 00 2D 00 02 00 00
FF FF 00 7D 06 05 00 2E 00 A2 00 00
Are these values correct ; what is their interpretation?
Thank you very much for your time and patience.
Thanks once again,
Kishore
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help