- DbpString("Antenna resonates at:");
- DbpString(dummy);
-}
-
-void MeasureAntennaTuning(void)
-{
-// Impedances are Zc = 1/(j*omega*C), in ohms
-#define LF_TUNING_CAP_Z 1273 // 1 nF @ 125 kHz
-#define HF_TUNING_CAP_Z 235 // 50 pF @ 13.56 MHz
-
- int vLf125, vLf134, vHf; // in mV
-
- UsbCommand c;
-
- // Let the FPGA drive the low-frequency antenna around 125 kHz.
- FpgaSendCommand(FPGA_CMD_SET_DIVISOR, 95); //125Khz
- FpgaWriteConfWord(FPGA_MAJOR_MODE_LF_READER | FPGA_LF_READER_USE_125_KHZ);
- SpinDelay(20);
- vLf125 = AvgAdc(ADC_CHAN_LF);
- // Vref = 3.3V, and a 10000:240 voltage divider on the input
- // can measure voltages up to 137500 mV
- vLf125 = (137500 * vLf125) >> 10;
-
- // Let the FPGA drive the low-frequency antenna around 134 kHz.
- FpgaSendCommand(FPGA_CMD_SET_DIVISOR, 88); //134.8Khz
- FpgaWriteConfWord(FPGA_MAJOR_MODE_LF_READER | FPGA_LF_READER_USE_134_KHZ);
- SpinDelay(20);
- vLf134 = AvgAdc(ADC_CHAN_LF);
- // Vref = 3.3V, and a 10000:240 voltage divider on the input
- // can measure voltages up to 137500 mV
- vLf134 = (137500 * vLf134) >> 10;