mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
CHG; still looking at 14b, this time started to look at the tracelog times not working.
This commit is contained in:
parent
59e933fc3f
commit
86db8973b0
2 changed files with 50 additions and 41 deletions
|
@ -40,7 +40,7 @@
|
|||
//#define SEND4STUFFBIT(x) ToSendStuffBit(x);
|
||||
// iceman, this threshold value, what makes 8 a good amplituted for this IQ values?
|
||||
#ifndef SUBCARRIER_DETECT_THRESHOLD
|
||||
# define SUBCARRIER_DETECT_THRESHOLD 6
|
||||
# define SUBCARRIER_DETECT_THRESHOLD 8
|
||||
#endif
|
||||
|
||||
static void iso14b_set_timeout(uint32_t timeout);
|
||||
|
@ -280,13 +280,14 @@ static void CodeIso14443bAsTag(const uint8_t *cmd, int len) {
|
|||
// Data bits
|
||||
b = cmd[i];
|
||||
for(j = 0; j < 8; ++j) {
|
||||
if(b & 1) {
|
||||
SEND4STUFFBIT(1);
|
||||
//ToSendStuffBit(1);
|
||||
} else {
|
||||
SEND4STUFFBIT(0);
|
||||
//ToSendStuffBit(0);
|
||||
}
|
||||
// if(b & 1) {
|
||||
// SEND4STUFFBIT(1);
|
||||
// //ToSendStuffBit(1);
|
||||
// } else {
|
||||
// SEND4STUFFBIT(0);
|
||||
// //ToSendStuffBit(0);
|
||||
// }
|
||||
SEND4STUFFBIT( b & 1 );
|
||||
b >>= 1;
|
||||
}
|
||||
|
||||
|
@ -802,7 +803,6 @@ static RAMFUNC int Handle14443bTagSamplesDemod(int ci, int cq) {
|
|||
case DEMOD_UNSYNCD:
|
||||
|
||||
CHECK_FOR_SUBCARRIER();
|
||||
if (MF_DBGLEVEL >= 3) { Dbprintf("Demod.state = %d", v); }
|
||||
|
||||
// subcarrier detected
|
||||
if (v > SUBCARRIER_DETECT_THRESHOLD) {
|
||||
|
@ -858,7 +858,7 @@ static RAMFUNC int Handle14443bTagSamplesDemod(int ci, int cq) {
|
|||
Demod.state = DEMOD_UNSYNCD;
|
||||
} else {
|
||||
LED_C_ON(); // Got SOF
|
||||
Demod.startTime = GetCountSspClk();
|
||||
//Demod.startTime = GetCountSspClk();
|
||||
Demod.state = DEMOD_AWAITING_START_BIT;
|
||||
Demod.posCount = 0;
|
||||
Demod.len = 0;
|
||||
|
@ -904,7 +904,7 @@ static RAMFUNC int Handle14443bTagSamplesDemod(int ci, int cq) {
|
|||
Demod.thisBit += v;
|
||||
Demod.shiftReg >>= 1;
|
||||
|
||||
// logic '1'
|
||||
// OR in a logic '1'
|
||||
if (Demod.thisBit > 0) Demod.shiftReg |= 0x200;
|
||||
|
||||
++Demod.bitCount;
|
||||
|
@ -923,7 +923,7 @@ static RAMFUNC int Handle14443bTagSamplesDemod(int ci, int cq) {
|
|||
} else {
|
||||
// this one is a bit hard, either its a correc byte or its unsynced.
|
||||
Demod.state = DEMOD_UNSYNCD;
|
||||
Demod.endTime = GetCountSspClk();
|
||||
//Demod.endTime = GetCountSspClk();
|
||||
LED_C_OFF();
|
||||
|
||||
// This is EOF (start, stop and all data bits == '0'
|
||||
|
@ -1018,7 +1018,7 @@ static void GetTagSamplesFor14443bDemod() {
|
|||
Dbhexdump(ISO14443B_DMA_BUFFER_SIZE, (uint8_t *)dmaBuf, FALSE);
|
||||
|
||||
if ( Demod.len > 0 )
|
||||
LogTrace(Demod.output, Demod.len, Demod.startTime, Demod.endTime, NULL, FALSE);
|
||||
LogTrace(Demod.output, Demod.len, time_0, time_stop, NULL, FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1075,8 +1075,7 @@ static void TransmitFor14443b_AsReader(void) {
|
|||
// Code a layer 2 command (string of octets, including CRC) into ToSend[],
|
||||
// so that it is ready to transmit to the tag using TransmitFor14443b().
|
||||
//-----------------------------------------------------------------------------
|
||||
static void CodeIso14443bAsReader(const uint8_t *cmd, int len)
|
||||
{
|
||||
static void CodeIso14443bAsReader(const uint8_t *cmd, int len) {
|
||||
/*
|
||||
* Reader data transmission:
|
||||
* - no modulation ONES
|
||||
|
@ -1112,14 +1111,24 @@ static void CodeIso14443bAsReader(const uint8_t *cmd, int len)
|
|||
ToSendStuffBit(0);
|
||||
// Data bits
|
||||
b = cmd[i];
|
||||
if ( b & 1 ) ToSendStuffBit(1); else ToSendStuffBit(0);
|
||||
if ( (b>>1) & 1) ToSendStuffBit(1); else ToSendStuffBit(0);
|
||||
if ( (b>>2) & 1) ToSendStuffBit(1); else ToSendStuffBit(0);
|
||||
if ( (b>>3) & 1) ToSendStuffBit(1); else ToSendStuffBit(0);
|
||||
if ( (b>>4) & 1) ToSendStuffBit(1); else ToSendStuffBit(0);
|
||||
if ( (b>>5) & 1) ToSendStuffBit(1); else ToSendStuffBit(0);
|
||||
if ( (b>>6) & 1) ToSendStuffBit(1); else ToSendStuffBit(0);
|
||||
if ( (b>>7) & 1) ToSendStuffBit(1); else ToSendStuffBit(0);
|
||||
// if ( b & 1 ) ToSendStuffBit(1); else ToSendStuffBit(0);
|
||||
// if ( (b>>1) & 1) ToSendStuffBit(1); else ToSendStuffBit(0);
|
||||
// if ( (b>>2) & 1) ToSendStuffBit(1); else ToSendStuffBit(0);
|
||||
// if ( (b>>3) & 1) ToSendStuffBit(1); else ToSendStuffBit(0);
|
||||
// if ( (b>>4) & 1) ToSendStuffBit(1); else ToSendStuffBit(0);
|
||||
// if ( (b>>5) & 1) ToSendStuffBit(1); else ToSendStuffBit(0);
|
||||
// if ( (b>>6) & 1) ToSendStuffBit(1); else ToSendStuffBit(0);
|
||||
// if ( (b>>7) & 1) ToSendStuffBit(1); else ToSendStuffBit(0);
|
||||
|
||||
ToSendStuffBit( b & 1);
|
||||
ToSendStuffBit( (b>>1) & 1);
|
||||
ToSendStuffBit( (b>>2) & 1);
|
||||
ToSendStuffBit( (b>>3) & 1);
|
||||
ToSendStuffBit( (b>>4) & 1);
|
||||
ToSendStuffBit( (b>>5) & 1);
|
||||
ToSendStuffBit( (b>>6) & 1);
|
||||
ToSendStuffBit( (b>>7) & 1);
|
||||
|
||||
// Stop bit
|
||||
ToSendStuffBit(1);
|
||||
// EGT extra guard time
|
||||
|
@ -1145,15 +1154,15 @@ static void CodeIso14443bAsReader(const uint8_t *cmd, int len)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Convenience function to encode, transmit and trace iso 14443b comms
|
||||
**/
|
||||
/*
|
||||
* Convenience function to encode, transmit and trace iso 14443b comms
|
||||
*/
|
||||
static void CodeAndTransmit14443bAsReader(const uint8_t *cmd, int len) {
|
||||
|
||||
CodeIso14443bAsReader(cmd, len);
|
||||
|
||||
uint32_t time_start = GetCountSspClk();
|
||||
|
||||
CodeIso14443bAsReader(cmd, len);
|
||||
|
||||
TransmitFor14443b_AsReader();
|
||||
|
||||
if(trigger) LED_A_ON();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue