Hello everyone I am finishing the last section of my firmware for my NFC project. I am attempting to communicate with an AD-740 NFC Tag which uses NXP's MF0ULx1 MIFARE Ultralight EV1 - Contactless ticket IC. The NFC reader that I am using is NXP's CLRC663. I am controlling the NFC reader with a PSOC5LP device over SPI.
Now that you have all of the background information I will now ask my question.
For this particular NXP Read Method I need to encode my Cmd and Addr into a CRC of length 2 bytes. The datasheet, which I can link to, references ISO/IEC 14443. Searching that in Google brings me to the Wikipedia page, which then shows four sections of a PDF. I am assuming that I need section 4 the transmission protocol section. The only problem is this PDF is blocked by a pay wall. Is this intentional??
Scrounging around on the internet I have found a few code examples that may prevent me from purchasing a 170$ PDF just to look at a polynomial...
Code example 1 - I can post source link in comments. Don't have rep to do it in main post.
// Calculate an ISO 14443a CRC. Code translated from the code in
// iso14443a_crc().
func ISO14443aCRC(data []byte) [2]byte {
crc := uint32(0x6363)
for _, bt := range data
{
bt ^= uint8(crc & 0xff)
bt ^= bt << 4
bt32 := uint32(bt)
crc = (crc >> 8) ^ (bt32 << 8) ^ (bt32 << 3) ^ (bt32 >> 4)
}
return [2]byte{byte(crc & 0xff), byte((crc >> 8) & 0xff)}
}
Code example 2 - I can post source link in comments. Don't have rep to do it in main post.
void iso14443a_crc(byte_t* pbtData, size_t szLen, byte_t* pbtCrc)
{
byte_t bt;
uint32_t wCrc = 0x6363;
do {
bt = *pbtData++;
bt = (bt^(byte_t)(wCrc & 0x00FF));
bt = (bt^(bt<<4));
wCrc = (wCrc >> 8)^((uint32_t)bt << 8)^((uint32_t)bt<<3)^((uint32_t)bt>>4);
} while (--szLen);
*pbtCrc++ = (byte_t) (wCrc & 0xFF);
*pbtCrc = (byte_t) ((wCrc >> 8) & 0xFF);
}
And now on to my final question with all of this information... Would it be safe to assume that:
CRC polynomial is: 0x6363
Seed Value is: 0x00FF
A visual representation can be seen here
ISO14443A Polynomial is 0x8408, initial value is 0x6363.