Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CCITT CRC-16 difficulty using Simulink

486 views
Skip to first unread message

Phil

unread,
Jul 29, 2003, 2:14:05 PM7/29/03
to
Hi,


I'm still rather new with simulink and I am having some problems
generating a CRC parity.


What I am trying to do is reproduce the example illustrated on page
198 of the IEEE 802.11 spec from 1999.


The polynomial is: G(x)=X^16+X^12+X^5+1.


I am using the General CRC Generator block in Simulink 5.0.2. I set
the generator polynomial to [16 11 4 0] and the initial state to 1
and I'm generating 1 checksum per frame.


If someone could help me out, I would appreciate it.


Regards,
Phil

Phil

unread,
Jul 29, 2003, 2:18:11 PM7/29/03
to
> The polynomial is: G(x)=X^16+X^12+X^5+1.
>
> I am using the General CRC Generator block in Simulink 5.0.2. I
> set
> the generator polynomial to [16 11 4 0] and the initial state to 1
> and I'm generating 1 checksum per frame.


CORRECTION: I'm using [16 12 5 0] not [16 11 4 0].

Thomas Vogel

unread,
Jul 29, 2003, 4:29:39 PM7/29/03
to
Phil wrote:

And what is the problem?
If you have the 802.11b model from fileexchange you just have to add
this block between the combined PLCP and the PSDU and you have a CRC
checksum for the header and the preamble.

Phil

unread,
Jul 29, 2003, 4:56:08 PM7/29/03
to
The problem is that I can not get the proper checksum out of the
block.


I enter the vector
[0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0]


the checksum should be 1010010010101000.


What I get out is not that.


Phil

Thomas Vogel

unread,
Jul 30, 2003, 6:06:38 AM7/30/03
to
try to set the initial state to "ones(16, 1)" as written in the standard

Thomas Vogel

unread,
Jul 30, 2003, 6:30:02 AM7/30/03
to
Thomas Vogel wrote:

sorry, thats not the solution, scalars is expanded automatically.


Amit Kansal

unread,
Jul 30, 2003, 1:44:34 PM7/30/03
to
Phil,

The CRC generator block outputs the checksum as calculated without any
post-processing.

As specified by the IEEE 802.11 standard (section 15.2.3.6), one would need
to take the ones complement of the current block output
which would then be the FCS parity bits (in hex they would be 5B57).

I have a simulink model that illustrates this. Let me know if you need it. I
could mail it directly to you.

hope this helps,
Amit

"Phil" <phil...@bigfoot.com> wrote in message
news:eec1...@WebX.raydaftYaTP...

Phil

unread,
Jul 30, 2003, 1:57:41 PM7/30/03
to
Amit,


If you could send me the model that you mention below, I would really
appreciate it. I would like to see what I am doing wrong when using
the General CRC Generator.


I realise that the FCS is the ones complement of the parity bits, but
I am not even getting the correct parity bits out. I was able to
create my own CRC from scratch, but I would prefer to use the block
provided in the comm library.


Just send the model to phil...@bigfoot.com. I'll be interested to
see what I've screwed up.


Regards,
Phil

Thomas Vogel

unread,
Jul 31, 2003, 4:35:58 AM7/31/03
to
Ok, the problem is, that Simulink uses the 0xFFFF as non-direct init
value, whereas the 802.11 Spec uses it as direct init value.

You can test it at
http://rcswww.urz.tu-dresden.de/~sr21/crc.html
whre you have to type the input vector as %50%00%03%00
Then you can switch between direct and non-direct init value.

It seems that there are discussions about it, see
http://www.joegeluso.com/software/articles/ccitt.htm#results

Hope it helps

Th. Vogel

Phil

unread,
Jul 31, 2003, 12:52:52 PM7/31/03
to
Thanks Thomas. The value that I got from the calculator at the first
link you posted is the same as the one that I got in the model from
Amit.


It turns out that the 0xFFFF specified in the standard must be
changed to 0x84CF to work with the General CRC Generator in Simulink.


Regards,
Phil

0 new messages