// to the FPGA, to transmit that command to the tag.\r
//-----------------------------------------------------------------------------\r
\r
// to the FPGA, to transmit that command to the tag.\r
//-----------------------------------------------------------------------------\r
\r
// 1) Unmodulated time of 56.64us\r
// 2) 24 pulses of 423.75khz\r
// 3) logic '1' (unmodulated for 18.88us followed by 8 pulses of 423.75khz)\r
// 1) Unmodulated time of 56.64us\r
// 2) 24 pulses of 423.75khz\r
// 3) logic '1' (unmodulated for 18.88us followed by 8 pulses of 423.75khz)\r
// 1) logic '0' (8 pulses of 423.75khz followed by unmodulated for 18.88us)\r
// 2) 24 pulses of 423.75khz\r
// 3) Unmodulated time of 56.64us\r
// 1) logic '0' (8 pulses of 423.75khz followed by unmodulated for 18.88us)\r
// 2) 24 pulses of 423.75khz\r
// 3) Unmodulated time of 56.64us\r
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1\r
};\r
\r
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1\r
};\r
\r
-////////////////////////////////////////// code to do 'itoa'\r
+char *strcat(char *dest, const char *src)\r
+{\r
+ size_t dest_len = strlen(dest);\r
+ size_t i;\r
+ \r
+ for (i = 0 ; src[i] != '\0' ; i++)\r
+ dest[dest_len + i] = src[i];\r
+ dest[dest_len + i] = '\0';\r
//-----------------------------------------------------------------------------\r
// Encode (into the ToSend buffers) an identify request, which is the first\r
// thing that you must send to a tag to get a response.\r
//-----------------------------------------------------------------------------\r
// Encode (into the ToSend buffers) an identify request, which is the first\r
// thing that you must send to a tag to get a response.\r
WORD crc;\r
// one sub-carrier, inventory, 1 slot, fast rate\r
// AFI is at bit 5 (1<<4) when doing an INVENTORY\r
WORD crc;\r
// one sub-carrier, inventory, 1 slot, fast rate\r
// AFI is at bit 5 (1<<4) when doing an INVENTORY\r
// cmd[5] = uid[3];//0x01;\r
// cmd[6] = uid[4];//0x00;\r
// cmd[7] = uid[5];//0x10;\r
// cmd[5] = uid[3];//0x01;\r
// cmd[6] = uid[4];//0x00;\r
// cmd[7] = uid[5];//0x10;\r
// First Block number to read\r
cmd[10] = 0x00;\r
// Number of Blocks to read\r
cmd[11] = 0x2f; // read quite a few\r
//Now the CRC\r
// First Block number to read\r
cmd[10] = 0x00;\r
// Number of Blocks to read\r
cmd[11] = 0x2f; // read quite a few\r
//Now the CRC\r
// Parameter\r
cmd[10] = 0x05; // for custom codes this must be manufcturer code\r
cmd[11] = 0x00;\r
\r
// cmd[12] = 0x00;\r
// cmd[13] = 0x00; //Now the CRC\r
// Parameter\r
cmd[10] = 0x05; // for custom codes this must be manufcturer code\r
cmd[11] = 0x00;\r
\r
// cmd[12] = 0x00;\r
// cmd[13] = 0x00; //Now the CRC\r
WORD crc;\r
// one sub-carrier, inventory, 1 slot, fast rate\r
// AFI is at bit 5 (1<<4) when doing an INVENTORY\r
WORD crc;\r
// one sub-carrier, inventory, 1 slot, fast rate\r
// AFI is at bit 5 (1<<4) when doing an INVENTORY\r
//-----------------------------------------------------------------------------\r
// Transmit the command (to the tag) that was placed in ToSend[].\r
//-----------------------------------------------------------------------------\r
//-----------------------------------------------------------------------------\r
// Transmit the command (to the tag) that was placed in ToSend[].\r
//-----------------------------------------------------------------------------\r
//-----------------------------------------------------------------------------\r
// Transmit the command (to the reader) that was placed in ToSend[].\r
//-----------------------------------------------------------------------------\r
//-----------------------------------------------------------------------------\r
// Transmit the command (to the reader) that was placed in ToSend[].\r
//-----------------------------------------------------------------------------\r
-\r
-\r
-\r
-\r
-\r
-static int GetIso15693AnswerFromTag(BYTE *receivedResponse, int maxLen, int *samples, int *elapsed) \r
+static int GetIso15693AnswerFromTag(BYTE *receivedResponse, int maxLen, int *samples, int *elapsed)\r
// if(GraphTraceLen < 1000) return; // THIS CHECKS FOR A BUFFER TO SMALL\r
\r
// First, correlate for SOF\r
// if(GraphTraceLen < 1000) return; // THIS CHECKS FOR A BUFFER TO SMALL\r
\r
// First, correlate for SOF\r
int k = 0; // this will be our return value\r
\r
// greg - If correlation is less than 1 then there's little point in continuing\r
int k = 0; // this will be our return value\r
\r
// greg - If correlation is less than 1 then there's little point in continuing\r
} // "end if correlation > 0" (max/(arraylen(FrameSOF)/skip))\r
return k; // return the number of bytes demodulated\r
\r
/// DbpString("CRC=%04x", Iso15693Crc(outBuf, k-2));\r
\r
} // "end if correlation > 0" (max/(arraylen(FrameSOF)/skip))\r
return k; // return the number of bytes demodulated\r
\r
/// DbpString("CRC=%04x", Iso15693Crc(outBuf, k-2));\r
\r
-static int GetIso15693AnswerFromSniff(BYTE *receivedResponse, int maxLen, int *samples, int *elapsed) \r
+static int GetIso15693AnswerFromSniff(BYTE *receivedResponse, int maxLen, int *samples, int *elapsed)\r
// if(GraphTraceLen < 1000) return; // THIS CHECKS FOR A BUFFER TO SMALL\r
\r
// First, correlate for SOF\r
// if(GraphTraceLen < 1000) return; // THIS CHECKS FOR A BUFFER TO SMALL\r
\r
// First, correlate for SOF\r
int k = 0; // this will be our return value\r
\r
// greg - If correlation is less than 1 then there's little point in continuing\r
int k = 0; // this will be our return value\r
\r
// greg - If correlation is less than 1 then there's little point in continuing\r
} // "end if correlation > 0" (max/(arraylen(FrameSOF)/skip))\r
return k; // return the number of bytes demodulated\r
\r
/// DbpString("CRC=%04x", Iso15693Crc(outBuf, k-2));\r
} // "end if correlation > 0" (max/(arraylen(FrameSOF)/skip))\r
return k; // return the number of bytes demodulated\r
\r
/// DbpString("CRC=%04x", Iso15693Crc(outBuf, k-2));\r
//-----------------------------------------------------------------------------\r
// Start to read an ISO 15693 tag. We send an identify request, then wait\r
// for the response. The response is not demodulated, just left in the buffer\r
//-----------------------------------------------------------------------------\r
// Start to read an ISO 15693 tag. We send an identify request, then wait\r
// for the response. The response is not demodulated, just left in the buffer\r
//-----------------------------------------------------------------------------\r
// Simulate an ISO15693 reader, perform anti-collision and then attempt to read a sector\r
// all demodulation performed in arm rather than host. - greg\r
//-----------------------------------------------------------------------------\r
// Simulate an ISO15693 reader, perform anti-collision and then attempt to read a sector\r
// all demodulation performed in arm rather than host. - greg\r
//DbpString(parameter);\r
\r
BYTE *receivedAnswer0 = (((BYTE *)BigBuf) + 3560); // allow 100 bytes per reponse (way too much)\r
//DbpString(parameter);\r
\r
BYTE *receivedAnswer0 = (((BYTE *)BigBuf) + 3560); // allow 100 bytes per reponse (way too much)\r
BYTE *receivedAnswer2 = (((BYTE *)BigBuf) + 3760);\r
BYTE *receivedAnswer3 = (((BYTE *)BigBuf) + 3860);\r
BYTE *receivedAnswer2 = (((BYTE *)BigBuf) + 3760);\r
BYTE *receivedAnswer3 = (((BYTE *)BigBuf) + 3860);\r
- //BYTE *TagUID= (((BYTE *)BigBuf) + 3960); // where we hold the uid for hi15reader \r
- int responseLen0 = 0;\r
+ //BYTE *TagUID= (((BYTE *)BigBuf) + 3960); // where we hold the uid for hi15reader\r
+// int responseLen0 = 0;\r
\r
// FIRST WE RUN AN INVENTORY TO GET THE TAG UID\r
// THIS MEANS WE CAN PRE-BUILD REQUESTS TO SAVE CPU TIME\r
\r
// FIRST WE RUN AN INVENTORY TO GET THE TAG UID\r
// THIS MEANS WE CAN PRE-BUILD REQUESTS TO SAVE CPU TIME\r
-// //TransmitTo15693Tag(ToSend,ToSendMax+3,&tsamples, &wait); \r
+// //TransmitTo15693Tag(ToSend,ToSendMax+3,&tsamples, &wait);\r
// TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait); // No longer ToSendMax+3\r
// // Now wait for a response\r
// TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait); // No longer ToSendMax+3\r
// // Now wait for a response\r
-// responseLen0 = GetIso15693AnswerFromTag(receivedAnswer0, 100, &samples, &elapsed) ; \r
+// responseLen0 = GetIso15693AnswerFromTag(receivedAnswer0, 100, &samples, &elapsed) ;\r
// if (responseLen0 >=12) // we should do a better check than this\r
// {\r
// // really we should check it is a valid mesg\r
// if (responseLen0 >=12) // we should do a better check than this\r
// {\r
// // really we should check it is a valid mesg\r
// TagUID[4] = receivedAnswer0[6];\r
// TagUID[5] = receivedAnswer0[7];\r
// TagUID[6] = receivedAnswer0[8]; // IC Manufacturer code\r
// TagUID[4] = receivedAnswer0[6];\r
// TagUID[5] = receivedAnswer0[7];\r
// TagUID[6] = receivedAnswer0[8]; // IC Manufacturer code\r
- //TransmitTo15693Tag(ToSend,ToSendMax+3,&tsamples, &wait); \r
+ //TransmitTo15693Tag(ToSend,ToSendMax+3,&tsamples, &wait);\r
TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait); // No longer ToSendMax+3\r
// Now wait for a response\r
responseLen1 = GetIso15693AnswerFromTag(receivedAnswer1, 100, &samples, &elapsed) ;\r
TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait); // No longer ToSendMax+3\r
// Now wait for a response\r
responseLen1 = GetIso15693AnswerFromTag(receivedAnswer1, 100, &samples, &elapsed) ;\r
TagUID[0] = receivedAnswer1[2];\r
TagUID[1] = receivedAnswer1[3];\r
TagUID[2] = receivedAnswer1[4];\r
TagUID[0] = receivedAnswer1[2];\r
TagUID[1] = receivedAnswer1[3];\r
TagUID[2] = receivedAnswer1[4];\r
TagUID[4] = receivedAnswer1[6];\r
TagUID[5] = receivedAnswer1[7];\r
TagUID[6] = receivedAnswer1[8]; // IC Manufacturer code\r
TagUID[4] = receivedAnswer1[6];\r
TagUID[5] = receivedAnswer1[7];\r
TagUID[6] = receivedAnswer1[8]; // IC Manufacturer code\r
TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait); // No longer ToSendMax+3\r
// Now wait for a response\r
TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait); // No longer ToSendMax+3\r
// Now wait for a response\r
- responseLen2 = GetIso15693AnswerFromTag(receivedAnswer2, 100, &samples, &elapsed); \r
+ responseLen2 = GetIso15693AnswerFromTag(receivedAnswer2, 100, &samples, &elapsed);\r
\r
// Now send the MULTI READ command\r
// BuildArbitraryRequest(*TagUID,parameter);\r
\r
// Now send the MULTI READ command\r
// BuildArbitraryRequest(*TagUID,parameter);\r
// BuildReadBlockRequest(*TagUID,parameter);\r
// BuildSysInfoRequest(*TagUID);\r
// BuildReadBlockRequest(*TagUID,parameter);\r
// BuildSysInfoRequest(*TagUID);\r
- //TransmitTo15693Tag(ToSend,ToSendMax+3,&tsamples, &wait); \r
- TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait); // No longer ToSendMax+3 \r
+ //TransmitTo15693Tag(ToSend,ToSendMax+3,&tsamples, &wait);\r
+ TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait); // No longer ToSendMax+3\r
// Now wait for a response\r
responseLen3 = GetIso15693AnswerFromTag(receivedAnswer3, 100, &samples, &elapsed) ;\r
\r
}\r
\r
// Now wait for a response\r
responseLen3 = GetIso15693AnswerFromTag(receivedAnswer3, 100, &samples, &elapsed) ;\r
\r
}\r
\r
for(i = 0; i < responseLen3; i+=3) {\r
DbpIntegers(receivedAnswer3[i],receivedAnswer3[i+1],receivedAnswer3[i+2]);\r
}\r
for(i = 0; i < responseLen3; i+=3) {\r
DbpIntegers(receivedAnswer3[i],receivedAnswer3[i+1],receivedAnswer3[i+2]);\r
}\r
\r
// str2[0]=0;\r
// for(i = 0; i < responseLen3; i++) {\r
// itoa(str1,receivedAnswer3[i]);\r
// strcat(str2,str1);\r
// }\r
\r
// str2[0]=0;\r
// for(i = 0; i < responseLen3; i++) {\r
// itoa(str1,receivedAnswer3[i]);\r
// strcat(str2,str1);\r
// }\r
//-----------------------------------------------------------------------------\r
// Simulate an ISO15693 TAG, perform anti-collision and then print any reader commands\r
// all demodulation performed in arm rather than host. - greg\r
//-----------------------------------------------------------------------------\r
// Simulate an ISO15693 TAG, perform anti-collision and then print any reader commands\r
// all demodulation performed in arm rather than host. - greg\r
//DbpString(parameter);\r
\r
BYTE *receivedAnswer0 = (((BYTE *)BigBuf) + 3560); // allow 100 bytes per reponse (way too much)\r
//DbpString(parameter);\r
\r
BYTE *receivedAnswer0 = (((BYTE *)BigBuf) + 3560); // allow 100 bytes per reponse (way too much)\r
BYTE *receivedAnswer2 = (((BYTE *)BigBuf) + 3760);\r
BYTE *receivedAnswer3 = (((BYTE *)BigBuf) + 3860);\r
BYTE *receivedAnswer2 = (((BYTE *)BigBuf) + 3760);\r
BYTE *receivedAnswer3 = (((BYTE *)BigBuf) + 3860);\r
- //BYTE *TagUID= (((BYTE *)BigBuf) + 3960); // where we hold the uid for hi15reader \r
- int responseLen0 = 0;\r
+ //BYTE *TagUID= (((BYTE *)BigBuf) + 3960); // where we hold the uid for hi15reader\r
+// int responseLen0 = 0;\r
\r
// FIRST WE RUN AN INVENTORY TO GET THE TAG UID\r
// THIS MEANS WE CAN PRE-BUILD REQUESTS TO SAVE CPU TIME\r
\r
// FIRST WE RUN AN INVENTORY TO GET THE TAG UID\r
// THIS MEANS WE CAN PRE-BUILD REQUESTS TO SAVE CPU TIME\r
-// BuildIdentifyRequest();\r
-// TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait); // No longer ToSendMax+3\r
-\r
+ // BuildIdentifyRequest();\r
+ // TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait); // No longer ToSendMax+3\r
responseLen1 = GetIso15693AnswerFromSniff(receivedAnswer1, 100, &samples, &elapsed) ;\r
responseLen1 = GetIso15693AnswerFromSniff(receivedAnswer1, 100, &samples, &elapsed) ;\r
if (responseLen1 >=1) // we should do a better check than this\r
{\r
// Build a suitable reponse to the reader INVENTORY cocmmand\r
if (responseLen1 >=1) // we should do a better check than this\r
{\r
// Build a suitable reponse to the reader INVENTORY cocmmand\r
TransmitTo15693Reader(ToSend,ToSendMax,&tsamples, &wait);\r
\r
// Now wait for a command from the reader\r
TransmitTo15693Reader(ToSend,ToSendMax,&tsamples, &wait);\r
\r
// Now wait for a command from the reader\r
-// responseLen2 = GetIso15693AnswerFromTag(receivedAnswer2, 100, &samples, &elapsed); \r
+// responseLen2 = GetIso15693AnswerFromTag(receivedAnswer2, 100, &samples, &elapsed);\r
// Now wait for a command from the reader\r
// responseLen3 = GetIso15693AnswerFromTag(receivedAnswer3, 100, &samples, &elapsed) ;\r
\r
}\r
\r
// Now wait for a command from the reader\r
// responseLen3 = GetIso15693AnswerFromTag(receivedAnswer3, 100, &samples, &elapsed) ;\r
\r
}\r
\r
// for(i = 0; i < responseLen3; i+=3) {\r
// DbpIntegers(receivedAnswer3[i],receivedAnswer3[i+1],receivedAnswer3[i+2]);\r
// }\r
// for(i = 0; i < responseLen3; i+=3) {\r
// DbpIntegers(receivedAnswer3[i],receivedAnswer3[i+1],receivedAnswer3[i+2]);\r
// }\r
\r
// str2[0]=0;\r
// for(i = 0; i < responseLen3; i++) {\r
// itoa(str1,receivedAnswer3[i]);\r
// strcat(str2,str1);\r
// }\r
\r
// str2[0]=0;\r
// for(i = 0; i < responseLen3; i++) {\r
// itoa(str1,receivedAnswer3[i]);\r
// strcat(str2,str1);\r
// }\r