summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhenryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2008-03-14 21:04:22 +0000
committerhenryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2008-03-14 21:04:22 +0000
commit8ad8a1ea8800ea4cc6a2c74b24ce8bf867d8a906 (patch)
tree0e0297429a3a15d4e954e1892b678b08f586fc5b
parent245b3c8a6519eb11e7b907dd2d0f990e929bc4f7 (diff)
Another 36 carrier cycles (is not fully correct though)
git-svn-id: https://svn.openpcd.org:2342/trunk@456 6dc7ffe9-61d6-0310-9af1-9938baff3ed1
-rw-r--r--openpicc/application/tc_recv.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/openpicc/application/tc_recv.c b/openpicc/application/tc_recv.c
index fa6b510..b8d7234 100644
--- a/openpicc/application/tc_recv.c
+++ b/openpicc/application/tc_recv.c
@@ -70,7 +70,19 @@ fiq_buffer_t *tc_sniffer_next_buffer_for_fiq = 0;
iso14443_frame rx_frames[TC_RECV_NUMBER_OF_FRAME_BUFFERS];
-#define REAL_FRAME_END 333
+/* The standard defines EOF as a logical 0 followed by 128 carrier cycles without modulation.
+ * That means that the frame end is either 20+128+128 carrier cycles after the end of the
+ * last modulation (if there was a 1 bit before the EOF) or 20+64+128 carrier cycles after
+ * the last modulation. So the correct REAL_FRAME_END setting would be something like
+ * 276. However, we can detect that the last bit period (that without modulation) is not a
+ * valid bit much earlier: if the last data bit was 1 there are (ca.) 20 cycles till the start
+ * of the EOF. Then there are 128 cycles without modulation. The next bit (were it not part of
+ * the EOF) would have to be either sequence X (for a 1 bit) or sequence Z (for a 0 bit):
+ * If it were a 0 bit there would be modulation right away, if it were a 1 bit there would be
+ * modulation after 64 cycles. So the maximum valid time without modulation that is not signalling
+ * and EOF is 20+128+64. Define REAL_FRAME_END as that value (plus 20 cycles error margin).
+ */
+#define REAL_FRAME_END (20+128+64+20)
static int tc_recv_buffer_overruns = 0;
personal git repositories of Harald Welte. Your mileage may vary