mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
chg: minor clean up in iso15693 commands.
This commit is contained in:
parent
4d354f75fe
commit
eec5780b62
2 changed files with 90 additions and 131 deletions
|
@ -197,6 +197,7 @@ void SimTagIso15693(uint32_t parameter, uint8_t *uid); // simulate an ISO15693 t
|
||||||
void BruteforceIso15693Afi(uint32_t speed); // find an AFI of a tag - atrox
|
void BruteforceIso15693Afi(uint32_t speed); // find an AFI of a tag - atrox
|
||||||
void DirectTag15693Command(uint32_t datalen,uint32_t speed, uint32_t recv, uint8_t data[]); // send arbitrary commands from CLI - atrox
|
void DirectTag15693Command(uint32_t datalen,uint32_t speed, uint32_t recv, uint8_t data[]); // send arbitrary commands from CLI - atrox
|
||||||
void SetDebugIso15693(uint32_t flag);
|
void SetDebugIso15693(uint32_t flag);
|
||||||
|
void Iso15693InitReader(void);
|
||||||
|
|
||||||
// iclass.h
|
// iclass.h
|
||||||
void RAMFUNC SniffIClass(void);
|
void RAMFUNC SniffIClass(void);
|
||||||
|
|
|
@ -90,8 +90,7 @@ int DEBUG = 0;
|
||||||
// resulting data rate is 26,48 kbit/s (fc/512)
|
// resulting data rate is 26,48 kbit/s (fc/512)
|
||||||
// cmd ... data
|
// cmd ... data
|
||||||
// n ... length of data
|
// n ... length of data
|
||||||
static void CodeIso15693AsReader(uint8_t *cmd, int n)
|
static void CodeIso15693AsReader(uint8_t *cmd, int n) {
|
||||||
{
|
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
ToSendReset();
|
ToSendReset();
|
||||||
|
@ -170,8 +169,7 @@ static void CodeIso15693AsReader(uint8_t *cmd, int n)
|
||||||
// encode data using "1 out of 256" sheme
|
// encode data using "1 out of 256" sheme
|
||||||
// data rate is 1,66 kbit/s (fc/8192)
|
// data rate is 1,66 kbit/s (fc/8192)
|
||||||
// is designed for more robust communication over longer distances
|
// is designed for more robust communication over longer distances
|
||||||
static void CodeIso15693AsReader256(uint8_t *cmd, int n)
|
static void CodeIso15693AsReader256(uint8_t *cmd, int n) {
|
||||||
{
|
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
ToSendReset();
|
ToSendReset();
|
||||||
|
@ -212,10 +210,8 @@ static void CodeIso15693AsReader256(uint8_t *cmd, int n)
|
||||||
ToSendStuffBit(1);
|
ToSendStuffBit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Transmit the command (to the tag) that was placed in ToSend[].
|
// Transmit the command (to the tag) that was placed in ToSend[].
|
||||||
static void TransmitTo15693Tag(const uint8_t *cmd, int len, int *samples, int *wait)
|
static void TransmitTo15693Tag(const uint8_t *cmd, int len, int *samples, int *wait) {
|
||||||
{
|
|
||||||
int c;
|
int c;
|
||||||
volatile uint32_t r;
|
volatile uint32_t r;
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_TX);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_TX);
|
||||||
|
@ -236,6 +232,8 @@ static void TransmitTo15693Tag(const uint8_t *cmd, int len, int *samples, int *w
|
||||||
|
|
||||||
c = 0;
|
c = 0;
|
||||||
for(;;) {
|
for(;;) {
|
||||||
|
WDT_HIT();
|
||||||
|
|
||||||
if (AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_TXRDY)) {
|
if (AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_TXRDY)) {
|
||||||
AT91C_BASE_SSC->SSC_THR = cmd[c];
|
AT91C_BASE_SSC->SSC_THR = cmd[c];
|
||||||
if( ++c >= len) break;
|
if( ++c >= len) break;
|
||||||
|
@ -243,8 +241,8 @@ static void TransmitTo15693Tag(const uint8_t *cmd, int len, int *samples, int *w
|
||||||
if (AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_RXRDY)) {
|
if (AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_RXRDY)) {
|
||||||
r = AT91C_BASE_SSC->SSC_RHR; (void)r;
|
r = AT91C_BASE_SSC->SSC_RHR; (void)r;
|
||||||
}
|
}
|
||||||
WDT_HIT();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (samples) {
|
if (samples) {
|
||||||
if (wait)
|
if (wait)
|
||||||
*samples = (c + *wait) << 3;
|
*samples = (c + *wait) << 3;
|
||||||
|
@ -256,11 +254,11 @@ static void TransmitTo15693Tag(const uint8_t *cmd, int len, int *samples, int *w
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Transmit the command (to the reader) that was placed in ToSend[].
|
// Transmit the command (to the reader) that was placed in ToSend[].
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
static void TransmitTo15693Reader(const uint8_t *cmd, int len, int *samples, int *wait)
|
static void TransmitTo15693Reader(const uint8_t *cmd, int len, int *samples, int *wait) {
|
||||||
{
|
|
||||||
int c = 0;
|
int c = 0;
|
||||||
volatile uint32_t r;
|
volatile uint32_t r;
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_SIMULATOR|FPGA_HF_SIMULATOR_MODULATE_424K);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_SIMULATOR|FPGA_HF_SIMULATOR_MODULATE_424K);
|
||||||
|
|
||||||
if (wait) {
|
if (wait) {
|
||||||
if (*wait < 10) { *wait = 10; }
|
if (*wait < 10) { *wait = 10; }
|
||||||
for (c = 0; c < *wait;) {
|
for (c = 0; c < *wait;) {
|
||||||
|
@ -275,7 +273,9 @@ static void TransmitTo15693Reader(const uint8_t *cmd, int len, int *samples, int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c = 0;
|
||||||
for(;;) {
|
for(;;) {
|
||||||
|
WDT_HIT();
|
||||||
if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_TXRDY)) {
|
if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_TXRDY)) {
|
||||||
AT91C_BASE_SSC->SSC_THR = cmd[c];
|
AT91C_BASE_SSC->SSC_THR = cmd[c];
|
||||||
if( ++c >= len) break;
|
if( ++c >= len) break;
|
||||||
|
@ -283,7 +283,6 @@ static void TransmitTo15693Reader(const uint8_t *cmd, int len, int *samples, int
|
||||||
if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_RXRDY)) {
|
if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_RXRDY)) {
|
||||||
r = AT91C_BASE_SSC->SSC_RHR; (void)r;
|
r = AT91C_BASE_SSC->SSC_RHR; (void)r;
|
||||||
}
|
}
|
||||||
WDT_HIT();
|
|
||||||
}
|
}
|
||||||
if (samples) {
|
if (samples) {
|
||||||
if (wait)
|
if (wait)
|
||||||
|
@ -293,7 +292,6 @@ static void TransmitTo15693Reader(const uint8_t *cmd, int len, int *samples, int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Read from Tag
|
// Read from Tag
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// receivedResponse
|
// receivedResponse
|
||||||
|
@ -302,16 +300,15 @@ static void TransmitTo15693Reader(const uint8_t *cmd, int len, int *samples, int
|
||||||
// elapsed
|
// elapsed
|
||||||
// returns:
|
// returns:
|
||||||
// number of decoded bytes
|
// number of decoded bytes
|
||||||
static int GetIso15693AnswerFromTag(uint8_t *receivedResponse, int maxLen, int *samples, int *elapsed)
|
static int GetIso15693AnswerFromTag(uint8_t *receivedResponse, int maxLen, int *samples, int *elapsed) {
|
||||||
{
|
|
||||||
uint8_t *dest = BigBuf_get_addr();
|
|
||||||
|
|
||||||
int c = 0, getNext = false;
|
|
||||||
int8_t prev = 0;
|
|
||||||
|
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR);
|
||||||
//SpinDelay(60); // greg - experiment to get rid of some of the 0 byte/failed reads
|
//SpinDelay(60); // greg - experiment to get rid of some of the 0 byte/failed reads
|
||||||
|
|
||||||
|
int c = 0, getNext = false;
|
||||||
|
int8_t prev = 0;
|
||||||
|
uint8_t *dest = BigBuf_get_addr();
|
||||||
|
|
||||||
for(;;) {
|
for(;;) {
|
||||||
WDT_HIT();
|
WDT_HIT();
|
||||||
|
|
||||||
|
@ -431,13 +428,12 @@ static int GetIso15693AnswerFromTag(uint8_t *receivedResponse, int maxLen, int *
|
||||||
|
|
||||||
// Now the GetISO15693 message from sniffing command
|
// Now the GetISO15693 message from sniffing command
|
||||||
static int GetIso15693AnswerFromSniff(uint8_t *receivedResponse, int maxLen, int *samples, int *elapsed) {
|
static int GetIso15693AnswerFromSniff(uint8_t *receivedResponse, int maxLen, int *samples, int *elapsed) {
|
||||||
uint8_t *dest = BigBuf_get_addr();
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR);
|
||||||
|
//SpinDelay(60); // greg - experiment to get rid of some of the 0 byte/failed reads
|
||||||
|
|
||||||
int c = 0, getNext = false;
|
int c = 0, getNext = false;
|
||||||
int8_t prev = 0;
|
int8_t prev = 0;
|
||||||
|
uint8_t *dest = BigBuf_get_addr();
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR);
|
|
||||||
//SpinDelay(60); // greg - experiment to get rid of some of the 0 byte/failed reads
|
|
||||||
|
|
||||||
for(;;) {
|
for(;;) {
|
||||||
WDT_HIT();
|
WDT_HIT();
|
||||||
|
@ -559,48 +555,52 @@ static void BuildIdentifyRequest(void);
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void AcquireRawAdcSamplesIso15693(void)
|
void AcquireRawAdcSamplesIso15693(void)
|
||||||
{
|
{
|
||||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
|
||||||
|
|
||||||
int c = 0, getNext = false;
|
int c = 0, getNext = false;
|
||||||
int8_t prev = 0;
|
int8_t prev = 0;
|
||||||
volatile uint32_t r;
|
volatile uint32_t r;
|
||||||
|
volatile int8_t b;
|
||||||
|
|
||||||
uint8_t *dest = BigBuf_get_addr();
|
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||||
BuildIdentifyRequest();
|
|
||||||
|
|
||||||
SetAdcMuxFor(GPIO_MUXSEL_HIPKD);
|
SetAdcMuxFor(GPIO_MUXSEL_HIPKD);
|
||||||
|
|
||||||
|
FpgaSetupSsc();
|
||||||
|
|
||||||
// Give the tags time to energize
|
// Give the tags time to energize
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR);
|
||||||
SpinDelay(100);
|
SpinDelay(100);
|
||||||
|
|
||||||
// Now send the command
|
// Now send the command
|
||||||
FpgaSetupSsc();
|
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_TX);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_TX);
|
||||||
|
|
||||||
|
uint8_t *dest = BigBuf_get_addr();
|
||||||
|
BuildIdentifyRequest();
|
||||||
|
|
||||||
c = 0;
|
c = 0;
|
||||||
for(;;) {
|
for(;;) {
|
||||||
|
WDT_HIT();
|
||||||
|
|
||||||
if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_TXRDY)) {
|
if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_TXRDY)) {
|
||||||
AT91C_BASE_SSC->SSC_THR = ToSend[c];
|
AT91C_BASE_SSC->SSC_THR = ToSend[c];
|
||||||
if( ++c == ToSendMax+3) break;
|
if( ++c == ToSendMax+3) break;
|
||||||
}
|
}
|
||||||
if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_RXRDY)) {
|
if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_RXRDY)) {
|
||||||
r = AT91C_BASE_SSC->SSC_RHR;
|
r = AT91C_BASE_SSC->SSC_RHR; (void)r;
|
||||||
(void)r;
|
|
||||||
}
|
}
|
||||||
WDT_HIT();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR);
|
||||||
|
|
||||||
c = 0;
|
c = 0;
|
||||||
for(;;) {
|
for(;;) {
|
||||||
|
WDT_HIT();
|
||||||
|
|
||||||
if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_TXRDY))
|
if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_TXRDY))
|
||||||
AT91C_BASE_SSC->SSC_THR = 0x43;
|
AT91C_BASE_SSC->SSC_THR = 0x43;
|
||||||
|
|
||||||
if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_RXRDY)) {
|
if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_RXRDY)) {
|
||||||
|
|
||||||
int8_t b = (int8_t)AT91C_BASE_SSC->SSC_RHR;
|
b = (int8_t)AT91C_BASE_SSC->SSC_RHR;
|
||||||
|
|
||||||
// The samples are correlations against I and Q versions of the
|
// The samples are correlations against I and Q versions of the
|
||||||
// tone that the tag AM-modulates, so every other sample is I,
|
// tone that the tag AM-modulates, so every other sample is I,
|
||||||
|
@ -620,33 +620,24 @@ void AcquireRawAdcSamplesIso15693(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// switch_off, initreader
|
||||||
void RecordRawAdcSamplesIso15693(void)
|
void RecordRawAdcSamplesIso15693(void) {
|
||||||
{
|
|
||||||
uint8_t *dest = BigBuf_get_addr();
|
|
||||||
|
|
||||||
int c = 0, getNext = false;
|
int c = 0, getNext = false;
|
||||||
int8_t prev = 0;
|
int8_t prev = 0;
|
||||||
|
volatile int8_t b;
|
||||||
|
|
||||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
Iso15693InitReader();
|
||||||
// Setup SSC
|
|
||||||
FpgaSetupSsc();
|
|
||||||
|
|
||||||
// Start from off (no field generated)
|
uint8_t *dest = BigBuf_get_addr();
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
|
||||||
SpinDelay(200);
|
|
||||||
|
|
||||||
SetAdcMuxFor(GPIO_MUXSEL_HIPKD);
|
|
||||||
SpinDelay(100);
|
|
||||||
|
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR);
|
|
||||||
|
|
||||||
for(;;) {
|
for(;;) {
|
||||||
|
WDT_HIT();
|
||||||
|
|
||||||
if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_TXRDY)) {
|
if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_TXRDY)) {
|
||||||
AT91C_BASE_SSC->SSC_THR = 0x43;
|
AT91C_BASE_SSC->SSC_THR = 0x43;
|
||||||
}
|
}
|
||||||
if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_RXRDY)) {
|
if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_RXRDY)) {
|
||||||
int8_t b;
|
|
||||||
b = (int8_t)AT91C_BASE_SSC->SSC_RHR;
|
b = (int8_t)AT91C_BASE_SSC->SSC_RHR;
|
||||||
|
|
||||||
// The samples are correlations against I and Q versions of the
|
// The samples are correlations against I and Q versions of the
|
||||||
|
@ -663,40 +654,34 @@ void RecordRawAdcSamplesIso15693(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
getNext = !getNext;
|
getNext = !getNext;
|
||||||
WDT_HIT();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Dbprintf("fin record");
|
|
||||||
|
Dbprintf("done");
|
||||||
|
switch_off();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Initialize the proxmark as iso15k reader
|
// Initialize the proxmark as iso15k reader
|
||||||
// (this might produces glitches that confuse some tags
|
// (this might produces glitches that confuse some tags
|
||||||
void Iso15693InitReader() {
|
void Iso15693InitReader(void) {
|
||||||
LED_A_ON();
|
LEDsoff();
|
||||||
LED_B_ON();
|
|
||||||
LED_C_OFF();
|
|
||||||
LED_D_OFF();
|
|
||||||
|
|
||||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||||
// Setup SSC
|
|
||||||
// FpgaSetupSsc();
|
|
||||||
|
|
||||||
// Start from off (no field generated)
|
// Start from off (no field generated)
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||||
SpinDelay(10);
|
SpinDelay(10);
|
||||||
|
|
||||||
SetAdcMuxFor(GPIO_MUXSEL_HIPKD);
|
SetAdcMuxFor(GPIO_MUXSEL_HIPKD);
|
||||||
|
|
||||||
FpgaSetupSsc();
|
FpgaSetupSsc();
|
||||||
|
|
||||||
// Give the tags time to energize
|
// Give the tags time to energize
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR);
|
||||||
SpinDelay(250);
|
SpinDelay(60);
|
||||||
|
|
||||||
LED_A_ON();
|
LED_A_ON();
|
||||||
LED_B_OFF();
|
|
||||||
LED_C_OFF();
|
|
||||||
LED_D_OFF();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
@ -795,10 +780,9 @@ int SendDataTag(uint8_t *send, int sendlen, int init, int speed, uint8_t **recv)
|
||||||
int wait = 0, elapsed = 0;
|
int wait = 0, elapsed = 0;
|
||||||
int answerLen = 0;
|
int answerLen = 0;
|
||||||
|
|
||||||
|
LEDsoff();
|
||||||
LED_A_ON(); LED_B_ON();
|
LED_A_ON(); LED_B_ON();
|
||||||
|
|
||||||
LED_C_OFF(); LED_D_OFF();
|
|
||||||
|
|
||||||
if (init) Iso15693InitReader();
|
if (init) Iso15693InitReader();
|
||||||
|
|
||||||
// answer is 100bytes long?
|
// answer is 100bytes long?
|
||||||
|
@ -813,14 +797,12 @@ int SendDataTag(uint8_t *send, int sendlen, int init, int speed, uint8_t **recv)
|
||||||
CodeIso15693AsReader(send, sendlen);
|
CodeIso15693AsReader(send, sendlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
LED_A_ON();
|
LED_A_INV();
|
||||||
LED_B_OFF();
|
|
||||||
|
|
||||||
TransmitTo15693Tag(ToSend, ToSendMax, &tsamples, &wait);
|
TransmitTo15693Tag(ToSend, ToSendMax, &tsamples, &wait);
|
||||||
// Now wait for a response
|
// Now wait for a response
|
||||||
if (recv != NULL) {
|
if (recv != NULL) {
|
||||||
LED_A_OFF();
|
LED_B_INV();
|
||||||
LED_B_ON();
|
|
||||||
answerLen = GetIso15693AnswerFromTag(answer, 100, &samples, &elapsed) ;
|
answerLen = GetIso15693AnswerFromTag(answer, 100, &samples, &elapsed) ;
|
||||||
*recv = answer;
|
*recv = answer;
|
||||||
}
|
}
|
||||||
|
@ -906,13 +888,7 @@ void SetDebugIso15693(uint32_t debug) {
|
||||||
// Simulate an ISO15693 reader, perform anti-collision and then attempt to read a sector
|
// Simulate an ISO15693 reader, perform anti-collision and then attempt to read a sector
|
||||||
// all demodulation performed in arm rather than host. - greg
|
// all demodulation performed in arm rather than host. - greg
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void ReaderIso15693(uint32_t parameter)
|
void ReaderIso15693(uint32_t parameter) {
|
||||||
{
|
|
||||||
LED_A_ON();
|
|
||||||
LED_B_ON();
|
|
||||||
LED_C_OFF();
|
|
||||||
LED_D_OFF();
|
|
||||||
|
|
||||||
int answerLen1 = 0;
|
int answerLen1 = 0;
|
||||||
int answerLen2 = 0;
|
int answerLen2 = 0;
|
||||||
int answerLen3 = 0;
|
int answerLen3 = 0;
|
||||||
|
@ -921,9 +897,8 @@ void ReaderIso15693(uint32_t parameter)
|
||||||
int tsamples = 0;
|
int tsamples = 0;
|
||||||
int wait = 0;
|
int wait = 0;
|
||||||
int elapsed = 0;
|
int elapsed = 0;
|
||||||
uint8_t TagUID[8] = {0x00};
|
|
||||||
|
|
||||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
uint8_t TagUID[8] = {0x00};
|
||||||
|
|
||||||
uint8_t *answer1 = BigBuf_malloc(100);
|
uint8_t *answer1 = BigBuf_malloc(100);
|
||||||
uint8_t *answer2 = BigBuf_malloc(100);
|
uint8_t *answer2 = BigBuf_malloc(100);
|
||||||
|
@ -933,36 +908,21 @@ void ReaderIso15693(uint32_t parameter)
|
||||||
memset(answer2, 0x00, 100);
|
memset(answer2, 0x00, 100);
|
||||||
memset(answer3, 0x00, 100);
|
memset(answer3, 0x00, 100);
|
||||||
|
|
||||||
SetAdcMuxFor(GPIO_MUXSEL_HIPKD);
|
// Now send the IDENTIFY command
|
||||||
// Setup SSC
|
|
||||||
FpgaSetupSsc();
|
|
||||||
|
|
||||||
// Start from off (no field generated)
|
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
|
||||||
SpinDelay(200);
|
|
||||||
|
|
||||||
// Give the tags time to energize
|
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR);
|
|
||||||
SpinDelay(200);
|
|
||||||
|
|
||||||
LED_A_ON();
|
|
||||||
LED_B_OFF();
|
|
||||||
LED_C_OFF();
|
|
||||||
LED_D_OFF();
|
|
||||||
|
|
||||||
// FIRST WE RUN AN INVENTORY TO GET THE TAG UID
|
// FIRST WE RUN AN INVENTORY TO GET THE TAG UID
|
||||||
// THIS MEANS WE CAN PRE-BUILD REQUESTS TO SAVE CPU TIME
|
// THIS MEANS WE CAN PRE-BUILD REQUESTS TO SAVE CPU TIME
|
||||||
|
|
||||||
// Now send the IDENTIFY command
|
|
||||||
BuildIdentifyRequest();
|
BuildIdentifyRequest();
|
||||||
|
|
||||||
|
// set up device/fpga
|
||||||
|
Iso15693InitReader();
|
||||||
|
|
||||||
TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait);
|
TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait);
|
||||||
|
|
||||||
// Now wait for a response
|
// Now wait for a response
|
||||||
answerLen1 = GetIso15693AnswerFromTag(answer1, 100, &samples, &elapsed) ;
|
answerLen1 = GetIso15693AnswerFromTag(answer1, 100, &samples, &elapsed) ;
|
||||||
|
|
||||||
if (answerLen1 >= 12) // we should do a better check than this
|
// we should do a better check than this
|
||||||
{
|
if (answerLen1 >= 12) {
|
||||||
TagUID[0] = answer1[2];
|
TagUID[0] = answer1[2];
|
||||||
TagUID[1] = answer1[3];
|
TagUID[1] = answer1[3];
|
||||||
TagUID[2] = answer1[4];
|
TagUID[2] = answer1[4];
|
||||||
|
@ -971,7 +931,6 @@ void ReaderIso15693(uint32_t parameter)
|
||||||
TagUID[5] = answer1[7];
|
TagUID[5] = answer1[7];
|
||||||
TagUID[6] = answer1[8]; // IC Manufacturer code
|
TagUID[6] = answer1[8]; // IC Manufacturer code
|
||||||
TagUID[7] = answer1[9]; // always E0
|
TagUID[7] = answer1[9]; // always E0
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Dbprintf("%d octets read from IDENTIFY request:", answerLen1);
|
Dbprintf("%d octets read from IDENTIFY request:", answerLen1);
|
||||||
|
@ -1010,13 +969,22 @@ void ReaderIso15693(uint32_t parameter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LEDsoff();
|
switch_off();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Simulate an ISO15693 TAG, perform anti-collision and then print any reader commands
|
// Simulate an ISO15693 TAG, perform anti-collision and then print any reader commands
|
||||||
// all demodulation performed in arm rather than host. - greg
|
// all demodulation performed in arm rather than host. - greg
|
||||||
void SimTagIso15693(uint32_t parameter, uint8_t *uid)
|
void SimTagIso15693(uint32_t parameter, uint8_t *uid) {
|
||||||
{
|
|
||||||
|
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||||
|
|
||||||
|
SetAdcMuxFor(GPIO_MUXSEL_HIPKD);
|
||||||
|
FpgaSetupSsc();
|
||||||
|
|
||||||
|
// Start from off (no field generated)
|
||||||
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||||
|
SpinDelay(200);
|
||||||
|
|
||||||
LED_A_ON();
|
LED_A_ON();
|
||||||
|
|
||||||
int ans = 0;
|
int ans = 0;
|
||||||
|
@ -1027,18 +995,9 @@ void SimTagIso15693(uint32_t parameter, uint8_t *uid)
|
||||||
|
|
||||||
Dbprintf("iso15963 Simulating uid: %x %x %x %x %x %x %x %x", uid[0], uid[1], uid[2], uid[3], uid[4], uid[5], uid[6], uid[7]);
|
Dbprintf("iso15963 Simulating uid: %x %x %x %x %x %x %x %x", uid[0], uid[1], uid[2], uid[3], uid[4], uid[5], uid[6], uid[7]);
|
||||||
|
|
||||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
|
||||||
|
|
||||||
uint8_t *buf = BigBuf_malloc(100);
|
uint8_t *buf = BigBuf_malloc(100);
|
||||||
memset(buf, 0x00, 100);
|
memset(buf, 0x00, 100);
|
||||||
|
|
||||||
SetAdcMuxFor(GPIO_MUXSEL_HIPKD);
|
|
||||||
FpgaSetupSsc();
|
|
||||||
|
|
||||||
// Start from off (no field generated)
|
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
|
||||||
SpinDelay(200);
|
|
||||||
|
|
||||||
LED_C_ON();
|
LED_C_ON();
|
||||||
|
|
||||||
// Build a suitable reponse to the reader INVENTORY cocmmand
|
// Build a suitable reponse to the reader INVENTORY cocmmand
|
||||||
|
@ -1060,8 +1019,7 @@ void SimTagIso15693(uint32_t parameter, uint8_t *uid)
|
||||||
buf[4], buf[5], buf[6], buf[7], buf[8]);
|
buf[4], buf[5], buf[6], buf[7], buf[8]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LEDsoff();
|
switch_off();
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue