mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-07-30 11:38:38 -07:00
implement 'hf iclass snoop -j'
* fix long option --jam * make room for one more bit for FPGA minor mode * new mode FPGA_HF_READER_MODE_SEND_JAM * implement jamming in Handle15693SampleFromReader
This commit is contained in:
parent
be09ea8603
commit
cd028159be
13 changed files with 116 additions and 68 deletions
BIN
fpga/fpga_hf.bit
BIN
fpga/fpga_hf.bit
Binary file not shown.
|
@ -13,8 +13,14 @@
|
|||
// iZsh <izsh at fail0verflow.com>, June 2014
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Defining modes and options. This must be aligned to the definitions in fpgaloader.h
|
||||
|
||||
// Defining commands, modes and options. This must be aligned to the definitions in fpgaloader.h
|
||||
// Note: the definitions here are without shifts
|
||||
|
||||
// Commands:
|
||||
`define FPGA_CMD_SET_CONFREG 1
|
||||
`define FPGA_CMD_TRACE_ENABLE 2
|
||||
|
||||
// Major modes:
|
||||
`define FPGA_MAJOR_MODE_LF_ADC 0
|
||||
`define FPGA_MAJOR_MODE_LF_EDGE_DETECT 1
|
||||
|
@ -35,6 +41,7 @@
|
|||
`define FPGA_HF_READER_MODE_SNIFF_IQ 5
|
||||
`define FPGA_HF_READER_MODE_SNIFF_AMPLITUDE 6
|
||||
`define FPGA_HF_READER_MODE_SNIFF_PHASE 7
|
||||
`define FPGA_HF_READER_MODE_SEND_JAM 8
|
||||
`define FPGA_HF_READER_SUBCARRIER_848_KHZ 0
|
||||
`define FPGA_HF_READER_SUBCARRIER_424_KHZ 1
|
||||
`define FPGA_HF_READER_SUBCARRIER_212_KHZ 2
|
||||
|
@ -79,7 +86,7 @@ module fpga_hf(
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
reg [15:0] shift_reg;
|
||||
reg [7:0] conf_word;
|
||||
reg [8:0] conf_word;
|
||||
reg trace_enable;
|
||||
|
||||
// We switch modes between transmitting to the 13.56 MHz tag and receiving
|
||||
|
@ -88,8 +95,8 @@ reg trace_enable;
|
|||
always @(posedge ncs)
|
||||
begin
|
||||
case(shift_reg[15:12])
|
||||
4'b0001: conf_word <= shift_reg[7:0]; // FPGA_CMD_SET_CONFREG
|
||||
4'b0010: trace_enable <= shift_reg[0]; // FPGA_CMD_TRACE_ENABLE
|
||||
`FPGA_CMD_SET_CONFREG: conf_word <= shift_reg[8:0];
|
||||
`FPGA_CMD_TRACE_ENABLE: trace_enable <= shift_reg[0];
|
||||
endcase
|
||||
end
|
||||
|
||||
|
@ -103,11 +110,11 @@ begin
|
|||
end
|
||||
|
||||
// select module (outputs) based on major mode
|
||||
wire [2:0] major_mode = conf_word[7:5];
|
||||
wire [2:0] major_mode = conf_word[8:6];
|
||||
|
||||
// configuring the HF reader
|
||||
wire [1:0] subcarrier_frequency = conf_word[4:3];
|
||||
wire [2:0] minor_mode = conf_word[2:0];
|
||||
wire [1:0] subcarrier_frequency = conf_word[5:4];
|
||||
wire [3:0] minor_mode = conf_word[3:0];
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// And then we instantiate the modules corresponding to each of the FPGA's
|
||||
|
|
BIN
fpga/fpga_lf.bit
BIN
fpga/fpga_lf.bit
Binary file not shown.
|
@ -29,17 +29,18 @@ module fpga_lf(
|
|||
|
||||
reg [15:0] shift_reg;
|
||||
reg [7:0] divisor;
|
||||
reg [7:0] conf_word;
|
||||
reg [8:0] conf_word;
|
||||
reg [7:0] user_byte1;
|
||||
|
||||
always @(posedge ncs)
|
||||
begin
|
||||
case(shift_reg[15:12])
|
||||
4'b0001:
|
||||
case (shift_reg[15:12])
|
||||
4'b0001: // FPGA_CMD_SET_CONFREG
|
||||
begin
|
||||
conf_word <= shift_reg[7:0];
|
||||
if (shift_reg[7:0] == 8'b00000001) begin // LF edge detect
|
||||
user_byte1 <= 127; // default threshold
|
||||
conf_word <= shift_reg[8:0];
|
||||
if (shift_reg[8:0] == 9'b000000001)
|
||||
begin // LF edge detect
|
||||
user_byte1 <= 127; // default threshold
|
||||
end
|
||||
end
|
||||
4'b0010: divisor <= shift_reg[7:0]; // FPGA_CMD_SET_DIVISOR
|
||||
|
@ -49,14 +50,14 @@ end
|
|||
|
||||
always @(posedge spck)
|
||||
begin
|
||||
if(~ncs)
|
||||
if (~ncs)
|
||||
begin
|
||||
shift_reg[15:1] <= shift_reg[14:0];
|
||||
shift_reg[0] <= mosi;
|
||||
end
|
||||
end
|
||||
|
||||
wire [2:0] major_mode = conf_word[7:5];
|
||||
wire [2:0] major_mode = conf_word[8:6];
|
||||
|
||||
// For the low-frequency configuration:
|
||||
wire lf_field = conf_word[0];
|
||||
|
|
|
@ -18,7 +18,7 @@ module hi_iso14443a(
|
|||
input ssp_dout;
|
||||
output ssp_frame, ssp_din, ssp_clk;
|
||||
output dbg;
|
||||
input [2:0] mod_type;
|
||||
input [3:0] mod_type;
|
||||
|
||||
|
||||
wire adc_clk = ck_1356meg;
|
||||
|
|
|
@ -19,7 +19,7 @@ module hi_reader(
|
|||
output ssp_frame, ssp_din, ssp_clk;
|
||||
output dbg;
|
||||
input [1:0] subcarrier_frequency;
|
||||
input [2:0] minor_mode;
|
||||
input [3:0] minor_mode;
|
||||
|
||||
assign adc_clk = ck_1356meg; // sample frequency is 13,56 MHz
|
||||
|
||||
|
@ -257,6 +257,19 @@ end
|
|||
assign ssp_din = corr_i_out[7];
|
||||
|
||||
|
||||
// a jamming signal
|
||||
reg jam_signal;
|
||||
reg [3:0] jam_counter;
|
||||
|
||||
always @(negedge adc_clk)
|
||||
begin
|
||||
if (corr_i_cnt == 6'd0)
|
||||
begin
|
||||
jam_counter <= jam_counter + 1;
|
||||
jam_signal <= jam_counter[1] ^ jam_counter[3];
|
||||
end
|
||||
end
|
||||
|
||||
// Antenna drivers
|
||||
reg pwr_hi, pwr_oe4;
|
||||
|
||||
|
@ -272,10 +285,15 @@ begin
|
|||
pwr_hi = ck_1356meg & ~ssp_dout;
|
||||
pwr_oe4 = 1'b0;
|
||||
end
|
||||
else if (minor_mode == `FPGA_HF_READER_MODE_SEND_JAM)
|
||||
begin
|
||||
pwr_hi = ck_1356meg & jam_signal;
|
||||
pwr_oe4 = 1'b0;
|
||||
end
|
||||
else if (minor_mode == `FPGA_HF_READER_MODE_SNIFF_IQ
|
||||
|| minor_mode == `FPGA_HF_READER_MODE_SNIFF_AMPLITUDE
|
||||
|| minor_mode == `FPGA_HF_READER_MODE_SNIFF_PHASE)
|
||||
begin
|
||||
begin // all off
|
||||
pwr_hi = 1'b0;
|
||||
pwr_oe4 = 1'b0;
|
||||
end
|
||||
|
@ -284,7 +302,7 @@ begin
|
|||
pwr_hi = ck_1356meg;
|
||||
pwr_oe4 = 1'b0;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
// always on
|
||||
assign pwr_oe1 = 1'b0;
|
||||
|
|
|
@ -31,7 +31,7 @@ module hi_simulate(
|
|||
input ssp_dout;
|
||||
output ssp_frame, ssp_din, ssp_clk;
|
||||
output dbg;
|
||||
input [2:0] mod_type;
|
||||
input [3:0] mod_type;
|
||||
|
||||
assign adc_clk = ck_1356meg;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue