UsbSendPacket((BYTE *)&c, sizeof(c));\r
}\r
\r
+void MeasureAntennaTuningHf(void)\r
+{\r
+ int vHf = 0; // in mV\r
+\r
+ DbpString("Measuring HF antenna characteristics, press button to exit");\r
+\r
+ for (;;) {\r
+ // Let the FPGA drive the high-frequency antenna around 13.56 MHz.\r
+ FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR);\r
+ SpinDelay(20);\r
+ // Vref = 3300mV, and an 10:1 voltage divider on the input\r
+ // can measure voltages up to 33000 mV\r
+ vHf = (33000 * AvgAdc(ADC_CHAN_HF)) >> 10;\r
+ \r
+ Dbprintf("%d mV",vHf);\r
+ if (BUTTON_PRESS()) break;\r
+ }\r
+ DbpString("cancelled");\r
+}\r
+\r
+\r
void SimulateTagHfListen(void)\r
{\r
BYTE *dest = (BYTE *)BigBuf;\r
MeasureAntennaTuning();\r
break;\r
\r
+ case CMD_MEASURE_ANTENNA_TUNING_HF:\r
+ MeasureAntennaTuningHf();\r
+ break;\r
+\r
case CMD_LISTEN_READER_FIELD:\r
ListenReaderField(c->arg[0]);\r
break;\r
SendCommand(&c);\r
}\r
\r
+static void CmdHiTune(char *str)\r
+{\r
+ UsbCommand c={CMD_MEASURE_ANTENNA_TUNING_HF};\r
+ SendCommand(&c);\r
+}\r
+\r
static void CmdHi15read(char *str)\r
{\r
UsbCommand c={CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_15693};\r
/* low-level hardware control */\r
{"fpgaoff", CmdFPGAOff, 0, "Set FPGA off"},\r
{"tune", CmdTune, 0, "Measure antenna tuning"},\r
+ {"hitune", CmdHiTune, 0, "Continuously measure HF antenna tuning"},\r
{"readmem", CmdReadmem, 0, "[address] -- Read memory at decimal address from flash"},\r
{"reset", CmdReset, 0, "Reset the Proxmark3"},\r
{"setlfdivisor", CmdSetDivisor, 0, "<19 - 255> -- Drive LF antenna at 12Mhz/(divisor+1)"},\r
static void CmdHIDdemodFSK(char *str);\r
static void Cmdmanchestermod(char *str);\r
static void CmdTune(char *str);\r
+static void CmdHiTune(char *str);\r
static void CmdHi15read(char *str);\r
static void CmdHi14read(char *str);\r
static void CmdSri512read(char *str);\r
\r
// For measurements of the antenna tuning\r
#define CMD_MEASURE_ANTENNA_TUNING 0x0400\r
-#define CMD_MEASURED_ANTENNA_TUNING 0x0401\r
-#define CMD_LISTEN_READER_FIELD 0x0402\r
+#define CMD_MEASURE_ANTENNA_TUNING_HF 0x0401\r
+#define CMD_MEASURED_ANTENNA_TUNING 0x0410\r
+#define CMD_LISTEN_READER_FIELD 0x0420\r
\r
// For direct FPGA control\r
#define CMD_FPGA_MAJOR_MODE_OFF 0x0500\r