* Change from 40 FC to 72 FC as default delay between detecting LIW and sending the command.
* Use parity for ID, UM1, and UM2 commands
* Remove extra bit hack from AUTH, PIN, and WRITE commands
1. Rework how communications with tag occur.
a. bitstream to be sent to the tag is now fully pre-generated.
b. bits sent and received are logged with start / end times.
2. Support built-in `hw dbg` for controlling verbosity of debug output
The new bitstream generation and logging has exposed a surprising legacy behavior ... each of the command that sent additional data (beyond the command) were:
* inserting an extra RM zero bit
* force-enabling command parity is used
This was not expected. However, this PR maintains the behavior of the existing code.
TODO: Root-cause why the third RM bit is needed. Fix code to remove that hack.
TODO: change the arm/client interface to ONLY use arrays of bytes, with well-defined content endianness, to avoid this problem.
Code was previously performing arithmetic in
various loop check conditions. Integer promotion rules could cause unintended comparisons.
`spiffs` defined `fs->block_count` as `uint32_t`, but defined `spiffs_page_ix` as `uint16_t`. Various overflow checks detected by CodeQL and fixed by checking for those conditions before looping.
This was done programmatically using python.
The `lf_Keri.pm3` was in range `[-508 .. 491]` (1000 value range).
Each value was divided by four, cast to integer, and then adjusted by +1 (to center the values).
The data plot in the pm3 client now shows discernible changes in amplitude.
The resulting samples are all within range [-128,127].
This final fix allows ALL sample `.pm3` traces to be converted to one-byte-per-sample binary format.
This was done programmatically using python.
Files with a range that fell outside of [-128,127], but which would fit into that range, were offset by the noted amount to ensure the file woul now fit within range [-128,127]. This allows the trace files to be converted to one-byte-per-sample binary format, for example.
offset | filename
-----|-----
`-14` | `lf_Q5_mod-manchester.pm3`
`-14` | `lf_Q5_mod-nrz.pm3`
`-10` | `lf_Q5_mod-fsk1.pm3`
`-15` | `lf_Q5_mod-biphase.pm3`
`-9` | `lf_Q5_mod-fsk2.pm3`
Avoid generic "length" parameters, as they are often ambiguous.
Prefer `byte_count`, `element_count`, `bit_count` or more explicit names to reduce misunderstandings and thus reduce bugs.
This autorecovery test key also has three potential matches
for the last phase, thus ensuring authentication test is
required to determine which of those keys was actually used.
Also:
* common.h: Increase safety of some of the macros.
Parenthesizing the macro parameters ... a best practice.
* firmware: partially-tracked source of "extra bits" messages.
Add a TODO comment for further study.
* Improve reliability of `lf em 4x70 writekey`
Authenticate w/new key after it is written.
Particularly important for glass modules,
or other tags with weaker coupling.
* Add `.ramfunc` section to bootrom loader script
* exclude spiffs functionality from flashmem.h/flashmem.c
(allows bootrom to use flashmem)
* hide unused tick.h / flashmem.h functions from bootrom
(not technically necessary; see comments)
* bootrom: add source files, include path, and defines when
`PLATFORM_DEFS` defines `WITH_FLASH`
* Define `AS_BOOTROM` to indicate code is building for bootrom
Also allow flash to be separately enabled via PLATFORM_EXTRAS.
NOTE: this does *NOT* enable the serial number
in the bootrom. Still investigating options there.