New Life Games LLC
Homebrew Player Tracking and EFT Systems => NLG Homebrew Player Tracking and EFT Systems => Topic started by: bassplyr647 on October 08, 2014, 07:43:21 AM
-
Forgive me if this has already been answered. I am using the SASTest program from IGT and trying to verify the CRC. I'm using the example code from the spec
unsigned short CRC (unsigned char *s, int len, unsigned short crcval)
{
unsigned c,q;
c = 0;
q = 0;
for(; len; len--)
{
c = *s++;
q = (crcval ^ c) & 017;
crcval = (crcval >> 4) ^ (q * 010201);
q = (crcval ^ (c >> 4)) & 017;
crcval = (crcval >> 4) ^ (q * 010201);
}
return (crcval);
}
I am using this code on a 32-bit ARM processor. Is the magic number different? Does it matter? Any advice/direction would be helpful. FYI..I can read the full command, including the address-wakeup bit (this was verified using a logic analyzer).
Thanks in advance.
-
Hi
My Arduino routine looks like this
void CalculateCRC(byte val[], int len)
{
CRCH=0x00;
CRCL=0x00;
long crc;
long q;
byte c;
crc = 0;
for (int i = 0; i < len; i++)
{
c = val[i];
q = (crc ^ c) & 0x0f;
crc = (crc >> 4) ^ (q * 0x1081);
q = (crc ^ (c >> 4)) & 0xf;
crc = (crc >> 4) ^ (q * 0x1081);
}
CRCH =crc & 0xff;
CRCL =crc >> 8;
}
Original Routine courtesy of Zarobhr on the old site - http://newlifegames.net/nlg/index.php?topic=13799.0 (http://newlifegames.net/nlg/index.php?topic=13799.0)
Which Arm Micro / Dev environment are You working with ? As soon as I get a gap I want to try and migrate my project to the sparkCore.
Tx
Ian
-
Thanks for the quick reply. I found the problem...the seed value I was using was incorrect. I'm using an NXP11xx (I'm testing with a NXP1115). I'm going to be making my own boards. The "Host" system will be a Linux computer.