Hey all,
I've been working on UART recently and had some problems with
fRemapRxPos() in FramerM. According to my understanding of the module,
it provides framing for TOS_Msg in UART communication. Meanwhile,
fRemapRxPos() remaps standard TOSMessage fields to CC2420TOSMsg. Correct
me if I'm wrong, but isn't it unnecessary? Whether remapping or not, the
module should function well.
And here is another problem. I presume that the standard TOSMessage as
follows,
////////////////////////////////////////////////////////////////////////////////
typedef struct TOS_Msg
{
/* The following fields are transmitted/received on the radio. */
uint16_t addr;
uint8_t type;
uint8_t group;
uint8_t length;
int8_t data[TOSH_DATA_LENGTH];
uint16_t crc;
/* The following fields are not actually transmitted or received
* on the radio! They are used for internal accounting only.
* The reason they are in this structure is that the AM interface
* requires them to be part of the TOS_Msg that is passed to
* send/receive operations.
*/
uint16_t strength;
uint8_t ack;
uint16_t time;
uint8_t sendSecurityMode;
uint8_t receiveSecurityMode;
} TOS_Msg;
////////////////////////////////////////////////////////////////////////////////
and CC2420TOSMsg,
//////////////////////////////////////////////////////////////////////////////
typedef struct TOS_Msg
{
/* The following fields are transmitted/received on the radio. */
uint8_t length;
uint8_t fcfhi;
uint8_t fcflo;
uint8_t dsn;
uint16_t destpan;
uint16_t addr;
uint8_t type;
uint8_t group;
int8_t data[TOSH_DATA_LENGTH +3 ];
/* The following fields are not actually transmitted or received
* on the radio! They are used for internal accounting only.
* The reason they are in this structure is that the AM interface
* requires them to be part of the TOS_Msg that is passed to
* send/receive operations.
*/
uint8_t strength;
uint8_t lqi;
bool crc;
uint8_t ack;
uint16_t time;
} TOS_Msg;
/////////////////////////////////////////////////////////////////////
Here is the codes of fRemapRxPos(),
uint8_t fRemapRxPos( uint8_t InPos ) {
if( InPos<4 )
return( InPos+offsetof(struct TOS_Msg, addr) ); //addr,AM,groupid
else if( InPos==4 )
return( offsetof(struct TOS_Msg, length) ); //length
else
return( InPos+offsetof(struct TOS_Msg, addr)-1 ); //payload etc
}
InPos will be the position of standard TOSMessage and fRemapRxPos()
returns the position of CC2420Message.
But it seems to me that fRemapRxPos() doesn't remap correctly.
Hope anyone could help me out with it.
Thanks in advance,
Alex
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help