# Re: CRC of Preferred Roaming List problem

*From*: "TheDoc" <thedoc@xxxxxxx>*Date*: Fri, 21 Oct 2005 17:35:29 GMT

"Autumn-Fox" <jie.yao@xxxxxxxxx> wrote in message

news:1129908592.135504.122270@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

> I have a problem with the crc calculation for the preferred roaming

> list.

> Here is a roaming list from a motorola phone

>

> Roaming List NAM 0:

> 00 31 30 39 00 02 40 03 10 51 c8 49 8c 6b b9 6a

> b0 74 d8 e1 b8 6e 14 a3 70 89 94 a3 02 5d 63 47

> 84 57 41 15 e0 0c 08 22 bc 81 02 2b 9c 0a 06 98

> dd

>

> The last two bytes are the 16 bit CRC-ccitt result for the message

> ahead.

> According to the protocol TIA-EIA-IS683A , the crc calcuation is

> described as follows:

>

> Page 3-43 of IS683A

> (http://www.3gpp2.org/Public_html/specs/C.S0016-0with3Gcover.pdf )

> the 16 bit preferred roaming list crc field PR_LIST_CRC is calculated

> on all bits of the PRL excluding the bits of the PR_LIST_CRC field

> itself. The generator polynomial for this CRC is g(x) = x^16+x^12+x^5 +

> 1

> ................

> using the logic shown in figure 2.2.1-2

> ..............

> initially, all shift register elements are set to logical one and the

> switches are set in the position A.

> the register is clocked with each preferred roaming list bit as an

> input,from the most significant bit of the PR_LIST_SIZE field through

> the least significant bit of the reserved field.

> the switches are set in the position B and the register is clocked an

> additional 16 times. the 16 additional output bits constitute the CRC.

>

> >From the above, I think the algorithm should be CRC-CCITT with initial

> value 0xffff, am I correct ?

>

> After I programmed like the protocol , I found the crc result is 0x6722

> instead of 0x89dd. Also I tested on the website

>

http://www.lammertbies.nl/comm/info/crc-calculation.html?crc=00+31+30+39+00+02+40+03+10+51+c8+49+8c+6b+b9+6a+++b0+74+d8+e1+b8+6e+14+a3+70+89+94+a3+02+5d+63+47+84+57+41+15+e0+0c+08+22+bc+81+02+2b+9c+0a+06&method=hex

>

> which gave me the same result ( which means I am correct ? )

>

> Now I am wondering whether it is possible they use a different

> algorithm to calculate the CRC of the preferred roaming list ?

> And I am wondering whether it matters if I use the protocol algorithm

> not their algorithm.

>

per previous post.. it looks like you did have a typo.. the last two data

bytes

are indeed 0x98dd...

enjoy..

.

**Follow-Ups**:**Re: CRC of Preferred Roaming List problem***From:*Autumn-Fox

**References**:**CRC of Preferred Roaming List problem***From:*Autumn-Fox

- Prev by Date:
**Re: CRC of Preferred Roaming List problem** - Next by Date:
**Re: Microchip Introduces First 16-bit Microcontroller Product Line - the PIC24** - Previous by thread:
**Re: CRC of Preferred Roaming List problem** - Next by thread:
**Re: CRC of Preferred Roaming List problem** - Index(es):