1
|
PICCSIM design
|
2
|
|
3
|
ISO14443 anticollision:
|
4
|
- Configure TC
|
5
|
- to reset TC2 on every falling edge
|
6
|
- to use FORCE_FAST for TC IRQ
|
7
|
- to enable TC2 ETRGS
|
8
|
- CARRIER_DIV is switched to 212kHz / 424kHz
|
9
|
- this results in SSC Rx is 4x (2x?) oversampling
|
10
|
- Set SSC Rx start condition to 4x/2x SOF pattern
|
11
|
- upon reception of first falling edge, we
|
12
|
- end up in TC FIQ
|
13
|
- read out TC0 current value
|
14
|
- reconfigure TC0 RA/RB to be in-phase with previously-read TC0
|
15
|
value (subtracting some fixed offset depending on FIQ latency)
|
16
|
- reconfigure TC2
|
17
|
- to use external event on every rising edge
|
18
|
- to reset(trigger) on every external event
|
19
|
- to clear TIOA2 on RC compare (RC is high)
|
20
|
- to set TIOA2 on RA compare (RA set later)
|
21
|
- disable TC2 IRQ (and FIQ FAST_FORCE)
|
22
|
- Wait for SSC Rx Interrupt (DMA complete, or PIO)
|
23
|
- Read and decode single 32bit word
|
24
|
- determine whether it is REQA or WUPA
|
25
|
- abort if not, start over
|
26
|
- depending on last bit 0/1, configure TC2 RA (FDT)
|
27
|
- recconfig TC0 to produce 1.6MHz CARRIER_DIV clock for SSC Tx
|
28
|
- make sure this is done synchronously
|
29
|
-
|
30
|
- set up SSC Tx
|
31
|
- DMA with pre-encoded (and user-configured) ATQA
|
32
|
- start Tx at a rising edge of TF (asserted by TC2 RA)
|
33
|
- Send Interrupt once TX DMA is done
|
34
|
- Once TC2 RA compare happens, the rising edge of TIOA2 will trigger SSC
|
35
|
- Wait for SSC Tx DMA to finish
|
36
|
- Repeat similar steps for ANTICOL/SELECT command, differences:
|
37
|
- single-byte compare after frame Rx is not sufficient
|
38
|
- evaluate number of valid bits ASAP
|
39
|
- we might receive and transmit split frame at non-byte-boundaries
|
40
|
- just shift a prepared ANTICOL/Select response
|
41
|
- make sure parity is handled correctly!
|
42
|
- Once we've completed the select, we go on with normal
|