mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-07-16 02:03:00 -07:00
Add raw HF signal plotting (#786)
* Add raw HF signal plotting * new fpga module hi_get_trace.v - store A/D converter output to circular buffer on FPGA * new command 'hf plot' - pull data from FPGA and display it in Graph Window
This commit is contained in:
parent
7527c2bdd8
commit
fc52fbd42f
30 changed files with 441 additions and 62 deletions
|
@ -11,10 +11,12 @@
|
|||
|
||||
#include "cmdhf.h"
|
||||
|
||||
#include <math.h>
|
||||
#include "usb_cmd.h"
|
||||
#include "comms.h"
|
||||
#include "ui.h"
|
||||
#include "cmdparser.h"
|
||||
#include "cliparser/cliparser.h"
|
||||
#include "cmdhf14a.h"
|
||||
#include "cmdhf14b.h"
|
||||
#include "cmdhf15.h"
|
||||
|
@ -27,6 +29,9 @@
|
|||
#include "cmdhftopaz.h"
|
||||
#include "cmdhflist.h"
|
||||
#include "cmdhffido.h"
|
||||
#include "cmddata.h"
|
||||
#include "graph.h"
|
||||
#include "fpga.h"
|
||||
|
||||
static int CmdHelp(const char *Cmd);
|
||||
|
||||
|
@ -73,31 +78,83 @@ int CmdHFSnoop(const char *Cmd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static command_t CommandTable[] =
|
||||
|
||||
// static void InterpolateShannon(int *source, size_t source_len, int *dest, size_t dest_len)
|
||||
// {
|
||||
// int *buf = (int*)malloc(source_len * sizeof(int));
|
||||
// memcpy(buf, source, source_len * sizeof(int));
|
||||
// for (int i = 0; i < source_len; i++) {
|
||||
// buf[i] += 128;
|
||||
// }
|
||||
// for (int i = 0; i < dest_len; i++) {
|
||||
// float value = 0.0;
|
||||
// for (int j = 0; j < source_len; j++) {
|
||||
// if (i * source_len == j * dest_len) { // sin(0) / 0 = 1
|
||||
// value += (float)buf[j];
|
||||
// } else {
|
||||
// value += (float)buf[j] * sin(((float)i*source_len/dest_len-j)*3.1415) / (((float)i*source_len/dest_len-j)*3.1415);
|
||||
// }
|
||||
// }
|
||||
// dest[i] = value - 128;
|
||||
// }
|
||||
// free(buf);
|
||||
// }
|
||||
|
||||
|
||||
static int CmdHFPlot(const char *Cmd)
|
||||
{
|
||||
{"help", CmdHelp, 1, "This help"},
|
||||
{"14a", CmdHF14A, 1, "{ ISO14443A RFIDs... }"},
|
||||
{"14b", CmdHF14B, 1, "{ ISO14443B RFIDs... }"},
|
||||
{"15", CmdHF15, 1, "{ ISO15693 RFIDs... }"},
|
||||
{"epa", CmdHFEPA, 1, "{ German Identification Card... }"},
|
||||
{"legic", CmdHFLegic, 0, "{ LEGIC RFIDs... }"},
|
||||
{"iclass", CmdHFiClass, 1, "{ ICLASS RFIDs... }"},
|
||||
{"mf", CmdHFMF, 1, "{ MIFARE RFIDs... }"},
|
||||
{"mfu", CmdHFMFUltra, 1, "{ MIFARE Ultralight RFIDs... }"},
|
||||
{"mfp", CmdHFMFP, 1, "{ MIFARE Plus RFIDs... }"},
|
||||
{"topaz", CmdHFTopaz, 1, "{ TOPAZ (NFC Type 1) RFIDs... }"},
|
||||
{"fido", CmdHFFido, 1, "{ FIDO and FIDO2 authenticators... }"},
|
||||
{"tune", CmdHFTune, 0, "Continuously measure HF antenna tuning"},
|
||||
{"list", CmdHFList, 1, "List protocol data in trace buffer"},
|
||||
{"search", CmdHFSearch, 1, "Search for known HF tags [preliminary]"},
|
||||
CLIParserInit("hf plot",
|
||||
"Plots HF signal after RF signal path and A/D conversion.",
|
||||
"This can be used after any hf command and will show the last few milliseconds of the HF signal.\n"
|
||||
"Note: If the last hf command terminated because of a timeout you will most probably see nothing.\n");
|
||||
void* argtable[] = {
|
||||
arg_param_begin,
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(Cmd, argtable, true);
|
||||
|
||||
uint8_t buf[FPGA_TRACE_SIZE];
|
||||
|
||||
if (GetFromFpgaRAM(buf, FPGA_TRACE_SIZE)) {
|
||||
for (size_t i = 0; i < FPGA_TRACE_SIZE; i++) {
|
||||
GraphBuffer[i] = (int)buf[i] - 128;
|
||||
}
|
||||
GraphTraceLen = FPGA_TRACE_SIZE;
|
||||
// InterpolateShannon(GraphBuffer, FPGA_TRACE_SIZE, GraphBuffer, FPGA_TRACE_SIZE*8/7);
|
||||
// GraphTraceLen = FPGA_TRACE_SIZE*8/7;
|
||||
ShowGraphWindow();
|
||||
RepaintGraphWindow();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static command_t CommandTable[] =
|
||||
{
|
||||
{"help", CmdHelp, 1, "This help"},
|
||||
{"14a", CmdHF14A, 0, "{ ISO14443A RFIDs... }"},
|
||||
{"14b", CmdHF14B, 0, "{ ISO14443B RFIDs... }"},
|
||||
{"15", CmdHF15, 1, "{ ISO15693 RFIDs... }"},
|
||||
{"epa", CmdHFEPA, 0, "{ German Identification Card... }"},
|
||||
{"legic", CmdHFLegic, 0, "{ LEGIC RFIDs... }"},
|
||||
{"iclass", CmdHFiClass, 1, "{ ICLASS RFIDs... }"},
|
||||
{"mf", CmdHFMF, 1, "{ MIFARE RFIDs... }"},
|
||||
{"mfu", CmdHFMFUltra, 1, "{ MIFARE Ultralight RFIDs... }"},
|
||||
{"mfp", CmdHFMFP, 0, "{ MIFARE Plus RFIDs... }"},
|
||||
{"topaz", CmdHFTopaz, 0, "{ TOPAZ (NFC Type 1) RFIDs... }"},
|
||||
{"fido", CmdHFFido, 0, "{ FIDO and FIDO2 authenticators... }"},
|
||||
{"tune", CmdHFTune, 0, "Continuously measure HF antenna tuning"},
|
||||
{"list", CmdHFList, 1, "List protocol data in trace buffer"},
|
||||
{"plot", CmdHFPlot, 0, "Plot signal"},
|
||||
{"search", CmdHFSearch, 0, "Search for known HF tags [preliminary]"},
|
||||
{"snoop", CmdHFSnoop, 0, "<samples to skip (10000)> <triggers to skip (1)> Generic HF Snoop"},
|
||||
{NULL, NULL, 0, NULL}
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
int CmdHF(const char *Cmd)
|
||||
{
|
||||
CmdsParse(CommandTable, Cmd);
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CmdHelp(const char *Cmd)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue