mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 10:37:23 -07:00
lf: change macros to allow float freq, change 134 -> 134.2
This commit is contained in:
parent
cb06bea448
commit
eb7268cd98
5 changed files with 15 additions and 14 deletions
|
@ -2418,7 +2418,7 @@ because of this, we can "sample" the data signal but we interpreate it to Manche
|
|||
This behavior looks very similar to old ancient Motorola Flexpass
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
According to patent:
|
||||
According to patent EP0040544B1:
|
||||
Operating freq
|
||||
reader 132 kHz
|
||||
tag 66 kHz
|
||||
|
@ -2453,7 +2453,7 @@ void Cotag(uint32_t arg0) {
|
|||
|
||||
LED_A_ON();
|
||||
|
||||
LFSetupFPGAForADC(LF_DIVISOR(132), true);
|
||||
LFSetupFPGAForADC(LF_FREQ2DIV(132), true);
|
||||
|
||||
//clear buffer now so it does not interfere with timing later
|
||||
BigBuf_Clear_ext(false);
|
||||
|
|
|
@ -1676,16 +1676,16 @@ int CmdTuneSamples(const char *Cmd) {
|
|||
struct p *package = (struct p *)resp.data.asBytes;
|
||||
|
||||
if (package->v_lf125 > NON_VOLTAGE)
|
||||
PrintAndLogEx(SUCCESS, "LF antenna: %5.2f V - %.2f kHz", (package->v_lf125 * ANTENNA_ERROR) / 1000.0, 12000.0 / (LF_DIVISOR_125 + 1));
|
||||
PrintAndLogEx(SUCCESS, "LF antenna: %5.2f V - %.2f kHz", (package->v_lf125 * ANTENNA_ERROR) / 1000.0, LF_DIV2FREQ(LF_DIVISOR_125));
|
||||
|
||||
if (package->v_lf134 > NON_VOLTAGE)
|
||||
PrintAndLogEx(SUCCESS, "LF antenna: %5.2f V - %.2f kHz", (package->v_lf134 * ANTENNA_ERROR) / 1000.0, 12000.0 / (LF_DIVISOR_134 + 1));
|
||||
PrintAndLogEx(SUCCESS, "LF antenna: %5.2f V - %.2f kHz", (package->v_lf134 * ANTENNA_ERROR) / 1000.0, LF_DIV2FREQ(LF_DIVISOR_134));
|
||||
|
||||
if (package->v_lfconf > NON_VOLTAGE && package->divisor > 0 && package->divisor != LF_DIVISOR_125 && package->divisor != LF_DIVISOR_134)
|
||||
PrintAndLogEx(SUCCESS, "LF antenna: %5.2f V - %.2f kHz", (package->v_lfconf * ANTENNA_ERROR) / 1000.0, 12000.0 / (package->divisor + 1));
|
||||
PrintAndLogEx(SUCCESS, "LF antenna: %5.2f V - %.2f kHz", (package->v_lfconf * ANTENNA_ERROR) / 1000.0, LF_DIV2FREQ(package->divisor));
|
||||
|
||||
if (package->peak_v > NON_VOLTAGE && package->peak_f > 0)
|
||||
PrintAndLogEx(SUCCESS, "LF optimal: %5.2f V - %6.2f kHz", (package->peak_v * ANTENNA_ERROR) / 1000.0, 12000.0 / (package->peak_f + 1));
|
||||
PrintAndLogEx(SUCCESS, "LF optimal: %5.2f V - %6.2f kHz", (package->peak_v * ANTENNA_ERROR) / 1000.0, LF_DIV2FREQ(package->peak_f));
|
||||
|
||||
char judgement[20];
|
||||
memset(judgement, 0, sizeof(judgement));
|
||||
|
@ -1730,7 +1730,7 @@ int CmdTuneSamples(const char *Cmd) {
|
|||
|
||||
if (test1 > 0) {
|
||||
PrintAndLogEx(SUCCESS, "\nDisplaying LF tuning graph. Divisor %d is %.2f kHz, %d is %.2f kHz.\n\n",
|
||||
LF_DIVISOR_134, 12000.0 / (LF_DIVISOR_134 + 1), LF_DIVISOR_125, 12000.0 / (LF_DIVISOR_125 + 1));
|
||||
LF_DIVISOR_134, LF_DIV2FREQ(LF_DIVISOR_134), LF_DIVISOR_125, LF_DIV2FREQ(LF_DIVISOR_125));
|
||||
GraphTraceLen = 256;
|
||||
ShowGraphWindow();
|
||||
RepaintGraphWindow();
|
||||
|
|
|
@ -232,7 +232,7 @@ int CmdLFTune(const char *Cmd) {
|
|||
break;
|
||||
case 'f': {
|
||||
int freq = param_get32ex(Cmd, cmdp + 1, 125, 10);
|
||||
divisor = LF_DIVISOR(freq);
|
||||
divisor = LF_FREQ2DIV(freq);
|
||||
if (divisor < 19) {
|
||||
PrintAndLogEx(ERR, "freq must be between 47 and 600");
|
||||
return PM3_EINVARG;
|
||||
|
@ -254,7 +254,7 @@ int CmdLFTune(const char *Cmd) {
|
|||
//Validations
|
||||
if (errors) return usage_lf_tune();
|
||||
|
||||
PrintAndLogEx(SUCCESS, "Measuring LF antenna at %.2f kHz, click button or press Enter to exit", 12000.0 / (divisor + 1));
|
||||
PrintAndLogEx(SUCCESS, "Measuring LF antenna at %.2f kHz, click button or press Enter to exit", LF_DIV2FREQ(divisor));
|
||||
|
||||
uint8_t params[] = {1, 0};
|
||||
params[1] = divisor;
|
||||
|
@ -498,7 +498,7 @@ int CmdLFConfig(const char *Cmd) {
|
|||
break;
|
||||
case 'f': {
|
||||
int freq = param_get32ex(Cmd, cmdp + 1, 125, 10);
|
||||
divisor = LF_DIVISOR(freq);
|
||||
divisor = LF_FREQ2DIV(freq);
|
||||
if (divisor < 19) {
|
||||
PrintAndLogEx(ERR, "freq must be between 47 and 600");
|
||||
return PM3_EINVARG;
|
||||
|
|
|
@ -127,7 +127,7 @@ static int CmdMotorolaRead(const char *Cmd) {
|
|||
.decimation = 0,
|
||||
.bits_per_sample = 0,
|
||||
.averaging = false,
|
||||
.divisor = LF_DIVISOR(74),
|
||||
.divisor = LF_FREQ2DIV(74),
|
||||
.trigger_threshold = -1,
|
||||
.samples_to_skip = 4500,
|
||||
.verbose = false
|
||||
|
|
|
@ -590,9 +590,10 @@ typedef struct {
|
|||
#define PM3_EFATAL -99
|
||||
|
||||
// LF
|
||||
#define LF_DIVISOR(f) (((12000 + (f)/2)/(f))-1)
|
||||
#define LF_DIVISOR_125 LF_DIVISOR(125)
|
||||
#define LF_DIVISOR_134 LF_DIVISOR(134)
|
||||
#define LF_FREQ2DIV(f) ((int)(((12000.0 + (f)/2.0)/(f))-1))
|
||||
#define LF_DIVISOR_125 LF_FREQ2DIV(125)
|
||||
#define LF_DIVISOR_134 LF_FREQ2DIV(134.2)
|
||||
#define LF_DIV2FREQ(d) (12000.0/((d)+1))
|
||||
|
||||
// Receiving from USART need more than 30ms as we used on USB
|
||||
// else we get errors about partial packet reception
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue