em4x50: fix listen window sync, add runtime reader timings
Every bidirectional EM4x50 command (rdbl, info, dump, lf search) failed on a PM3 Easy with a 500 uH antenna, while `lf em 4x50 reader` worked. A raw ADC capture of the exchange showed RM being sent into the tag data right after the double listen window: find_em4x50_tag() consumes the first window, the second one is then taken as the first, and invalid_bit() cannot reject data because its single 3/4-bit sample of the AC-coupled, saturating signal always sits between g_Low and g_High. - detect the second listen window by the absence of a rising edge over its 128-cycle low phase (Manchester data has one per bit) - `lf em 4x50 config` (CMD_LF_EM4X50_CONFIG): threshold, pulse tolerance, "0" bit gap start/end and RM delay, changeable at runtime - defaults moved to the centres of the working ranges measured with the new lf_em4x50_tune.lua sweep: tol 10 (5-15), gap end 38 (28-50), rm 132 (104-164); the old gap end 32 was 4 cycles from failing - rdbl/info retry the login + selective read for up to 1 s - at debug level extended the whole exchange is captured into BigBuf, fetch it with `data samples` Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1b71dfbbd4
commit
0f777089a4
10 files changed
+470
-47
No files matched your search
@@ -84,6 +84,20 @@ typedef struct {
|
||||
uint32_t *words;
|
||||
} PACKED em4x50_read_data_response_t;
|
||||
|
||||
// CMD_LF_EM4X50_CONFIG payload and reply, reader timings in carrier cycles
|
||||
#define EM4X50_CONFIG_GET 0
|
||||
#define EM4X50_CONFIG_SET 1
|
||||
#define EM4X50_CONFIG_RESET 2
|
||||
|
||||
typedef struct {
|
||||
uint8_t mode; // EM4X50_CONFIG_*
|
||||
uint8_t threshold; // envelope thresholds, percent of amplitude
|
||||
uint8_t tolerance; // pulse length tolerance
|
||||
uint8_t gap_start; // field gap start within a reader "0" bit
|
||||
uint8_t gap_end; // field gap end within a reader "0" bit
|
||||
uint16_t rm_delay; // RM start after the end of the first listen window
|
||||
} PACKED em4x50_config_t;
|
||||
|
||||
// Global variables...
|
||||
extern bool g_Login;
|
||||
extern bool g_WritePasswordProcess;
|
||||
|
||||
@@ -1089,6 +1089,7 @@ typedef struct {
|
||||
#define CMD_LF_EM4X50_READER 0x0251
|
||||
#define CMD_LF_EM4X50_ESET 0x0252
|
||||
#define CMD_LF_EM4X50_CHK 0x0253
|
||||
#define CMD_LF_EM4X50_CONFIG 0x0254
|
||||
#define CMD_LF_EM4X70_INFO 0x0260
|
||||
#define CMD_LF_EM4X70_WRITE 0x0261
|
||||
#define CMD_LF_EM4X70_UNLOCK 0x0262
|
||||
|
||||
Reference in new issue
Block a user