Commit Graph
983 Commits
Author SHA1 Message Date
iceman1001 9e2092fc66 capabilities: report device frame size so the client can adapt
PM3_CMD_DATA_SIZE went 512 -> 624 without a capabilities bump, so a new
client connects to old firmware and every oversized command dies at the
device's length check with no message.

Append max_cmd_data_size, bump to v9. The client now accepts an older
capabilities struct - it only ever grows by appending, so an older layout
is a prefix - and defaults the frame size for pre-v9 firmware.
SendCommandNG bounds by the device value instead of the compile time one.

Also zero init capabilities_t on the device, it leaked stack bytes.
2026-08-30 20:13:38 +02:00
iceman1001 6d2c35b05b The slight increase of array size makes us use the usb packages the AT91 sends which is 64bytes of size. We maximizing the available bytes basically and it comes with a slight cost of .bss and stack cost. Making bigbuff just abit smaller. We gain: 600 kBs -> 630 kB/s and less number of frames being sent over the wire. \n\nWhen it comes to Pm5 it will need to find its own aligned size to optimize transfers 2026-08-30 19:21:28 +02:00
Niel Nielsen fd81dbd10a Add files via upload
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-08-30 15:24:08 +02:00
iceman1001 ed066d84aa 'hf mfu cchk' - widen 3-pass chkkey nkeys to a full byte
nkeys was a 6 bit field but the client chunked by what fits in a frame -
123 keys in segment mode. nkeys wrapped to 59 while memcpy copied all 123
and the loop advanced by 123, so 64 of every 123 keys were never tested
and never reported. Full key mode was unaffected, it chunks 30.

Give nkeys its own byte. MIFAREU3P_CHKKEY_HEADER goes 18 -> 19, costing
one byte of payload, and segment mode chunks 123 again

Payload layout changed: client and firmware must be updated together.
Thanks Claude!
2026-08-30 13:25:50 +02:00
iceman1001 25d958e5e6 split PM3_CMD_DATA_SIZE_OLD out of PM3_CMD_DATA_SIZE
The OLD frame size was tied to the NG one, but the bootloader only speaks
OLD - growing PM3_CMD_DATA_SIZE would silently change sizeof(PacketCommandOLD)
and break flashing against every deployed bootrom in both directions.

Pin the OLD structs to their own constant and use it on every OLD path:
reply_old and the OLD receive branch on both sides, the bootrom, and the
flasher's write_block/send_finish_write_cmd, which memcpy into a
PacketCommandOLD using the NG size.

No behaviour change - both constants are 512 and armsrc .text is
byte-identical before and after.
2026-08-30 13:03:53 +02:00
Niel Nielsen 7d6ca7ba91 Add BWM_WIFI_ACTION_STATUS definition
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-08-29 19:59:21 +02:00
iceman1001 b0125c036e removed CMD_SMART_SETBAUD since we dont use it any more. Thanks Claude! 2026-08-29 17:46:06 +02:00
iceman1001 a0a3eb4bbf remove CMD_LF_SIMULATE_BIDIR, never implemented 2026-08-29 17:38:41 +02:00
iceman1001 0f11c5c4d1 Phase E - dismantle MIX functionality 2026-08-29 16:50:29 +02:00
iceman1001 7b7ec48bd9 OLD/MIX convert to NG: Phase C10 2026-08-29 15:50:36 +02:00
iceman1001 72ff6a5b80 OLD/MIX convert to NG: Phase C9 2026-08-29 15:18:54 +02:00
iceman1001 721641428c OLD/MIX convert to NG: Phase C8 2026-08-29 15:13:34 +02:00
iceman1001 0bbc9025ae OLD/MIX convert to NG: Phase C7 2026-08-29 15:00:03 +02:00
iceman1001 3762130c42 OLD/MIX convert to NG: Phase C6 2026-08-29 14:48:36 +02:00
iceman1001 5589cbf847 OLD/MIX convert to NG: Phase C5 2026-08-29 14:31:34 +02:00
iceman1001 d1cc742987 OLD/MIX convert to NG: Phase C4 2026-08-29 14:24:11 +02:00
iceman1001 f42564283e OLD/MIX convert to NG: Phase C3 2026-08-29 14:19:26 +02:00
iceman1001 ad629c77e8 OLD/MIX convert to NG: Phase C2 2026-08-29 14:12:22 +02:00
iceman1001 5c7e9f6c42 OLD/MIX convert to NG: Phase C1 2026-08-29 13:58:42 +02:00
iceman1001 1a3f64960a OLD/MIX convert to NG: Phase C 2026-08-29 13:50:49 +02:00
iceman1001 99c58f9dea NG: iso14a_raw_cmd_t, convert hf 14a raw, dual-mode reader handler. A multi step process, this is the first step. Thanks Claude 2026-08-29 13:06:28 +02:00
iceman1001 b3048064f6 converted CMD_LF_EM4X50_ESET to NG frame, thanks Claude 2026-08-29 12:20:56 +02:00
iceman1001 d7ed0d5a96 NG: convert CMD_LF_T55XX_SET_CONFIG to t55xx_setconfig_t 2026-08-29 11:28:29 +02:00
iceman1001 0ae01a5331 new ISO15693 dump file format with converters added. Needed since 0x100 pages and 8 byte blocks is possible 2026-08-29 11:19:39 +02:00
iceman1001andClaude Opus 5 cb48c928a5 hf felica: make reading actually work
FeliCa reading was broken on every card tested: 'hf felica reader' returned PM3_ETIMEOUT while the tag was answering correctly. The cause was in the FPGA demodulator, not the ARM.

fpga/hi_flite.v
---------------
Adaptive hysteresis thresholds. The envelope tracker clamped curmin to <= 70 and curmax to >= 180, so curminthres/curmaxthres were pinned near 91/160 no
matter where the signal actually sat. Measured on a RDV4 with the field on, the peak detector idles near 112 and a tag swings it by about +/-35, ie entirely
inside that window - so nothing ever crossed a threshold and every frame demodulated as a constant. The band is now derived from the tracked envelope,
3/16 of its span, floored at +/- 8 to stay clear of the 4..6 counts of carrier ripple.

Matched-filter bit detector. The slicer counted comparator trips (+1 above curmaxthres, -1 below curminthres, repeat the last crossing direction inside
the dead band), so every bit depended on where the band happened to sit. A mispositioned band railed the output to a constant and, since only the stable
branch can recompute thresholds or desync, it stayed that way for the rest of the session. It also discarded amplitude, gaining nothing from 32x
oversampling. Each half-bit is now integrated in the ADC domain and the larger half wins. Thresholds still drive bit phase and the desync, they no longer
decide bit values, so a clipped or mispositioned envelope can no longer rail the output.

Polarity lock guard. try_sync arms part way through a half-bit, so the first decision after arming is meaningless and could latch 'zero' inverted, decoding
the whole frame with the wrong polarity and losing the sync word. Skip the first two decisions; the preamble is 48 bits.

curbit re-timing. The bit decision was made in the bit-phase domain, which is aligned to the tag's edges, but sampled by the SSC in the carrier domain. The
ARM could latch a bit mid-transition at a phase that varied per frame. Both run at 64 carrier periods per bit, so re-timing curbit half an SSP bit away from the
sampling edge is a re-time, not a resample.

Envelope watchdog. FPGA registers persist across PM3 commands - only a bitstream reload clears them - so the tracker could enter a state it never left and the
first command after the client started would work while every one after it failed. Force a re-centre when the demodulator has not reached a known-good idle
for 19.3 ms, held off at the start of each frame so it cannot fire mid-reply.

state is marked (* fsm_extract = 'no' *). The project synthesises with -fsm_style bram; once XST recognised this register as a state machine it placed
the state ROM in a block RAM, and the xc2s30's six were already spoken for. MAP then failed to fit with nothing but a generic 'design is too large' error, no
BITGEN, and no new bitstream.

armsrc/felica.c
---------------
- felica_select_card() returning 4 (response too short for IDm+PMm) fell through to PM3_SUCCESS, so 'hf felica reader' reported an all-zero IDm as a good read.
- After a poll timeout the code still read FelicaFrame; with a stale POLLING_RES and len == 0, check_crc() was handed (len - 2) as a size_t, ie 65534.
- WaitForFelicaReply() could only time out from STATE_UNSYNCD/TRYING_SYNC and would spin forever if a frame never completed.
- felica_sniff() decremented and broke before LogTrace, so '-s 10' logged nine frames and '-s 0' logged none. CRC-failed noise no longer pollutes the trace.
- felica_sendraw() sent no reply at all for some flag combinations, leaving the client blocked until its own timeout.
- Polling used time slot 0 only, so several cards in the field collided forever. Retries now widen the TSN window.
- BuildFliteRdblk() warned about a bad block count and built the frame anyway.

Signal probe
------------
'hf felica raw -p' streams the per-window envelope min and max instead of demodulated bits, so reading distance and coupling can be measured rather than
guessed. This is what told 'tag out of range' apart from 'demodulator not locking', which are otherwise identical from the ARM's point of view.

Measured on a RDV4, both cards previously unreadable:
  FeliCa Standard RC-S830 (CJRC 0003): reader 4/4, info 4/4, 39 nodes discovered, dump complete in 2.0 s, 37/40 single polls.
  FeliCa Standard RC-S962 (Octopus 8008): reader 10/10, 23 nodes discovered, dump complete in 1.5 s, 40/60 single polls. This one drives the envelope onto the bottom ADC rail; the matched filter reads it anyway.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-28 22:35:08 +02:00
Niel Nielsen b3fc31f58f Fix header file formatting and add missing defines
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-08-28 13:10:24 +02:00
iceman1001 377d7cd612 since it still felt a bit slow, Claude came up with the idea of burst mode transfers. A new sim module firmware 'sim022.bin' and we now can auto-negotiate for TA1 = 0x95 which give us 125 000 bits/s which is almost 10x from the 10752 bits/s we were doing before. Thanks Claude! 2026-08-28 01:16:11 +02:00
Niel Nielsen 63112fad75 Merge branch 'RfidResearchGroup:master' into WIFI-test 2026-08-27 16:58:47 +02:00
iceman1001 bbe0c11e4c reverting 2026-08-27 14:26:35 +02:00
Niel Nielsen 2a7b12bb3d Add CMD_PM5_BWM_WIFI command definition
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-08-27 13:03:24 +02:00
iceman1001 3ba5936c70 faster client polling. Should make the pm3 client more spiffy 2026-08-27 12:44:30 +02:00
iceman1001 dcb474a963 added ISO 7816-3 protocol and parameter selection exchange command. wired up T=1 in device side and fixed timing issues too. Thanks Claude 2026-08-26 20:42:39 +02:00
Niel Nielsen 75f723647d Define CMD_PM5_BWM_AUTOOFF for USB unplug
Added command definition for PM5 automatic power-off feature.

Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-08-25 12:43:53 +02:00
dxl 347cbf153a Move gpio defs to config_gpio_proxmark5.h 2026-08-24 09:55:27 +02:00
Niel Nielsen 190ed8a990 ADD: BWM status includes AW32001ECSR registerd, Charging set to 256mAh and keeps BWM safety guards for temperature 2026-08-23 20:31:01 +02:00
Niel Nielsen ca129dcafa ADD bwmsetcap command id i
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-08-23 13:28:07 +02:00
Antiklesys 6a317bdacc Added CMD_HF_ICLASS_RAW
Raw iCLASS reader exchange that leaves the field ON
2026-08-21 12:45:46 +08:00
Nemanja Nedeljkovic 6507b8f36b feat(pm5): hf tune --rgb / lf tune --rgb - antenna RGB as a tuning meter
Adds an opt-in `--rgb` flag to the continuous `hf tune` / `lf tune` commands that
mirrors the antenna tuning level on the PM5 antenna RGB LED: blue = low, green =
mid, red = high, tracking the on-screen bar so you can find coupling (e.g. an
implant) by feel without watching the screen.

The colour is computed client-side from the same per-iteration voltage / running
peak the bar uses (so it matches the bar and auto-scales), and pushed to the
device via a new dumb CMD_PM5_RGB_SET {r,g,b}. That command is handled (#ifdef
PM5) by a dedicated AT32 RGB HAL module, common_arm/rgb/{rgb_apis.h,
rgb_hw_at32.c} (RgbLedSet(), I2C controller @ 0x48), wired into the armsrc
Makefile/CMake as SRC_RGB for PM5 only - so no other platform is affected and no
hardware code lands in shared files.
2026-08-20 11:55:55 +02:00
Philippe Teuwen 52af3f11e2 rename a couple of commands 2026-08-19 15:51:54 +02:00
dxl d59e96e09e Make proxmark3_arm.h more cross-platform. 2026-08-19 15:51:18 +02:00
dxl e3511c5350 Used HAL layer
in appmain.c and cmd added.
in cmd.c and add some code for test CEP
in em4x50.c(Do not timeout--)
in em4x70.c
in emvsim.c
in epa.c
in felica.c
in felicasim.c
in felicasim.c
in hfops.c
in hfsnoop.c
in hitag2.c
in hitag_common.c(Cross-platform implementation is incomplete.)
in hitagS.c
in hitagu.c
in i2c.c(Incomplete, continue to abstract.)
in i2c_direct.c
in iclass.c
in iso14443a.c(Sniff no finish yet)
in iso14443b.c and fixed bug for st25
in iso15693.c
in legicrf.c
in legicrfsim.c
in lfadc.c(lf_count_edge_periods_ex() improved)
in lfops.c(TI tag no finish yet)
in lfsampling.c
in lfzx.c
in mifarecmd.c
in mifaredesfire.c
in mifaresim.c
in mifaresniff_disabled.c
in mifareutil.c
in pcf7931.c
in sam_xxx
in secc & seos
in start.c
in thinfilm.c
in utils
2026-08-19 15:32:39 +02:00
Philippe Teuwen d2a8cca233 Add pm5 capabilities 2026-08-19 12:04:33 +02:00
dxl 94e350fab9 Fixed a bug where Proxmark5 dump mfu data was empty. 2026-08-19 12:04:33 +02:00
dxl 389e052ba4 Add the relevant IO definitions for capturing ssc_frames on PM5. 2026-08-19 12:04:33 +02:00
dxl 7bb46ff71e Separate the GPIO definitions of different platforms. 2026-08-19 12:04:32 +02:00
dxl 516ef68ba6 Fixed bug for RAMFUNC definition 2026-08-19 12:04:32 +02:00
dxl c3df8e705d Added def: FORCE_INLINE & STATIC_FORCE_INLINE 2026-08-19 12:04:32 +02:00
dxl 69c5db7487 Make VERSION_INFORMATION_MAGIC cross-platform. 2026-08-19 12:04:32 +02:00
dxl f145871b7e Added some cmd and struct definitions for proxmark5 2026-08-19 12:04:32 +02:00
kormax 91145e5539 Introduce FeliCa SEAC command constants 2026-08-01 00:36:47 +03:00