mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-07-16 02:03:00 -07:00
fixing iso14443b (issue #103): fix timing issue (speeding up
the decoders)
This commit is contained in:
parent
5b95953d42
commit
09c66f1f09
2 changed files with 14 additions and 12 deletions
|
@ -210,7 +210,6 @@ static int Handle14443UartBit(int bit)
|
||||||
Uart.bitCnt = 0;
|
Uart.bitCnt = 0;
|
||||||
Uart.shiftReg = 0;
|
Uart.shiftReg = 0;
|
||||||
Uart.state = STATE_RECEIVING_DATA;
|
Uart.state = STATE_RECEIVING_DATA;
|
||||||
LED_A_ON(); // Indicate we're receiving
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -263,6 +262,7 @@ static int Handle14443UartBit(int bit)
|
||||||
Uart.posCnt++;
|
Uart.posCnt++;
|
||||||
if(Uart.posCnt > 10) {
|
if(Uart.posCnt > 10) {
|
||||||
Uart.state = STATE_UNSYNCD;
|
Uart.state = STATE_UNSYNCD;
|
||||||
|
LED_A_OFF();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -271,8 +271,6 @@ static int Handle14443UartBit(int bit)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Uart.state == STATE_UNSYNCD) LED_A_OFF();
|
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -548,6 +546,7 @@ static RAMFUNC int Handle14443SamplesDemod(int ci, int cq)
|
||||||
} else {
|
} else {
|
||||||
if(Demod.posCount > 100) {
|
if(Demod.posCount > 100) {
|
||||||
Demod.state = DEMOD_UNSYNCD;
|
Demod.state = DEMOD_UNSYNCD;
|
||||||
|
LED_C_OFF();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Demod.posCount++;
|
Demod.posCount++;
|
||||||
|
@ -558,6 +557,7 @@ static RAMFUNC int Handle14443SamplesDemod(int ci, int cq)
|
||||||
if(v > 0) {
|
if(v > 0) {
|
||||||
if(Demod.posCount > 10) {
|
if(Demod.posCount > 10) {
|
||||||
Demod.state = DEMOD_UNSYNCD;
|
Demod.state = DEMOD_UNSYNCD;
|
||||||
|
LED_C_OFF();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Demod.bitCount = 0;
|
Demod.bitCount = 0;
|
||||||
|
@ -596,13 +596,13 @@ static RAMFUNC int Handle14443SamplesDemod(int ci, int cq)
|
||||||
Demod.output[Demod.len] = b;
|
Demod.output[Demod.len] = b;
|
||||||
Demod.len++;
|
Demod.len++;
|
||||||
Demod.state = DEMOD_AWAITING_START_BIT;
|
Demod.state = DEMOD_AWAITING_START_BIT;
|
||||||
} else if(s == 0x000) {
|
|
||||||
// This is EOF
|
|
||||||
LED_C_OFF();
|
|
||||||
Demod.state = DEMOD_UNSYNCD;
|
|
||||||
return TRUE;
|
|
||||||
} else {
|
} else {
|
||||||
Demod.state = DEMOD_UNSYNCD;
|
Demod.state = DEMOD_UNSYNCD;
|
||||||
|
LED_C_OFF();
|
||||||
|
if(s == 0x000) {
|
||||||
|
// This is EOF
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Demod.posCount = 0;
|
Demod.posCount = 0;
|
||||||
|
@ -611,10 +611,10 @@ static RAMFUNC int Handle14443SamplesDemod(int ci, int cq)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Demod.state = DEMOD_UNSYNCD;
|
Demod.state = DEMOD_UNSYNCD;
|
||||||
|
LED_C_OFF();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Demod.state == DEMOD_UNSYNCD) LED_C_OFF(); // Not synchronized...
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1168,14 +1168,14 @@ void RAMFUNC SnoopIso14443(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!ReaderIsActive) { // no need to try decoding tag data if the reader is sending - and we cannot afford the time
|
if(!ReaderIsActive) { // no need to try decoding tag data if the reader is sending - and we cannot afford the time
|
||||||
if(Handle14443SamplesDemod(ci, cq)) {
|
if(Handle14443SamplesDemod(ci & 0xFE, cq & 0xFE)) {
|
||||||
|
|
||||||
//Use samples as a time measurement
|
//Use samples as a time measurement
|
||||||
if(tracing)
|
if(tracing)
|
||||||
{
|
{
|
||||||
uint8_t parity[MAX_PARITY_SIZE];
|
uint8_t parity[MAX_PARITY_SIZE];
|
||||||
GetParity(Demod.output, Demod.len, parity);
|
GetParity(Demod.output, Demod.len, parity);
|
||||||
LogTrace(Demod.output, Demod.len,samples, samples, parity, FALSE);
|
LogTrace(Demod.output, Demod.len, samples, samples, parity, FALSE);
|
||||||
}
|
}
|
||||||
triggered = TRUE;
|
triggered = TRUE;
|
||||||
LED_A_OFF();
|
LED_A_OFF();
|
||||||
|
|
|
@ -171,7 +171,9 @@ begin
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if(corr_i_cnt[5:2] == 4'b000 || corr_i_cnt[5:2] == 4'b1000)
|
// set ssp_frame signal for corr_i_cnt = 0..3 and corr_i_cnt = 32..35
|
||||||
|
// (two frames with 8 Bits each)
|
||||||
|
if(corr_i_cnt[5:2] == 4'b0000 || corr_i_cnt[5:2] == 4'b1000)
|
||||||
ssp_frame = 1'b1;
|
ssp_frame = 1'b1;
|
||||||
else
|
else
|
||||||
ssp_frame = 1'b0;
|
ssp_frame = 1'b0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue