Bug Fix Timing order

Timing for backward compatibility
This commit is contained in:
mwalker33 2019-07-25 20:01:03 +10:00
commit 77d96ff3b7
5 changed files with 23 additions and 23 deletions

View file

@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
## [unreleased][unreleased] ## [unreleased][unreleased]
- Fix T55x7 Downlink timings backward compatible (@mwalker33)
- Add T55x7 Downlink mode support (@mwalker33) - Add T55x7 Downlink mode support (@mwalker33)
- Add SPIFFS Flash filesystem support (@cjbrigato) - Add SPIFFS Flash filesystem support (@cjbrigato)
- Fix support for flashing 512K units with old bootrom (@slurdge/@doegox) - Fix support for flashing 512K units with old bootrom (@slurdge/@doegox)

View file

@ -123,12 +123,12 @@ t55xx_config T55xx_Timing = {{
} }
}; };
*/ */
// StartGap WriteGap Bit 0/00 Bit 1/01 Bit 10 Bit 11 ReadGap // StartGap WriteGap Bit 0/00 Bit 1/01 ReadGap Bit 10 Bit 11
t55xx_config T55xx_Timing = {{ t55xx_config T55xx_Timing = {{
{ 29 * 8, 17 * 8, 15 * 8, 50 * 8, 0, 0, 15 * 8 }, // Default Fixed { 29 * 8, 17 * 8, 15 * 8, 50 * 8, 15 * 8, 0, 0 }, // Default Fixed
{ 31 * 8, 20 * 8, 18 * 8, 50 * 8, 0, 0, 15 * 8 }, // Long Leading Ref. { 31 * 8, 20 * 8, 18 * 8, 50 * 8, 15 * 8, 0, 0 }, // Long Leading Ref.
{ 31 * 8, 20 * 8, 18 * 8, 40 * 8, 0, 0, 15 * 8 }, // Leading 0 { 31 * 8, 20 * 8, 18 * 8, 40 * 8, 15 * 8, 0, 0 }, // Leading 0
{ 29 * 8, 17 * 8, 15 * 8, 31 * 8, 47 * 8, 63 * 8, 15 * 8 } // 1 of 4 { 29 * 8, 17 * 8, 15 * 8, 31 * 8, 15 * 8, 47 * 8, 63 * 8 } // 1 of 4
} }
}; };
@ -163,11 +163,11 @@ void printT55xxConfig(void) {
Dbprintf(" [b] writegap............%d*8 (%d)", T55xx_Timing.m[DLMode].write_gap / 8, T55xx_Timing.m[DLMode].write_gap); Dbprintf(" [b] writegap............%d*8 (%d)", T55xx_Timing.m[DLMode].write_gap / 8, T55xx_Timing.m[DLMode].write_gap);
Dbprintf(" [c] write_0.............%d*8 (%d)", T55xx_Timing.m[DLMode].write_0 / 8, T55xx_Timing.m[DLMode].write_0); Dbprintf(" [c] write_0.............%d*8 (%d)", T55xx_Timing.m[DLMode].write_0 / 8, T55xx_Timing.m[DLMode].write_0);
Dbprintf(" [d] write_1.............%d*8 (%d)", T55xx_Timing.m[DLMode].write_1 / 8, T55xx_Timing.m[DLMode].write_1); Dbprintf(" [d] write_1.............%d*8 (%d)", T55xx_Timing.m[DLMode].write_1 / 8, T55xx_Timing.m[DLMode].write_1);
Dbprintf(" [e] readgap.............%d*8 (%d)", T55xx_Timing.m[DLMode].read_gap / 8, T55xx_Timing.m[DLMode].read_gap);
if (DLMode == T55xx_DLMode_1of4) { if (DLMode == T55xx_DLMode_1of4) {
Dbprintf(" [e] write_2.............%d*8 (%d)", T55xx_Timing.m[DLMode].write_2 / 8, T55xx_Timing.m[DLMode].write_2); Dbprintf(" [f] write_2.............%d*8 (%d)", T55xx_Timing.m[DLMode].write_2 / 8, T55xx_Timing.m[DLMode].write_2);
Dbprintf(" [f] write_3.............%d*8 (%d)", T55xx_Timing.m[DLMode].write_3 / 8, T55xx_Timing.m[DLMode].write_3); Dbprintf(" [g] write_3.............%d*8 (%d)", T55xx_Timing.m[DLMode].write_3 / 8, T55xx_Timing.m[DLMode].write_3);
} }
Dbprintf(" [g] readgap.............%d*8 (%d)", T55xx_Timing.m[DLMode].read_gap / 8, T55xx_Timing.m[DLMode].read_gap);
} }
} }
@ -213,21 +213,17 @@ void setT55xxConfig(uint8_t arg0, t55xx_config *c) {
return; return;
} }
// if ( ClearT55Settings) // dont copy over new timings
memcpy(buf, &T55xx_Timing, T55XX_CONFIG_LEN); memcpy(buf, &T55xx_Timing, T55XX_CONFIG_LEN);
Flash_CheckBusy(BUSY_TIMEOUT); Flash_CheckBusy(BUSY_TIMEOUT);
Flash_WriteEnable(); Flash_WriteEnable();
Flash_Erase4k(3, 0xD); Flash_Erase4k(3, 0xD);
// if not a settings erase, write data
// if ( ClearT55Settings) {
res = Flash_Write(T55XX_CONFIG_OFFSET, buf, T55XX_CONFIG_LEN); res = Flash_Write(T55XX_CONFIG_OFFSET, buf, T55XX_CONFIG_LEN);
if (res == T55XX_CONFIG_LEN && DBGLEVEL > 1) { if (res == T55XX_CONFIG_LEN && DBGLEVEL > 1) {
DbpString("T55XX Config save success"); DbpString("T55XX Config save success");
} }
// }
BigBuf_free(); BigBuf_free();
#endif #endif
@ -1484,6 +1480,7 @@ void TurnReadLF_off(uint32_t delay) {
// Macro for code readability // Macro for code readability
#define BitStream_Byte(X) ((X) >> 3) #define BitStream_Byte(X) ((X) >> 3)
#define BitStream_Bit(X) ((X) & 7) #define BitStream_Bit(X) ((X) & 7)
#define t55_llr_ref (136 * 8)
#define t55_send_PwdMode (arg & 0x01) #define t55_send_PwdMode (arg & 0x01)
#define t55_send_Page ((arg & 0x02) >> 1) #define t55_send_Page ((arg & 0x02) >> 1)
#define t55_send_TestMode ((arg & 0x04) >> 2) #define t55_send_TestMode ((arg & 0x04) >> 2)
@ -1510,7 +1507,7 @@ void T55xxWriteBit(uint8_t bit, uint8_t downlink_idx) {
TurnReadLFOn(T55xx_Timing.m[downlink_idx].write_3); TurnReadLFOn(T55xx_Timing.m[downlink_idx].write_3);
break; // Send bits 11 (1 of 4) break; // Send bits 11 (1 of 4)
case 4 : case 4 :
TurnReadLFOn(T55xx_Timing.m[downlink_idx].write_0 + (136 * 8)); TurnReadLFOn(T55xx_Timing.m[downlink_idx].write_0 + t55_llr_ref);
break; // Send Long Leading Reference break; // Send Long Leading Reference
} }

View file

@ -254,9 +254,9 @@ static int usage_lf_deviceconfig() {
PrintAndLogEx(NORMAL, " b <8..255> - Set write gap"); PrintAndLogEx(NORMAL, " b <8..255> - Set write gap");
PrintAndLogEx(NORMAL, " c <8..255> - Set write ZERO gap"); PrintAndLogEx(NORMAL, " c <8..255> - Set write ZERO gap");
PrintAndLogEx(NORMAL, " d <8..255> - Set write ONE gap"); PrintAndLogEx(NORMAL, " d <8..255> - Set write ONE gap");
PrintAndLogEx(NORMAL, " e <8..255> - Set write TWO gap (1 of 4 only)"); PrintAndLogEx(NORMAL, " e <8..255> - Set read gap");
PrintAndLogEx(NORMAL, " f <8..255> - Set write THREE gap (1 of 4 only)"); PrintAndLogEx(NORMAL, " f <8..255> - Set write TWO gap (1 of 4 only)");
PrintAndLogEx(NORMAL, " g <8..255> - Set read gap"); PrintAndLogEx(NORMAL, " g <8..255> - Set write THREE gap (1 of 4 only)");
PrintAndLogEx(NORMAL, " p - persist to flashmemory"); PrintAndLogEx(NORMAL, " p - persist to flashmemory");
PrintAndLogEx(NORMAL, " r <mode> - downlink encoding '0' fixed bit length (default), '1' long leading ref."); PrintAndLogEx(NORMAL, " r <mode> - downlink encoding '0' fixed bit length (default), '1' long leading ref.");
PrintAndLogEx(NORMAL, " '2' leading zero, '3' 1 of 4 coding ref."); PrintAndLogEx(NORMAL, " '2' leading zero, '3' 1 of 4 coding ref.");
@ -2572,15 +2572,15 @@ static int CmdT55xxSetDeviceConfig(const char *Cmd) {
cmdp += 2; cmdp += 2;
break; break;
case 'e': case 'e':
errors |= param_getdec(Cmd, cmdp + 1, &write2); errors |= param_getdec(Cmd, cmdp + 1, &readgap);
cmdp += 2; cmdp += 2;
break; break;
case 'f': case 'f':
errors |= param_getdec(Cmd, cmdp + 1, &write3); errors |= param_getdec(Cmd, cmdp + 1, &write2);
cmdp += 2; cmdp += 2;
break; break;
case 'g': case 'g':
errors |= param_getdec(Cmd, cmdp + 1, &readgap); errors |= param_getdec(Cmd, cmdp + 1, &write3);
cmdp += 2; cmdp += 2;
break; break;
case 'r': case 'r':
@ -2606,9 +2606,7 @@ static int CmdT55xxSetDeviceConfig(const char *Cmd) {
//Validations //Validations
if (errors || cmdp == 0) return usage_lf_deviceconfig(); if (errors || cmdp == 0) return usage_lf_deviceconfig();
// printf ("DLmode %d\n",downlink_mode);
t55xx_config conf = {0}; t55xx_config conf = {0};
// printf ("Size conf %lld\n",sizeof(conf));
if (erase) { if (erase) {
memset (&conf,0xff, sizeof(conf)); memset (&conf,0xff, sizeof(conf));
printf ("Conf.m[0] %x\n",conf.m[0].start_gap); printf ("Conf.m[0] %x\n",conf.m[0].start_gap);
@ -2619,9 +2617,9 @@ static int CmdT55xxSetDeviceConfig(const char *Cmd) {
conf.m[downlink_mode].write_gap = writegap * 8; conf.m[downlink_mode].write_gap = writegap * 8;
conf.m[downlink_mode].write_0 = write0 * 8; conf.m[downlink_mode].write_0 = write0 * 8;
conf.m[downlink_mode].write_1 = write1 * 8; conf.m[downlink_mode].write_1 = write1 * 8;
conf.m[downlink_mode].read_gap = readgap * 8;
conf.m[downlink_mode].write_2 = write2 * 8; conf.m[downlink_mode].write_2 = write2 * 8;
conf.m[downlink_mode].write_3 = write3 * 8; conf.m[downlink_mode].write_3 = write3 * 8;
conf.m[downlink_mode].read_gap = readgap * 8;
} }
clearCommandBuffer(); clearCommandBuffer();
SendCommandOLD(CMD_SET_LF_T55XX_CONFIG, shall_persist, 0, 0, &conf, sizeof(t55xx_config)); SendCommandOLD(CMD_SET_LF_T55XX_CONFIG, shall_persist, 0, 0, &conf, sizeof(t55xx_config));

View file

@ -5,6 +5,9 @@ pm3 --> mem load f default_keys m
pm3 --> mem load f default_pwd t pm3 --> mem load f default_pwd t
pm3 --> mem load f default_iclass_keys i pm3 --> mem load f default_iclass_keys i
pm3 --> lf t55xx deviceconfig a 29 b 17 c 15 d 47 e 15 p pm3 --> lf t55xx deviceconfig a 29 b 17 c 15 d 47 e 15 p
pm3 --> lf t55xx deviceconfig r 1 a 31 b 20 c 18 d 50 e 15 p
pm3 --> lf t55xx deviceconfig r 2 a 31 b 20 c 18 d 40 e 15 p
pm3 --> lf t55xx deviceconfig r 3 a 29 b 17 c 15 d 31 e 15 f 47 g 63 p
``` ```
### Verify sim module firmware version ### Verify sim module firmware version

View file

@ -135,9 +135,10 @@ typedef struct {
uint16_t write_gap ; uint16_t write_gap ;
uint16_t write_0 ; uint16_t write_0 ;
uint16_t write_1 ; uint16_t write_1 ;
uint16_t read_gap ;
uint16_t write_2 ; uint16_t write_2 ;
uint16_t write_3 ; uint16_t write_3 ;
uint16_t read_gap ;
} t55xx_config_t; } t55xx_config_t;
// This setup will allow for the 4 downlink modes "m" as well as other items if needed. // This setup will allow for the 4 downlink modes "m" as well as other items if needed.
// Given the one struct we can then read/write to flash/client in one go. // Given the one struct we can then read/write to flash/client in one go.