You are on page 1of 15

EM MICROELECTRONIC - MARIN SA

AppNote 407
Application Note 407
Title:
EM4170 Application Note
Product Family: RFID

Part Number: EM4170


Keywords: 125KHz Crypto Read/Write. Contactless Identification Device
Date: 25 September 2002

TABLE OF CONTENT

1 Introduction....................................................................................................................................................................... 2
2 General Operation ............................................................................................................................................................ 2
3 Internal structure............................................................................................................................................................... 4
3.1 Memory organization ................................................................................................................................................. 5
4 Authentication Procedure ................................................................................................................................................. 6
4.1 Timing........................................................................................................................................................................ 7
5 Communication details ..................................................................................................................................................... 8
5.1 Status information...................................................................................................................................................... 8
5.2 Standby Mode ........................................................................................................................................................... 9
5.3 Receive Mode............................................................................................................................................................ 9
5.4 Command Set............................................................................................................................................................ 9
6 Software implementation .................................................................................................................................................. 9
6.1 Reading Listen Windows ........................................................................................................................................... 9
6.2 Synchronization to send the first “0” ........................................................................................................................ 11
6.3 Sending data to the transponder ............................................................................................................................. 11
6.4 Synchronizing to the header.................................................................................................................................... 13
6.5 Reading data from the transponder ......................................................................................................................... 13
7 Programming the E²PROM............................................................................................................................................. 14
8 Appendix......................................................................................................................................................................... 15

Copyright  2001, EM Microelectronic-Marin SA 1 www.emmicroelectronic.com


AppNote 407
1 Introduction 2 General Operation
The EM4170 is a chip to be used in a high security The transponder is interfaced with the base station via the
identification system. Connected to a single coil and magnetic coupling of two coils. Both coils are acting as a
packed into housing (glass tube, plastic brick or other) it transformer with a very large air gap. The air gap is in
represents a complete transponder which can be read, typical applications that large that the coupling factor of
written or authenticated by a base station via magnetic both coils is below 5%.
coupling. Due to the high integration level and the low The base station applies a 125kHz square wave signal to
power consumption the coil is the only external its antenna coil which is connected with a capacitor to a
component which is necessary. series resonance circuit to increase the coil current and
The EM4170 is designed to work with a carrier frequency filter the harmonics of the square wave signal. The quality
of 115kHz to 135kHz. Due to the bit period of 32 carrier factor of this series resonance circuit is usually in the
frequency cycles the data rate is about 3.9k Baud, range of 10 to 15, limited by the tolerance of the electronic
allowing a full authentication at 125kHz within 38ms. components and the data rate of the transponder.
The chip contains a 96 bit secret key for authentication, a This base station coil current induces an alternating
32 bit identification and 94 bit of user memory plus two voltage in the transponder coil. To increase this voltage
lock bits. A 32 bit password is incorporated to change the transponder coil is connected to an on-chip capacitor
security sensitive settings. which forms a parallel resonant circuit. The coil voltage is
Due to the large temperature range and the on chip crypto rectified on the chip and supplies the circuit.
algorithm the typical application for the EM4170 is the The writing from transponder to base station (reading the
automotive immobilizer or other high security applications transponder) is done by modulating the quality factor of
like access control. the transponder parallel resonant circuit. Due to the
A bief summary of the chip is given below: magnetic coupling of both coils this quality factor change
can be seen as voltage variation at the base station
antenna coil.
• On chip crypt algorithm The writing from the base station to the transponder is
• Two way authentication, no scanning possible done by disrupting the carrier signal for a short period of
• 96 bit of secret-key without direct read access in time so that the transponder can “survive” due to its
E²PROM supply voltage capacitor. The disruption must be
synchronized with the transponder clock. To achieve this
• 32 bit of manufacturer programmed identification the transponder is modulating the carrier signal with a so
• 30 bit + 64 bit of user memory called listen window.
• 2 lock bit to inhibit programming
• 32 bit pass word to unlock the lock bits
• Data transmission performed by amplitude modulation
• -40°C to +85°C temperature range
• Typical 125kHz carrier frequency
• On chip capacitor : 200pF (Adapted external coil of
8.1mH @ 125KHz)

Copyright  2001, EM Microelectronic-Marin SA 2 www.emmicroelectronic.com


AppNote 407

5V

3
6
DVDD
VDD
to µC
Coil1 2 12
ANT1 OUT
11
IN from µC
EM4170
V4170 4
CLK
10
from µC
ANT2
Coil2
Reader EC
16

7
DEMOD_IN IC 9
CDEC_IN

CAGND
8
CDEC_OUT

DVSS

CDC
VSS

CF
GND

13

15
14
5
1
GND GND GND GND

Downlink from Txp Uplink to Txp

Signal at the Transponder coil

Signal at the Transceiv er coil

Figure 1: General system principle

Copyright  2001, EM Microelectronic-Marin SA 3 www.emmicroelectronic.com


AppNote 407
3 Internal structure The second block is the data extractor where the
modulation of the carrier is compared and digitized. This
The EM4170 incorporates a full transponder circuit data extractor is feeding the command decoder (during
except the coil on a single chip. The two coil terminals the first bits of the message) as well as the E²PROM and
are internally connected with a capacitor to achieve a the Crypto-Algorithm depending on the sent command.
parallel resonant circuit. The alternating voltage over this
circuit is rectified by a full wave diode bridge and supplies A block which is using the coil interface as output is the
the rest of the circuit. Another on chip capacitor is used to modulator which modulates the quality factor of the
buffer this supply voltage during the modulation of the resonant circuit by clipping the coil voltage. This
carrier frequency. modulator is fed by the encoder which translates the
serial NRZ data from the crypto-algorithm or the E²PROM
Two other blocks are using the coil interface as input: into Manchester coded data.
The clock extractor is generating the clock for all chip
logic derived from the 125kHz carrier signal. There is no The power control block supervises the supply voltage
internal oscillator on the chip, all timings are derived from and generates a power on reset for a rising slope of the
the alternating voltage at the coil. This makes a larger supply voltage.
tolerance for the carrier frequency possible which is The control logic finally is the central state machine for all
usually the case for PLL based reader circuits. As there is logic operations of the transponder chip.
no clock during the modulation of the carrier the “off” time
of the carrier has to be measured by a monoflop.

Modulator Encoder Serial Data

external Antenna
VDD

Resonance AC/DC Storage Power


Capacitor Converter Capacitor Control

VSS
Reset

Clock Sequencer
Extractor

Control E²PROM Crypto-


Logic Algorithm

Data Command
Extractor Decoder

Figure 2: Bloc schematic

Copyright  2001, EM Microelectronic-Marin SA 4 www.emmicroelectronic.com


AppNote 407
3.1 Memory organization The following two words are filled with the 32 bit
The memory of the EM4170 is organized in 16 bit words. identification. This memory is programmed during the
production of the chip with a unique number. It can not be
Starting with word 15 the first four words are reserved for rewritten and is read-only.
the 64 bit user memory 2. It can be read anytime and
written dependent on the lock bits. The last two word are filled with the 30 bit user memory 1
and two lock bit. The user memory 1 can be treated like
The next two words are reserved for the 32 bit password. the user memory 2. The lock bits control the protection of
It is used to reset the lock bits in case the memory was this memory as well .
locked and shall be rewritten. The password can be
written if it is unlocked. To delock the all memory send the password command.
For more information, see EM4170 datasheet.
The crypt key consists of 6 words which is 96 bit. This
memory can be written several times, if not locked, but All in all the EM4170 contains 256 bit of memory. 94 bit of
can never be read. It is used as input for the it can be used to store any data.
cryptographic algorithm.

Word 15 User2 63 User2 48

User2 47 User2 32
Read and Write
User2 31 User2 16
User2 15 User2 00
Password 31 Password 16
Password 15 Password 00

Crypt Key 95 Crypt Key 80


Crypt Key 79 Crypt Key 64 Write only
while LB0, LB1
Crypt Key 63 Crypt Key 48 are not set

Crypt Key 47 Crypt Key 32

Crypt Key 31 Crypt Key 16


Crypt Key 15 Crypt Key 00
Identification 31 Identification 16 Read only
programed during
Identification 15 Identification 00 production of Txp
Lock Bit 1, Lock Bit 0, User1 29 User1 16
Read and Write
Word 0 User1 15 User1 00

Figure 3 : Memory organization

Copyright  2001, EM Microelectronic-Marin SA 5 www.emmicroelectronic.com


AppNote 407
4 Authentication Procedure The next step is the transmission of the first result of the
crypto algorithm which has the random number and the
The release procedure is based on a principle called secret key as input.
mutual authentification. This means that both, the reader
and the transponder, have to authenticate against each Only if both numbers correlate the transponder answers
other. by sending a second result of the crypto algorithm which
has the first result and the secret key as input. Due to the
Due to this double authentication it is not possible to scan fact that the first result has the random number as input
the transponder as there will be no answer from the also the second result is dependent from the random
transponder unless the reader has proven its correctness number.
by a first authentication.
This last result can be compared by the base station with
The communication starts with the base station which the calculated result of the crypto algorithm and perform
sends a random number to the transponder. This random the necessary actions.
number guarantees that every communication is unique
and that capturing a communication makes no sense. The word length of random number and the results is
adapted to their susceptibility of being reverse calculated
or tested out.

Base station Transponder

Rnd
Crypt Key Random Crypt Key
56 Bit

f f

f(Rnd,K)
f(Rnd,K) f(Rnd,K)
28 Bit

=?
g
no action

g
g(Rnd,f,K)
no action

g(Rnd,f,K)
=? g(Rnd,f,K)
20 Bit

o.k.

Figure 4: Release procedure

Copyright  2001, EM Microelectronic-Marin SA 6 www.emmicroelectronic.com


AppNote 407
4.1 Timing different from transponder to transponder and more than
The procedure to authenticate a transponder starts with one transponder is in the key table.
enabling the reader circuit. In this example it takes about With the next command “authenticate” the authentication
30ms before the demodulation chain has reached a is prepared. Following the command, the random number
stable operation point. This depends on the used and the result of the first crypt algorithm output is
hardware. During this time the random number and the transferred to the transponder. The second output of the
crypt algorithm can be calculated. Although about 20ms crypt algorithm is finally sent back from the transponder.
are needed on a low end µController this time can be Excluding the analog start up which depends on the
hidden behind the analog start up time. actual hardware the full authentication of a single
After the start up time has elapsed the first command transponder without communication errors and therefore
sent to the transponder is the “read ID” command. The several attempts can be carried out within 38ms. Reading
identification could be necessary if the crypt key is the identification is optional and depends on the crypt key
strategy.

Action 0ms 10ms 20ms 30ms 40ms 50ms 60ms 70ms 80ms

Analog start up 31ms

Calculate f(rnd), g(rnd) ~20ms

Command: Read ID 6 Bit 5.4ms (3 LIWs)

Read ID 48 Bit 12.3ms

Compare ID ~2ms
Command: Authentication 6 Bit 5.4ms (3 LIWs)

Send rnd, f(rnd) 91 Bit 23.3ms

Receive g(rnd) 36 Bit 9.2ms

Compare g(rnd) ~2ms

Power on 31ms 50.7ms 90.6ms

Figure 5: Authetification timing

Copyright  2001, EM Microelectronic-Marin SA 7 www.emmicroelectronic.com


AppNote 407
5 Communication details • LIW: Listen Window - Standby Mode / Ready to
receive a new command
The transponder can process several commands to
access the internal memory and all functions. The • ACK:Acknowledge - Operation completed
communication structure for every available transponder successfully
command is identical. It starts with a status feedback sent • NAK: Not Acknowledge - Any error occurred
by the transponder.
All data bits sent from the transponder to the reader are
5.1 Status information preceded by a header instead of an ACK consisting of 12
bit “1” plus 4 bit “0” in Manchester code.
The status information consists of patterns, which are
sent by the transponder to show its internal status or the
result of an operation. These patterns are designed to be
different from any data bit sequence and can therefore
not be confused with data sent by the transponder.

LIW ACK NAK


16 16 64 32 32 16 16 48 16 48 16 16 16 48 16 32 16 16

All numbers represent number of periods of RF field

Figure 6: Status information patterns

Copyright  2001, EM Microelectronic-Marin SA 8 www.emmicroelectronic.com


AppNote 407
5.2 Standby Mode
In Standby Mode the EM4170 continuously sends Listen START
Windows to be able to receive commands from the base
station.
The transponder switches to Standby Mode when it
enters a carrier field (forced by the Power On Reset) or Read and
when any command operation is finished. Synchronize to
LIW
5.3 Receive Mode
In Receive Mode the base station sends at least a 4 bit
command to the transponder. Send
To switch from Standby Mode to Receive Mode the base RM pattern
station sends two bit “0” (RM pattern) to the transponder. + command
The beginning of the first bit “0” must be placed within the ( + data )
32 clocks of the modulated phase in a Listen Window.
The transponder stops sending Listen Windows. The
second bit ”0” turns to Receive Mode.
Synchronize
The base station continues by sending the 4 bit
command and data bits (depending on the command). to Header

5.4 Command Set


Read DATA

Command Pattern
Read ID 0011
Read UM 1 0101 STOP
Authentication 0110
Write Word 1010
Figure 7: Software structure
Send PIN 1001
For reading transponder signals the used µController
Read UM 2 1111 should be able at least to measure pulse widths or pulse
periods and to switch to the inverted measuring edge
The leftmost bit is the first received bit and the rightmost (falling / falling ↔ rising / rising) while reading. It is
one is the parity bit. recommended to use an Input Capture Timer with a
minimum resolution of 5 µs (better 0,5 - 2 µs) to
Reading a valid command (plus data bits respectively), determine the pulse lengths. The timer shall be able to
the transponder sends back data or starts an internal measure up to 848µs (96 + 10 periods) for a 125kHz
write process depending on the command. fixed frequency system as described below.
An invalid command changes back to Standby Mode. Please note that the reading software algorithms (LIW,
Data) must be able to handle non-inverted and inverted
signals from the reader demodulator output.
For sending bits to the transponder the µController
6 Software implementation should generate a fixed time cycle synchronized to the
EM4170 uplink data rate. A timer in Compare / Timer
Corresponding to the different modes explained above Mode is recommended.
the following structure for the software implementation
can be used.
6.1 Reading Listen Windows
The first step is to synchronize transponder and reader
by reading the Listen Window pattern.

Copyright  2001, EM Microelectronic-Marin SA 9 www.emmicroelectronic.com


AppNote 407
There are several methods to find a LIW on the data line If the software cannot find the pulses of 80 RF periods,
of a receiver and to synchronize to it for sending the first toggle the measuring edge as well and read again
“0”. One solution which has shown good results in many because the data line might be inverted.
applications is the following procedure: To increase security the algorithm can be repeated
The algorithm reads the following pulse periods: before sending the first “0”.
In case of times (2) and (3) being too short for the
selected µController the software can wait another one or
1. 80 ± 10 (16 + 64) more Listen Windows in between.
The explained algorithm is designed to measure pulse
2. 80 ± 10 (32 + 32 + 16)
periods from falling to falling and rising to rising edge,
3. Toggle measuring edge because in general pulse periods are more stable
compared to pulse width due to demodulation effects.
4. 96 ± 10 (64 + 32)
Algorithms measuring pulse width will work as well and
5. 64 ± 10 (32 + 16 + 16) may use less LIWs for synchronization.
(values in RF periods)

LIW n LIW n+1 LIW n+2

Transponder
coil

32

(1) Reader delay (3) Switch from READ to WRITE (4) Time to start first “0“

16 16 64 32 32 16 16 64 32 32 16 16 64 32 32

Data line
non-inverted

80 80 96 64

(2) Toggle measuring edge (5) Do not start first „0“ here

All numbers represent number of periods of RF field

Figure 8: Listen Window Algorithm

Copyright  2001, EM Microelectronic-Marin SA 10 www.emmicroelectronic.com


AppNote 407
6.2 Synchronization to send the first “0” Bit streams without “0” can desynchronize transponder
Concerning (3) and (4) please note that the demodulator and base station because of different time bases in the
normally delays signals (1) on the data line compared to µController and the transponder. The longest bit stream
the transmission on the transponder coil. Delay times without forced “0”s is the 56 bit random number. The
differ according to the reader IC and the surrounding maximum possible desynchronization which occurs at the
circuit. end of this number should be calculated to achieve
reliable operation for all random numbers.
This delay must be taken into account since the
modulation for the first “0” must start within the 32 periods Because desynchronization errors are dependant from
of modulated phase of the LIW related to the signal at the the transmitted numbers they are causing an unstable
transponder coil (4) not to the data line (5). behavior and are hard to find. They should be eliminated
upfront.
The delay can be calculated by trying the minimum and
maximum working values. There are different possibilities to stay synchronized
anyway:
During the software development phase it can be helpful
to start the first “0” in the middle (after 16 periods) of the • The random number is modified to avoid a certain
required 32 periods modulated phase in the LIW to number of following “1”s. This makes the number not
startup with a tolerant timing. truly random and cuts down the number length
effectively.
For the final application the data line delay and starting of
first “0” should be checked for all system conditions like • The reader carrier frequency is derived from the
temperature, tolerances and occurrence of interrupts etc. µController clock or vice versa. This may save a
to make sure that the modulation for the first “0” starts resonator or crystal but causes a high frequency
always within the required range. signal to be routed over the printed circuit board.
Some semiconductor manufactures do not allow to
After reading the last LIW pulse period of 64 RF clocks
fetch signals from the oscillator circuit.
the software switches from Read to Write and can start a
Timer for an interval that places the first “0” appropriately. • The carrier frequency is captured by a timer and
Then the timer interval might be set to half of a bit period multiples of this value are used to determine the
(16 RF clocks) to send bits to the transponder. correct modulation moment. The resolution of this
The second step consists of sending RM pattern, timer needs to be high enough because errors are
command and data (if required) to the transponder. accumulating. This mode is recommended for PLL
systems.
• The timer is using the carrier frequency as clock and
6.3 Sending data to the transponder the timing is therefore derived from the carrier clock.
The first bit “0” started in the LIW is the first bit of a data The transponder is doing the same and therefore the
stream sent to the transponder depending on the synchronization is maintained. This mode can also be
operated command. The data bits are sent as shown in recommended for PLL systems. The requirements for
figure 9 below. the timer are relieved in comparison to the mode
above.
One bit period corresponds to 32 RF periods.
The second half of the bit period is used by the
During the first half of a bit period the transponder
transponder to recharge its internal supply therefore the
modulates the RF field and the base station sends the bit
carrier field has be switched on.
value “0” (Modulation ON = RF field OFF) or “1”
(Modulation OFF = RF field ON). One practicable software algorithm for sending bits to the
transponder is to set a Timer to the regular interval of half
When writing a bit “0” it is recommended not to modulate
a bit period:
RF periods 1 – 4 of this bit period and then turn ON
modulation for RF periods 5 – 16 with a minimum
duration of 80µs.
In general all transponder timings are related to the RF 1. Half : Next bit “0” = Modulation ON
field considering that the transponder generates its “1” = Modulation OFF
internal clock from the RF field period. Turning
modulation ON stops the RF field and the internal clock 2. Half : Always Modulation OFF
so the absolute value of 80µs for the minimum
modulation time is derived by an transponder internal When sending a “0” the recommended 4 periods without
monoflop. modulation can be generated by program run time, for
Turning OFF the modulation for the second half of the bit example the first instructions in an interrupt service
period the transponder starts counting clocks and routine.
therefore resynchronizes to the base station.

Copyright  2001, EM Microelectronic-Marin SA 11 www.emmicroelectronic.com


AppNote 407
Bit Period

DATA „1“ „0“ „0“ „1“ „0“

Transceiver
coil

Periods RF 16 16 16 16

Modulation induced by Transponder

Recommended : 4 periods Modulation induced by Transceiver


Minimum : 1 period Minimum : 80 µs

Figure 9: Sending Data

Copyright  2001, EM Microelectronic-Marin SA 12 www.emmicroelectronic.com


AppNote 407
6.4 Synchronizing to the header
After reception of a valid command bit sequence the
transponder sends back a 16 bit header consisting of 12
x “1” + 4 x “0” and the requested data bits in Manchester
code.

Header Data

12 x „1“ 4 x „0“ „0“ „0“ „1“ „1“ „0“ „1“ „0“


1. 2. 3. 12. 1. 2. 3. 4.
16

Data line
non-inverted

16

1 1 1,5 2 Bit periods

„0“ „11“ „01“ Software


Pulse to synchronize Switch from Header
algorithm
for data Read to Data Read Toggle edge to start in bit mid

Figure 10: Header synchronization and reading data

After sending the last bit to the transponder the software 6.5 Reading data from the transponder
should switch the reader from Write to Read Mode if Data can be decoded by reading pulse periods always
necessary. During the first header bits when the reader is beginning in the middle of a bit period. One practicable
settling and the data line is unstable the software should algorithm for the non-inverted data line is described here:
not start the read timer. It is useful to run the Write Timer
some further cycles with RF field ON until data are
stable. Then the Read algorithm can be started. Measured Length Decoded Decoded Further
Changing from “1” to “0” in the header results in a pulse pulse limits bits with bits with Action
of one bit period which can be used for the software to length falling rising
synchronize for the data bits. edge edge

The 4 bits “0” of the header can be ignored by the 1 3/4 < 5/4 “0” “1” continue
software or can be read into the data buffer by the Data 1.5 5/4 < 7/4 “11” “00” toggle edge
Read algorithm. type
The signals ACK and NAK are sometimes difficult to 2 7/4 < 9/4 “10” “01” continue
read. In this case software can verify the operation by
read commands.
Starting point is the falling edge of the last header “0”
(values in bit periods)
Pulse tolerances can be set to a bit period divided by 4.
Between the highest and lowest allowed pulse length no
pulses should be excluded.
If the expected number of bits are read the algorithm is
stopped.
For inverted data line the same algorithm can be used,
only the reading edges must be inverted.
Algorithms reading pulse width will work as well but may
have an increased interrupt load and a higher
susceptibility for jittering signals.

Copyright  2001, EM Microelectronic-Marin SA 13 www.emmicroelectronic.com


AppNote 407
7 Programming the E²PROM minimum carrier field strength stated in the transponder
specification.
Writing data into the transponders E²PROM works similar
to the read or authentication commands described The second thing to have in mind is that the transponder
above. Anyway two things should be considered. must be supplied with energy during the writing process.
As shown below the carrier field has to be switched on
The current consumption of the transponder chip during during the whole writing procedure.
the writing process is increased as well as the required
minimum supply voltage. This means that the maximum The times below are calculated for a carrier frequency of
working distance between base station antenna and 125kHz.
transponder is reduced in comparison to the Due to the fact that single ACK commands are difficult to
authentication or read mode. identify it is useful to verify the new memory content by a
For that reason there is a reading distance range in read operation. If the crypt key has been changed an
which reading and authentication of the transponder authentication can verify the new key as it can not be
works fine but writing into the transponders memory is read.
not possible or unreliable. If data retention is important
the writing distance should be determined by the

Action -10ms 0ms 10ms 20ms 30ms 40ms 50ms 60ms 70ms

Command: Write Word 6 Bit 5.4ms (3 LIWs)

Adress 5 Bit 1.3ms


Data 25 Bit 6.4ms
Erase Memory 1ms
Acknowledge 1.3ms
Write Memory 24.6ms

Acknowledge 1.3ms

Start 41.3ms

Figure 11: Write Timing

Copyright  2001, EM Microelectronic-Marin SA 14 www.emmicroelectronic.com


AppNote 407
8 Appendix

For further information see also:

Datasheet
EM4095 Read/Write analog front end for 125kHz RFID
Basestation
EM Microelectronic-Marin SA, Marin, 2000

EM4095 Application Note AN404


EM Microelectronic-Marin SA, Marin, 2000

Datasheet
EM4170 Crypto Contactless Identification Device
EM Microelectronic-Marin SA, Marin, 2001

EM Microelectronic-Marin SA cannot assume responsibility for use of any circuitry described other than circuitry
entirely embodied in an EM Microelectronic-Marin SA product. EM Microelectronic-Marin SA reserves the right to
change the circuitry and specifications without notice at any time. You are strongly urged to ensure that the
information given has not been superseded by a more up-to-date version.

© EM Microelectronic-Marin SA, 09/02, Rev. B, Preliminary

Copyright  2001, EM Microelectronic-Marin SA 15 www.emmicroelectronic.com

You might also like