From: daniel.boteanu Date: Sat, 9 Jan 2010 14:59:42 +0000 (+0000) Subject: Added hitune command for continuously measuring HF antenna tuning X-Git-Tag: v1.0.0~402 X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/1eb7596aad742392643a52fc0935798c618e986b?hp=8b576d2d3125081ab24a970f6430044a19a4231d Added hitune command for continuously measuring HF antenna tuning --- diff --git a/armsrc/appmain.c b/armsrc/appmain.c index 237159c9..6edf138b 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -202,6 +202,27 @@ void MeasureAntennaTuning(void) UsbSendPacket((BYTE *)&c, sizeof(c)); } +void MeasureAntennaTuningHf(void) +{ + int vHf = 0; // in mV + + DbpString("Measuring HF antenna characteristics, press button to exit"); + + for (;;) { + // Let the FPGA drive the high-frequency antenna around 13.56 MHz. + FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR); + SpinDelay(20); + // Vref = 3300mV, and an 10:1 voltage divider on the input + // can measure voltages up to 33000 mV + vHf = (33000 * AvgAdc(ADC_CHAN_HF)) >> 10; + + Dbprintf("%d mV",vHf); + if (BUTTON_PRESS()) break; + } + DbpString("cancelled"); +} + + void SimulateTagHfListen(void) { BYTE *dest = (BYTE *)BigBuf; @@ -643,6 +664,10 @@ void UsbPacketReceived(BYTE *packet, int len) MeasureAntennaTuning(); break; + case CMD_MEASURE_ANTENNA_TUNING_HF: + MeasureAntennaTuningHf(); + break; + case CMD_LISTEN_READER_FIELD: ListenReaderField(c->arg[0]); break; diff --git a/client/command.c b/client/command.c index 9bfb18f2..5d27870e 100644 --- a/client/command.c +++ b/client/command.c @@ -93,6 +93,12 @@ static void CmdTune(char *str) SendCommand(&c); } +static void CmdHiTune(char *str) +{ + UsbCommand c={CMD_MEASURE_ANTENNA_TUNING_HF}; + SendCommand(&c); +} + static void CmdHi15read(char *str) { UsbCommand c={CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_15693}; @@ -2825,6 +2831,7 @@ static struct { /* low-level hardware control */ {"fpgaoff", CmdFPGAOff, 0, "Set FPGA off"}, {"tune", CmdTune, 0, "Measure antenna tuning"}, + {"hitune", CmdHiTune, 0, "Continuously measure HF antenna tuning"}, {"readmem", CmdReadmem, 0, "[address] -- Read memory at decimal address from flash"}, {"reset", CmdReset, 0, "Reset the Proxmark3"}, {"setlfdivisor", CmdSetDivisor, 0, "<19 - 255> -- Drive LF antenna at 12Mhz/(divisor+1)"}, diff --git a/client/prox.h b/client/prox.h index 10429dc1..4742ba9a 100644 --- a/client/prox.h +++ b/client/prox.h @@ -44,6 +44,7 @@ int GetClock(char *str, int peak); static void CmdHIDdemodFSK(char *str); static void Cmdmanchestermod(char *str); static void CmdTune(char *str); +static void CmdHiTune(char *str); static void CmdHi15read(char *str); static void CmdHi14read(char *str); static void CmdSri512read(char *str); diff --git a/include/usb_cmd.h b/include/usb_cmd.h index 9e2acf6e..71f0221c 100644 --- a/include/usb_cmd.h +++ b/include/usb_cmd.h @@ -84,8 +84,9 @@ typedef struct { // For measurements of the antenna tuning #define CMD_MEASURE_ANTENNA_TUNING 0x0400 -#define CMD_MEASURED_ANTENNA_TUNING 0x0401 -#define CMD_LISTEN_READER_FIELD 0x0402 +#define CMD_MEASURE_ANTENNA_TUNING_HF 0x0401 +#define CMD_MEASURED_ANTENNA_TUNING 0x0410 +#define CMD_LISTEN_READER_FIELD 0x0420 // For direct FPGA control #define CMD_FPGA_MAJOR_MODE_OFF 0x0500