ST AN4125 APPLICATION NOTE

AN4125
-36
3$!
3#,
!PPLICATIONMASTER
!PPLICATIONBOARD
)£#BUS
)£#BUS
)3/2&)3/2&
.-3YY&@3
Application note
How to manage simultaneous I²C and RF
data transfers with the M24LRxxE-R
Introduction
The M24LRxxE_R is an EEPROM device designed to be accessed via two different interfaces: a wired I²C interface and a standard contactless ISO 15693 RFID interface.
ST has published various supporting application notes explaining how the RF interface works and the basic principles of passive RFID technology. These documents are available from: www.st.com/dualeeprom.
The possibility of using two different interfaces to control the dual-interface EEPROM implies two host controllers: a microcontroller with an I²C bus and an ISO 15693 RFID reader. Due to their nature, these two host controllers are not synchronized, which means that both controllers might try to access the M24LRxxE_R concurrently.
To manage this kind of situation, the M24LRxxE_R has a built-in circuitry able to handle possible concurrent communications and powering activities from the RF and I²C sides.
This application note describes how the M24LRxxE_R arbitration circuitry operates. It applies to the products listed in Tab le 1 .

Table 1. Applicable products

Type Part numbers
Memory products M24LR04E-R, M24LR16E-R, M24LR64E-R
June 2012 Doc ID 023297 Rev 1 1/15
www.st.com
Contents AN4125
Contents
1 RF - I²C arbitration mechanism description . . . . . . . . . . . . . . . . . . . . . . 5
1.1 Communications and power supply conditions . . . . . . . . . . . . . . . . . . . . . 5
1.2 Communication arbitration when the RF and I²C channels are
both active . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.1 I²C busy states . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.2 RF busy states . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.3 Arbitration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2 Recommendations when developing the
M24LRxxE_R application software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.1 Issuing a command through the I²C channel . . . . . . . . . . . . . . . . . . . . . . . 9
2.1.1 I²C request while the RF channel is busy . . . . . . . . . . . . . . . . . . . . . . . . 9
2.1.2 I²C requests and RF time slots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.1.3 An I²C request was interrupted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.2 Issuing a command through the RF channel . . . . . . . . . . . . . . . . . . . . . . 13
3 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2/15 Doc ID 023297 Rev 1
AN4125 List of tables
List of tables
Table 1. Applicable products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Table 2. Four possible combinations of power supply sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Table 3. Possible cases of communication arbitration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Table 4. M24LRxxE_R status according to command and V
Table 5. Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
supply . . . . . . . . . . . . . . . . . . . . . . 13
CC
Doc ID 023297 Rev 1 3/15
List of figures AN4125
List of figures
Figure 1. Typical application of an M24LRxxE_R dual interface EEPROM . . . . . . . . . . . . . . . . . . . . . 1
Figure 2. I²C read command busy state. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Figure 3. I²C write command busy state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Figure 4. RF read command busy state. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Figure 5. RF write command busy state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Figure 6. RF Stay Quiet command busy state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Figure 7. Example of an Inventory command where the M24LRxxE_R is decoded in
Slot 13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Figure 8. I²C polling when the RF channel is processing a command . . . . . . . . . . . . . . . . . . . . . . . . . 9
Figure 9. M24LRxxE_R state transition diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Figure 10. Optimal hardware schematic of an M24LRxxE_R application . . . . . . . . . . . . . . . . . . . . . . 12
4/15 Doc ID 023297 Rev 1
AN4125 RF - I²C arbitration mechanism description

1 RF - I²C arbitration mechanism description

The M24LRxxE_R arbitration circuitry is twofold. It contains:
a power management unit that handles the power coming potentially from the RF or the
I²C side
a communication arbitration unit that tackles potential concurrent communications from
the RF and the I²C sides

1.1 Communications and power supply conditions

The power supply management unit has been designed to allow for flexibility, especially
when both the RF power and the wired power line are active at the same time.
The basic principle is:
When supplied only from the RF side:
the M24LRxxE_R can be accessed only by the RF reader
When supplied from both the V
the M24LRxxE_R will serve the first decoded command (either RF or I²C) and will
not decode any command from the other interface (either I²C or RF) until the first decoded command is complete.

Table 2. Four possible combinations of power supply sources

pin and the RF field:
CC
Possible
cases
Case 1
Case 2
Case 3 On
Case 4 On
1. VCC is “On” when the value is between VCCmin and VCCmax. Please refer to the M24LRxxE_R datasheet for full details.
V
CC
0 V or not
connected
0 V or not
connected
(1)
(1)
RF field Actions
Off The M24LRxxE_R is reset.
On
On
Off
RF data transfers: yes I²C data transfers: no
RF data transfers: yes I²C data transfers: yes (see Section 1.2: Communication
arbitration when the RF and I²C channels are both active for details).
RF data transfers: no I²C data transfers: yes
Doc ID 023297 Rev 1 5/15
RF - I²C arbitration mechanism description AN4125
SOF Request EOF
RF busy
ai17341
ResponseSOF EOF

1.2 Communication arbitration when the RF and I²C channels are both active

Arbitration depends on whether the I²C and RF channels are in the busy state. Section 1.2.1 and Section 1.2.2 give the definitions of the I²C and RF busy states, respectively.

1.2.1 I²C busy states

When decoding an I²C read command, the M24LRxxE_R is in the I²C busy state from the Start condition until the Stop condition.
Figure 2. I²C read command busy state
Start Read command Stop
I²C busy
ai17339
When decoding an I²C write command, the M24LRxxE_R is in the I²C busy state from the Start condition until the completion of the write cycle (triggered by the Stop condition).
Figure 3. I²C write command busy state

1.2.2 RF busy states

In most cases, an RF command is defined as a received request initiated by the SOF (start of frame) and terminated by the decoding of the EOF (end of frame) of the response frame.
RF commands can be gathered into several groups:
Read command group
When decoding an RF read command, the M24LRxxE_R is in the RF busy state from the SOF (start of frame) of the request frame until the EOF (end of frame) of the response frame. The figure below shows the RF busy state of commands in the read group.
Figure 4. RF read command busy state
Start Write command Stop
I²C busy
Write cycle
ai17340
6/15 Doc ID 023297 Rev 1
AN4125 RF - I²C arbitration mechanism description
SOF Request EOF
RF busy
ai17504
Commands in the RF read command group are:
Read Block, Fast Read Single Block, Read Multiple Blocks, Fast Read Multiple Blocks
Get System Info
Select
Reset to Ready
Get Multiple Block Security Status
Initiate, Fast Initiate
Inventory Initiated
Write command group
When decoding an RF write command, the M24LRxxE_R is in the RF busy state from the SOF (start of frame) of the request frame until the EOF (end of frame) of the response frame. Write commands include a write cycle t of commands in the write group.
Figure 5. RF write command busy state
. The figure below shows the RF busy state
W
SOF Request EOF
W
RF busy
ResponseSOF EOFWrite cycle t
ai17503
Commands in the RF write command group are:
Write Block
Write AFI, Lock AFI
Write DSFID, Lock DSFID
Write-sector Password, Lock-sector Password, Present-sector Password
Stay Quiet command
The Stay Quiet command is the only command defined as a single request frame (not followed by a response frame). The M24LRxxE_R is in the RF busy state during the whole [SOF …. EOF] sequence as shown in the figure below.
Figure 6. RF Stay Quiet command busy state
Inventory command
An Inventory command is used when several M24LRxxE_R devices are inside the range of the same RF electromagnetic field.
When the Inventory command scans 16 slots, the M24LRxxE_R is in the RF busy state from the SOF (start of frame) of the request frame until the EOF (end of frame) of the response frame.
Note: The addressed M24LRxxE_R device might stay a long time in the RF busy state if it is
decoded during the last (16
th
) time slot.
Doc ID 023297 Rev 1 7/15
RF - I²C arbitration mechanism description AN4125
SOF Request EOF
RF busy
ai17505
EOF EOF Response EOF
Slot 1 Slots 2 to 12 Slot 13
Figure 7. Example of an Inventory command where the M24LRxxE_R is decoded in
Slot 13

1.2.3 Arbitration

When both interfaces are active (as defined in Case 3 in Table 2: Four possible
combinations of power supply sources1), the M24LRxxE_R decodes and executes the first
received command, as detailed in Table 3: Possible cases of communication arbitration.
Table 3. Possible cases of communication arbitration
Initial state Event
M24LRxxE_R is in the I²C busy state: VCC active and an I²C command is being decoded or executed
M24LRxxE_R is in the RF busy state: an RF command is being decoded or executed
RF command transmitted during an I²C command
active and I²C command
V
CC
transmitted during an RF command
M24LRxxE_R
action
RF command is not decoded
I²C command is not decoded
8/15 Doc ID 023297 Rev 1

AN4125 Recommendations when developing the M24LRxxE_R application software

-36
2&COMMAND
INPROGRESS
3TARTCONDITION
$EVICESELECT
WITH27
!#+
RETURNED
9%3
./
$ATAFORTHE
7RITEOPERATION
$EVICESELECT
WITH27
3ENDADDRESS
ANDRECEIVE!#+
&IRSTBYTEOFTHE )£#COMMAND WITH27BITIS NOWDECODEDBYTHE
-,2XX%2
9%3./
3TART
CONDITION
#ONTINUETHE
7RITEOPERATION
#ONTINUETHE
2ANDOM2EADOPERATION
2 Recommendations when developing the
M24LRxxE_R application software
The application software has to take into account that a command might not be executed if the other channel (I²C or RF) is already processing a command. The application software should therefore check the M24LRxxE_R busy status before sending a command.

2.1 Issuing a command through the I²C channel

2.1.1 I²C request while the RF channel is busy

If the M24LRxxE_R is processing a command from the RF channel, no command issued on the I²C bus will be executed, therefore none of the bytes transmitted on the I²C bus will be acknowledged (NoAck). This information can be considered as the RF busy state application’s I²C software should include a polling loop on the RF busy state (with a timeout limit) when issuing a command on the I²C bus. In this way, the I²C command can be completed once the RF command under process has completed.
Figure 8. I²C polling when the RF channel is processing a command
(a)
and the
a. In the same way as during an internal write cycle, the M24LRxxE_R is “busy” during tW (please refer to the
M24LRxxE_R datasheet for more details about the polling loop during t
Doc ID 023297 Rev 1 9/15
).
W
Recommendations when developing the M24LRxxE_R application software AN4125
Important
It is paramount to exactly carry out the I²C polling sequence described in Figure 8 in order to keep the M24LRxxE_R in a constant I²C busy state.
Right method: once the device select is acknowledged, the I²C command starts
executing until full completion, that is, until the transmission of the Stop condition which ends the command (or at the end of the write cycle t
Wrong method: looping on the device select until it is acknowledged, sending a Stop
, for a write command).
W
condition and then initiating a new I²C command: this is inadequate as an RF request might have been served between [Ack] and the new I²C command (time slot during which the M24LRxxE_R is not in the I²C busy state.
Note: If the application is disturbed by too great a number of decoded RF commands, it might be
convenient that the I²C bus master prompts the application to stop RF requests so that the I²C bus can access the M24LRxxE_R.

2.1.2 I²C requests and RF time slots

Application software management
In most cases, the application fully controls the I²C bus. On the other hand, it cannot always predict RF commands. To have a robust application, the M24LRxxE_R should be fullly controlled through the I²C bus, that is, the application master has to:
1. determine when the I²C commands have to be transmitted
2. determine the time slots during which RF transfers may be processed
The reason for this is that RF commands might not be properly transmitted (for example, if the M24LRxxE_R leaves the RF field). The I²C bus Master has to prevent this from happening by applying the following rules:
The Master determines when the I²C commands have to be transmitted
The Master delivers the supply voltage (through one of its I/Os) to the M24LRxxE_R’s V
pin only when an I²C data transfer is under way
CC
The Master determines the RF time slots
The Master stops supplying (I/O in HiZ) the M24LRxxE_R through its V
pin upon
CC
completion of the I²C data transfer. RF transfers are processed more safely when the V
pin is not supplied, because:
CC
If the decoded RF command is correct, it is executed (no need to supply power
through the V
CC
pin)
If the RF command is truncated (M24LRxxE_R is outside the RF field), the
M24LRxxE_R is reset (Power-off state, see Figure 9).
10/15 Doc ID 023297 Rev 1
AN4125 Recommendations when developing the M24LRxxE_R application software
AI06681b
Power-off
In field
Out of field
Ready
Quiet
Selected
Any other Command
where Select_Flag
is not set
Stay quiet(UID)
Select (UID)
Any other command
Any other command where the
Address_Flag is set AND
where Inventory_Flag is not set
Stay quiet(UID)
Select
(UID)
Reset to ready where
Select_Flag
is set or
Select(different
UID)
Reset to ready
Out of RF field after t
RF_OFF
Out of RF field after t
RF_OFF
after t
RF_OFF
Figure 9. M24LRxxE_R state transition diagram
1. The M24LRxxE_R returns to the Power Off state if the tag is out of the RF field for at least t
Doc ID 023297 Rev 1 11/15
RF_OFF
.
Recommendations when developing the M24LRxxE_R application software AN4125
-36
)/
3$! 3#,
6
##
6
33
M24LRxxE-R
)£#BUS
-ASTER
#N&
27
6
BAT
"ATTERY
2
PULLUP
!PPLICATIONMASTER
2
PULLUP
Application hardware architecture
The application Master should control the I²C bus lines and the power supply line so as to keep full control of the M24LRxxE_R. Figure 10 shows a typical hardware schematic.
Figure 10. Optimal hardware schematic of an M24LRxxE_R application
This type of hardware architecture is optimal in applications where power saving is a key feature (like portable applications supplied from a battery). The supply voltage can be directly delivered to an ultralow power microcontroller (for instance the STM8L, information available from http://www.st.com/mcu/). This implementation makes it possible to keep the application supply current in the 1 µA range (value of the STM8L supply current when in the Active-Alt mode) and:
the application saves power when in the Standby mode, as the battery does not supply
the standby current to the M24LRxxE_R (40 µA) nor the current through the SDA pull­up resistor
the application controls the M24LRxxE_R in a safe mode (the V
the Master only when an I²C request is being processed)
pin is supplied by
CC

2.1.3 An I²C request was interrupted

A Start condition defines the I²C channel as busy until the completion of the I²C command (Stop condition) or until I²C timeout. If for some uncontrolled reason, inadvertent unterminated instructions are sent to the I²C bus, the M24LRxxE-R features a timeout mechanism that automatically resets the I²C logic block.
The I²C busy state is reset either:
by decoding a device select byte different from 1010 XXXXb,
by decoding a Stop condition,
by the completion of the internal write cycle (t
instruction), or
after timeout.
The best way for the I²C bus Master to clear a spurious busy state is to periodically issue a [Start+Stop] sequence.
Note: In noisy applications, ST recommends to implement the “9 Start + 1 Stop” sequence
12/15 Doc ID 023297 Rev 1
described in AN1471 (available from the ST website: www.st.com).
, triggered by a decoded write
W
AN4125 Recommendations when developing the M24LRxxE_R application software

2.2 Issuing a command through the RF channel

Case 1: the M24LRxxE_R is processing an I²C command
If the M24LRxxE_R is processing a command from the I²C channel, no command issued on the RF channel will be executed (the RF command will not provide any response) when the M24LRxxE_R is I²C busy.
The application’s RF software should include an “I²C busy polling loop” (including a timeout as there might not be a response) when issuing an RF command. In this way, the RF command is always correctly executed once the I²C commands under execution are completed.
Case 2: the M24LRxxE_R application is powered on
The first condition for a safe design of an M24LRxxE_R application is that all the sensitive data stored in the M24LRxxE_R memory are protected with RF passwords, so that a spurious RF command could not modify these data.
The second condition for a safe application design is that the application Master fully controls the M24LRxxE_R. We know that, as explained in Section 2.1.2, if the V supplied, and the RF field drops to zero while the M24LRxxE_R is decoding an RF command, then the M24LRxxE_R is reset. This means that the Master has to supply the M24LRxxE_R’s V
pin only during an I²C transfer, and leave the VCC pin floating the rest of
CC
the time (see Figure 10).
pin is not
CC
Depending on the application’s RF data transfer flow, it might also be wise to add a third level of safety:
once an RF session (several commands) is completed, blindly send a Write-sector
Password command with a wrong password value: this will set the internal flag defining the status of the presented password (flag set as “wrong password presented”).
Case 3: the M24LRxxE_R application is not powered
This is the typical case where the application is packed in a box (at the end of the production line) and the data update is performed through RF.
The only condition for a safe application design is that the sensitive data stored in the M24LRxxE_R memory are protected with RF passwords, so that a spurious RF command could not modify these data.

Table 4. M24LRxxE_R status according to command and VCC supply

Command processed
by the M24LRxxE_R
I²C command V
RF command
CC
V
CC
or V
pin status Device status
V
CC
supplied I²C busy state
supplied
= high impedance
CC
The M24LRxxE_R is fully dedicated to RF commands
Doc ID 023297 Rev 1 13/15
Revision history AN4125

3 Revision history

Table 5. Document revision history

Date Revision Changes
15-Jun-2012 1 Initial release.
14/15 Doc ID 023297 Rev 1
AN4125
Please Read Carefully:
Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, modifications or improvements, to this document, and the products and services described herein at any time, without notice.
All ST products are sold pursuant to ST’s terms and conditions of sale.
Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST assumes no liability whatsoever relating to the choice, selection or use of the ST products and services described herein.
No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such third party products or services or any intellectual property contained therein.
UNLESS OTHERWISE SET FORTH IN ST’S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWS OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.
UNLESS EXPRESSLY APPROVED IN WRITING BY TWO AUTHORIZED ST REPRESENTATIVES, ST PRODUCTS ARE NOT RECOMMENDED, AUTHORIZED OR WARRANTED FOR USE IN MILITARY, AIR CRAFT, SPACE, LIFE SAVING, OR LIFE SUSTAINING APPLICATIONS, NOR IN PRODUCTS OR SYSTEMS WHERE FAILURE OR MALFUNCTION MAY RESULT IN PERSONAL INJURY, DEATH, OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE. ST PRODUCTS WHICH ARE NOT SPECIFIED AS "AUTOMOTIVE GRADE" MAY ONLY BE USED IN AUTOMOTIVE APPLICATIONS AT USER’S OWN RISK.
Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall immediately void any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever, any liability of ST.
ST and the ST logo are trademarks or registered trademarks of ST in various countries.
Information in this document supersedes and replaces all information previously supplied.
The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners.
© 2012 STMicroelectronics - All rights reserved
STMicroelectronics group of companies
Australia - Belgium - Brazil - Canada - China - Czech Republic - Finland - France - Germany - Hong Kong - India - Israel - Italy - Japan -
Malaysia - Malta - Morocco - Philippines - Singapore - Spain - Sweden - Switzerland - United Kingdom - United States of America
www.st.com
Doc ID 023297 Rev 1 15/15
Loading...