mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-21 13:53:26 -07:00
lf t55xx and some lf demod fixes/adjustments
finally think I like the lf t55xx detect and read cmds. pretty reliable now.
This commit is contained in:
parent
f665067919
commit
db8296025f
6 changed files with 230 additions and 210 deletions
|
@ -1078,21 +1078,7 @@ void CmdIOdemodFSK(int findone, int *high, int *low, int ledcontrol)
|
|||
#define WRITE_GAP 20*8 // was 160 // SPEC: 1*8 to 20*8 - typ 10*8 (or 10fc)
|
||||
#define WRITE_0 18*8 // was 144 // SPEC: 16*8 to 32*8 - typ 24*8 (or 24fc)
|
||||
#define WRITE_1 50*8 // was 400 // SPEC: 48*8 to 64*8 - typ 56*8 (or 56fc) 432 for T55x7; 448 for E5550
|
||||
#define READ_GAP 52*8
|
||||
|
||||
// VALUES TAKEN FROM EM4x function: SendForward
|
||||
// START_GAP = 440; (55*8) cycles at 125Khz (8us = 1cycle)
|
||||
// WRITE_GAP = 128; (16*8)
|
||||
// WRITE_1 = 256 32*8; (32*8)
|
||||
|
||||
// These timings work for 4469/4269/4305 (with the 55*8 above)
|
||||
// WRITE_0 = 23*8 , 9*8 SpinDelayUs(23*8);
|
||||
|
||||
// Sam7s has several timers, we will use the source TIMER_CLOCK1 (aka AT91C_TC_CLKS_TIMER_DIV1_CLOCK)
|
||||
// TIMER_CLOCK1 = MCK/2, MCK is running at 48 MHz, Timer is running at 48/2 = 24 MHz
|
||||
// Hitag units (T0) have duration of 8 microseconds (us), which is 1/125000 per second (carrier)
|
||||
// T0 = TIMER_CLOCK1 / 125000 = 192
|
||||
// 1 Cycle = 8 microseconds(us) == 1 field clock
|
||||
#define READ_GAP 26*8
|
||||
|
||||
void TurnReadLFOn(int delay) {
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_LF_ADC | FPGA_LF_ADC_READER_FIELD);
|
||||
|
@ -1191,7 +1177,7 @@ void T55xxWriteBlock(uint32_t Data, uint32_t Block, uint32_t Pwd, uint8_t arg) {
|
|||
cmd_send(CMD_ACK,0,0,0,0,0);
|
||||
}
|
||||
|
||||
// Read one card block in page 0
|
||||
// Read one card block in page [page]
|
||||
void T55xxReadBlock(uint16_t arg0, uint8_t Block, uint32_t Pwd) {
|
||||
LED_A_ON();
|
||||
bool PwdMode = arg0 & 0x1;
|
||||
|
@ -1475,6 +1461,14 @@ uint8_t * fwd_write_ptr; //forwardlink bit pointer
|
|||
// see EM4469 spec
|
||||
//====================================================================
|
||||
//--------------------------------------------------------------------
|
||||
// VALUES TAKEN FROM EM4x function: SendForward
|
||||
// START_GAP = 440; (55*8) cycles at 125Khz (8us = 1cycle)
|
||||
// WRITE_GAP = 128; (16*8)
|
||||
// WRITE_1 = 256 32*8; (32*8)
|
||||
|
||||
// These timings work for 4469/4269/4305 (with the 55*8 above)
|
||||
// WRITE_0 = 23*8 , 9*8 SpinDelayUs(23*8);
|
||||
|
||||
uint8_t Prepare_Cmd( uint8_t cmd ) {
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -268,7 +268,7 @@ void doT55x7Acquisition(size_t sample_size) {
|
|||
bool startFound = false;
|
||||
bool highFound = false;
|
||||
uint8_t curSample = 0;
|
||||
uint8_t firstSample = 0;
|
||||
uint8_t lastSample = 0;
|
||||
uint16_t skipCnt = 0;
|
||||
while(!BUTTON_PRESS() && skipCnt<1000) {
|
||||
WDT_HIT();
|
||||
|
@ -282,19 +282,18 @@ void doT55x7Acquisition(size_t sample_size) {
|
|||
|
||||
// skip until the first high sample above threshold
|
||||
if (!startFound && curSample > T55xx_READ_UPPER_THRESHOLD) {
|
||||
if (curSample > firstSample)
|
||||
firstSample = curSample;
|
||||
if (curSample > lastSample)
|
||||
lastSample = curSample;
|
||||
highFound = true;
|
||||
} else if (!highFound) {
|
||||
skipCnt++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// skip until first high samples begin to change
|
||||
if (startFound || curSample < firstSample-T55xx_READ_TOL){
|
||||
if (startFound || curSample < T55xx_READ_UPPER_THRESHOLD-T55xx_READ_TOL){
|
||||
// if just found start - recover last sample
|
||||
if (!startFound) {
|
||||
dest[i++] = firstSample;
|
||||
dest[i++] = lastSample;
|
||||
startFound = true;
|
||||
}
|
||||
// collect samples
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue