Crc Algorithm; Serial Packet Types - Globalstar SmartOne Solar User Manual

Table of Contents

Advertisement

9100-0425-01

CRC Algorithm

The Security Field is a 16-bit CRC of all of the previous fields including the preamble, length, and
command bytes. The remainder is initialized to all 1's (0xFFFF) and the CRC is inverted before being
sent. Following is a sample C routine that implements the algorithm using the reversed technique:
WORD crc16_lsb(BYTE *pData, WORD length)
{
BYTE i;
WORD data, crc;
crc = 0xFFFF;
if (length == 0)
return 0;
do
{
data = (WORD)0x00FF & *pData++;
crc = crc ^ data;
for (i = 8; i > 0; i--)
{
}
} while (--length);
crc = ~crc;
return (crc);
}
As an example, for a type (0x01) "Get ID" message made up of the following bytes: AA 05 01
The following 2 byte CRC would be calculated: D5 50
The complete message sent by the host to the SmartOne is: AA 05 01 50 D5

Serial Packet Types

Description/Usage/
Cmd
Comment
User requests the SmartOne to
reply with integral ESN (Electronic
0x01
Serial Number). This is the ID
used by Globalstar to identify the
unit
0x26
Send Truncated Message
0x27
Send Raw Message
SmartOne Solar™ User Guide v1.0.3
if (crc & 0x0001)
crc = (crc >> 1) ^ 0x8408;
else
crc >>= 1;
Confidential & Proprietary Information
Command Data
Bytes
None
See Truncated Message
section below
See Raw Message
section below
Acknowledge Data
Bytes
Four data bytes, which
contain the unit ID as an
unsigned integer. The
MSByte is sent first. Only
the 27 LSbits are non-zero
None
None
21

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents