mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
macros for divisors and fix lf optimal freq display
This commit is contained in:
parent
6df9eea950
commit
f29ad0fba2
4 changed files with 15 additions and 9 deletions
|
@ -182,10 +182,10 @@ void MeasureAntennaTuning(void) {
|
||||||
FpgaSendCommand(FPGA_CMD_SET_DIVISOR, i);
|
FpgaSendCommand(FPGA_CMD_SET_DIVISOR, i);
|
||||||
SpinDelay(20);
|
SpinDelay(20);
|
||||||
uint32_t adcval = ((MAX_ADC_LF_VOLTAGE * AvgAdc(ADC_CHAN_LF)) >> 10);
|
uint32_t adcval = ((MAX_ADC_LF_VOLTAGE * AvgAdc(ADC_CHAN_LF)) >> 10);
|
||||||
if (i == 96)
|
if (i == LF_DIVISOR_125)
|
||||||
payload.v_lf125 = adcval; // voltage at 125kHz
|
payload.v_lf125 = adcval; // voltage at 125kHz
|
||||||
|
|
||||||
if (i == 89)
|
if (i == LF_DIVISOR_134)
|
||||||
payload.v_lf134 = adcval; // voltage at 134kHz
|
payload.v_lf134 = adcval; // voltage at 134kHz
|
||||||
|
|
||||||
if (i == sc->divisor)
|
if (i == sc->divisor)
|
||||||
|
|
|
@ -24,7 +24,7 @@ Default LF config is set to:
|
||||||
divisor = 95 (125kHz)
|
divisor = 95 (125kHz)
|
||||||
trigger_threshold = 0
|
trigger_threshold = 0
|
||||||
*/
|
*/
|
||||||
sample_config config = { 1, 8, 1, 96, 0, 0 } ;
|
sample_config config = { 1, 8, 1, LF_DIVISOR_125, 0, 0 } ;
|
||||||
|
|
||||||
void printConfig() {
|
void printConfig() {
|
||||||
uint32_t d = config.divisor;
|
uint32_t d = config.divisor;
|
||||||
|
|
|
@ -1676,16 +1676,16 @@ int CmdTuneSamples(const char *Cmd) {
|
||||||
struct p* package = (struct p*)resp.data.asBytes;
|
struct p* package = (struct p*)resp.data.asBytes;
|
||||||
|
|
||||||
if (package->v_lf125 > NON_VOLTAGE)
|
if (package->v_lf125 > NON_VOLTAGE)
|
||||||
PrintAndLogEx(SUCCESS, "LF antenna: %5.2f V - 125.00 kHz", (package->v_lf125 * ANTENNA_ERROR) / 1000.0);
|
PrintAndLogEx(SUCCESS, "LF antenna: %5.2f V - %.2f kHz", (package->v_lf125 * ANTENNA_ERROR) / 1000.0, 12000.0 / LF_DIVISOR_125);
|
||||||
|
|
||||||
if (package->v_lf134 > NON_VOLTAGE)
|
if (package->v_lf134 > NON_VOLTAGE)
|
||||||
PrintAndLogEx(SUCCESS, "LF antenna: %5.2f V - 134.00 kHz", (package->v_lf134 * ANTENNA_ERROR) / 1000.0);
|
PrintAndLogEx(SUCCESS, "LF antenna: %5.2f V - %.2f kHz", (package->v_lf134 * ANTENNA_ERROR) / 1000.0, 12000.0 / LF_DIVISOR_134);
|
||||||
|
|
||||||
if (package->v_lfconf > NON_VOLTAGE && package->divisor > 0)
|
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));
|
PrintAndLogEx(SUCCESS, "LF antenna: %5.2f V - %.2f kHz", (package->v_lfconf * ANTENNA_ERROR) / 1000.0, 12000.0 / package->divisor);
|
||||||
|
|
||||||
if (package->peak_v > NON_VOLTAGE && package->peak_f > 0)
|
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, 12000.0 / package->peak_f);
|
||||||
|
|
||||||
char judgement[20];
|
char judgement[20];
|
||||||
memset(judgement, 0, sizeof(judgement));
|
memset(judgement, 0, sizeof(judgement));
|
||||||
|
@ -1729,7 +1729,8 @@ int CmdTuneSamples(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (test1 > 0) {
|
if (test1 > 0) {
|
||||||
PrintAndLogEx(SUCCESS, "\nDisplaying LF tuning graph. Divisor 89 is 134kHz, 96 is 125kHz.\n\n");
|
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, LF_DIVISOR_125, 12000.0 / LF_DIVISOR_125);
|
||||||
GraphTraceLen = 256;
|
GraphTraceLen = 256;
|
||||||
ShowGraphWindow();
|
ShowGraphWindow();
|
||||||
RepaintGraphWindow();
|
RepaintGraphWindow();
|
||||||
|
|
|
@ -578,6 +578,11 @@ typedef struct {
|
||||||
// Quit program client: reserved, order to quit the program
|
// Quit program client: reserved, order to quit the program
|
||||||
#define PM3_EFATAL -99
|
#define PM3_EFATAL -99
|
||||||
|
|
||||||
|
// LF
|
||||||
|
//#define LF_DIVISOR(f) ((12000 + (f)/2)/(f))
|
||||||
|
//Note that 90 = 133.33 is closer to 134 than 89 = 134.83
|
||||||
|
#define LF_DIVISOR_125 96
|
||||||
|
#define LF_DIVISOR_134 89
|
||||||
|
|
||||||
// Receiving from USART need more than 30ms as we used on USB
|
// Receiving from USART need more than 30ms as we used on USB
|
||||||
// else we get errors about partial packet reception
|
// else we get errors about partial packet reception
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue