dm00123114

UM1795
User manual
EVAL-ST95HF firmware functionalities
Introduction
This document describes the firmware functionalities of the EVAL-ST95HF board
(STSW-ST95HF001). It has the goal of helping the user to understand how this firmware
works, by describing the main functionalities with simple examples.
The ST95HF is an RFID transceiver. It supports ISO/IEC 14443A, ISO/IEC 14443B,
ISO/IEC 15693 and ISO/IEC 18092 in reader mode (PCD). It also supports ISO/IEC 14443A
in card emulation mode (PICC).
The MCU of the EVAL-ST95HF is the STM32F103. The ST95HF, together with the
microcontroller, emulates a PCD or a PICC. The MCU communicates with the ST95HF by
SPI bus.
The application is divided in three parts, one for PCD functions (read or write tags), one for
PICC functions (tag emulation, file transfer) and one for peer to peer functions.
The application has the capability to read and write TT1, TT2, TT3, TT4A, TT4B and vicinity
card. It can also emulate TT2 and TT4A tags for the storage of NDEF messages.
June 2014
DocID026602 Rev 1
1/19
www.st.com
Contents
UM1795
Contents
1
2
3
Acronyms and notational conventions . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.1
Acronyms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2
Representation of numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.1
ST95HF overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2
STM32F103 overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3
EVAL-ST95HF board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Firmware description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.1
The main menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2
Tag reader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2.1
Tag Hunting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.2.2
Tag reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.2.3
PC link mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.3
Tag writer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.4
Tag emulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.5
Card Emulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.5.1
3.6
4
2/19
File transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Proprietary Peer to Peer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.6.1
Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.6.2
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.6.3
How it works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
DocID026602 Rev 1
UM1795
List of tables
List of tables
Table 1.
Table 2.
Supported operation modes and functionalities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
DocID026602 Rev 1
3/19
3
List of figures
UM1795
List of figures
Figure 1.
Figure 2.
Figure 3.
Figure 4.
Figure 5.
Figure 6.
Figure 7.
Figure 8.
Figure 9.
Figure 10.
Figure 11.
Figure 12.
Figure 13.
4/19
Functional block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
EVAL ST95HF board (front side) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
EVAL ST95HF board (back side) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Main menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Tag reader menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Example of tags found . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Reading tags. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Board linked to a PC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Tag writer mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Emulator mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
File transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
P2P mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Tennis game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
DocID026602 Rev 1
UM1795
Acronyms and notational conventions
1
Acronyms and notational conventions
1.1
Acronyms
1.2
•
APB: Advanced Peripheral Bus
•
AAR: Android Application record
•
CAN: Controller Area Network
•
GPS: Global Positioning System
•
IEC: International Electrotechnical Commission
•
I²C: Inter-Integrated Circuit
•
ISO: International Organization for Standardization
•
MCU: Micro Controller Unit
•
NFC: Near Field Communication
•
RF: Radio Frequency
•
RFID: Radio Frequency Identification
•
RISC: Reduced Instruction Set Computer
•
SPI: Serial Peripheral Interface
•
USB: Universal Serial Bus
Representation of numbers
The following conventions and notations apply in this document unless otherwise stated:
Binary numbers
Binary numbers are represented by strings of digits 0 and 1 shown with the most significant
bit (MSB) on the left, the least significant bit (LSB) on the right, and a “0b” added at the
beginning.
Example: 0b11110101.
Hexadecimal numbers
Hexadecimal numbers are represented by using the numbers 0 to 9 and the characters A –
F, and adding an “0x” at the beginning. The Most Significant Byte (MSB) is shown on the left
and the Least Significant Byte (LSB) on the right.
Example: 0xF5.
Decimal numbers
Decimal numbers are represented as is without any trailing character.
Example: 245.
DocID026602 Rev 1
5/19
18
Overview
UM1795
2
Overview
2.1
ST95HF overview
ST95HF is a transceiver for contactless application. It includes frame coding and RF
modulation, thus allowing the connected MCU to send and receive NFC commands in the
supported protocols.
ST95HF is a slave device, hence an host (MCU) is required to control it.
The ST95HF is connected to the MCU using an SPI communication. The ST95HF is able to
act as a PCD or a PICC so it can interact with a tag or with a reader, as exemplified in
Figure 1.
Figure 1. Functional block diagram
6PDUWSKRQH
5)UHDGHU
&RPPDQGWR
67+)
0&8
63,UHDGHU
67+)
67+)
UHVSRQVH
1)&
7$*6
069
For more details concerning the ST95HF device, please refer to its datasheet.
2.2
STM32F103 overview
The STM32F103xx incorporates the high-performance ARM® Cortex®-M3 32-bit RISC core
operating at a 72 MHz frequency, high-speed embedded memories (Flash memory up to 1
Mbyte and SRAM up to 96 Kbytes), and an extensive range of enhanced I/Os and
peripherals connected to two APB buses. All devices offer two 12-bit ADCs, three general
purpose 16-bit timers plus one PWM timer, as well as standard and advanced
communication interfaces: up to two I2Cs and SPIs, three USARTs, an USB and a CAN.
These features make the STM32F103xx microcontrollers suitable for a wide range of
applications such as motor drives, application control, medical and handheld equipment, PC
and gaming peripherals, GPS platforms, industrial applications, PLCs, inverters, printers,
scanners, alarm systems, video intercoms, and HVACs.
6/19
DocID026602 Rev 1
UM1795
2.3
Overview
EVAL-ST95HF board
The EVAL-ST95HF is a kit which allows to evaluate the ST95HF transceiver performance.
The EVAL-ST95HF is powered through the USB bus and no external power supply is
required. It includes a ST95HF, a 47x34 mm 13.56 MHz simple layer inductive etched
antenna and its associated tuning components.
By default, the ST95HF communicates with the STM32F103RG 32-bit MCU via the SPI bus.
Pictures of the board are shown in Figure 2 and Figure 3.
Figure 2. EVAL ST95HF board (front side)
Figure 3. EVAL ST95HF board (back side)
DocID026602 Rev 1
7/19
18
Firmware description
3
UM1795
Firmware description
The ST95HF component can act both as a PCD or as a PICC.
The main purpose of the firmware is to show all of these available functionalities.
Accordingly, the menu is divided in three parts, one for PCD functions, one for PICC
functions and the last one for Peer to Peer functions.
Note:
In order to test the Peer to Peer mode it is necessary to have two ST95HF boards. All the
other functions can be tested with an NFC phone, a tag or another ST95HF board.
3.1
The main menu
The main menu is made up of icons allowing access to different sub menus. As can be seen
from Figure 4, they are disposed in three lines in order to easily identify the active mode.
Figure 4. Main menu
The main functionalities associated with each operation mode are listed in Table 1.
8/19
DocID026602 Rev 1
UM1795
Firmware description
Table 1. Supported operation modes and functionalities
Mode
Functionalities
PCD
PICC
Tag reader:
– Tag hunting
– Tag reading
– PC link mode
Tag writer:
– TEXT
– GEO
– ...
Tag Emulator:
– TT2
– TT4A
Card Emulator:
– File transfer
P2P
Proprietary P2P:
– Proprietary P2P Auto
– Proprietary P2P Client
– Proprietary P2P Server
To select a sub menu, move the black square on the icon of your choice using the joystick
and press it to select the item. Every sub menu has a return option in order to return to the
previous menu.
Any menu or sub menu can be rotated using the rotate button, so that it will be possible to
use the board in the other direction. In this case, the joystick too will be adapted (buttons
reversed). It is not possible to rotate the screen when a mode is selected, this is feasible
only inside a menu.
3.2
Tag reader
In this menu there are three different modes, as can be seen from Figure 5.
Figure 5. Tag reader menu
DocID026602 Rev 1
9/19
18
Firmware description
3.2.1
UM1795
Tag Hunting
This mode is used to list all the found tags: when a tag is close enough to the antenna, the
UID and the tag type is written on the screen (see Figure 6).
Note:
If the same tag is re-detected by the tag hunting it will refresh the line (this feature can help
to check the detection range).
Figure 6. Example of tags found
3.2.2
Tag reading
This mode is used to read the NDEF content of a tag. When a tag is close enough to the
antenna, its content is decoded and printed on the screen (see Figure 7).
The reader is able to decode following NDEF messages:
•
Empty
•
URI
•
SMS
•
Email
•
Geo position
•
Text
•
VCARD.
The message can be formatted inside a smart poster in order to add an additional Text field
to the message.
10/19
DocID026602 Rev 1
UM1795
Firmware description
Errors can be printed if there is a transmission error or an error during the decoding of a
message.
Note:
VCARD contains too much information to be printed on the screen, so only a message
“VCARD detected” is shown, however all the decoding is done inside the program.
Note:
The same tag is not read two times in a row.
Figure 7. Reading tags
3.2.3
PC link mode
This mode allows the EVAL-ST95HF to work like the CR95HF board and to be controlled
using the CR95HF_Development_Software (see Figure 8). The computer interacts with the
board using the USB cable.
DocID026602 Rev 1
11/19
18
Firmware description
UM1795
Figure 8. Board linked to a PC
3.3
Tag writer
This mode is used to write an NDEF message to a tag, the first step here is to select the
preformatted message to write. The right column corresponds to the size needed to write
the message (an example is shown in Figure 9).
Then the message can be written by putting the tag close to the antenna. Error messages
can be written to the screen in the following cases:
•
Not enough memory inside the tag: the message cannot be written because the tag
inside the field is too small.
•
Tag locked: the read or write access is not allowed.
•
Transmission error: when the tag is removed before the end of write operation a
transmission error is returned.
Note:
The same tag cannot be written two times in a row.
Note:
The firmware is able to format vicinity card if the tag does not contain any NDEF data but it
will not try to format other tag types.
12/19
DocID026602 Rev 1
UM1795
Firmware description
Figure 9. Tag writer mode
3.4
Tag emulator
In this menu (see Figure 10) it’s possible to select the kind of tag (TT2 or TT4A) to be
emulated and then default content can be chosen.
The memory available is 492 bytes for the TT2, and 7998 bytes for the TT4A. These values
can be changed inside the source code, it’s worth noting that some smartphones do not
support TT2 sizes over 1024 bytes.
DocID026602 Rev 1
13/19
18
Firmware description
UM1795
Figure 10. Emulator mode
Once the content is chosen, the emulation starts, and a PCD (e.g. a smartphone) can read
the content as if it were a classic tag. It is also possible to read the content using another
EVAL-ST95HF in reader mode.
User can write content with the smartphone. When the emulation exits, the content of the
tag is written inside the MCU flash, allowing it to be restored using the “Previous content”
choice.
Note:
If the board is powered off or reset during the emulation, the current content is lost because
the content will be written to the flash only when the emulation is stopped.
3.5
Card Emulator
3.5.1
File transfer
This mode is used to transfer a file from an NFC phone to the EVAL-ST95HF board (see
Figure 11).
In order to do that the phone must have the correct application which supports this
proprietary transfer. When the board is configured in card emulator mode it is seen as a
classic TT4A tag containing an AAR to the correct application.
14/19
DocID026602 Rev 1
UM1795
Firmware description
Figure 11. File transfer
The progress bar will be refreshed during the transfer and at the end of the transfer a CRC
will be calculated in order to check if the file is not corrupted. The elapsed time is written and
the total size of the file sent.
Doing this we can evaluate the speed to transfer a file using ST95HF.
Note:
The result can change between two tries even with the same file and same smartphone as
smartphone data bandwidth is unpredictable (multi task OS).
Note:
The application on the EVAL-ST95HF will not try to interpret the data sent.
3.6
Proprietary Peer to Peer
This is a proprietary peer to peer demonstration between two EVAL-ST95HF boards. It uses
NFC-DEP functions but all data transferred are formatted using a proprietary way.
3.6.1
Initialization
When the menu Peer to Peer is selected a choice between three different initializations is
proposed (see Figure 12):
Prop P2P Auto
If this menu is selected the application will try to find automatically if it acts as the server
(Initiator) or as the client (Target). In order to do that it starts with one random mode
(Initiator/target) and try to find the other within a certain amount of time. If it cannot find
another board it switches his mode and tries again.
Prop P2P Client
This menu is used to force the application to act as the client. It will wait infinitely for a
server.
Prop P2P Server
This menu is used to force the application to act as the server. It will wait infinitely for a
client.
DocID026602 Rev 1
15/19
18
Firmware description
UM1795
Figure 12. P2P mode
3.6.2
Description
As can be seen from Figure 13, the application is a simple tennis game in order to show the
peer to peer communication. When the initialization step is done, one board is defined as
the initiator (Green racket) and the other as the target (Red racket).
Figure 13. Tennis game
The racket can be moved using the up and down buttons of each board. The goal is to avoid
the ball (the white square) hitting the border of the screen. Every time a point is scored, the
player’s score is increased. When the score exceeds 9, it restarts from 0.
16/19
DocID026602 Rev 1
UM1795
Firmware description
The score can be displayed at the top or at the bottom of the screen by pressing the rotate
button from any board. The information is transmitted to the other board using the peer to
peer communication.
The speed of the game can be reduced by pressing the right key of the initiator and
increased by pressing the left key (by default it is set to the maximum speed).
If the transmission is broken by spacing the two boards it will suspend the game and will
restart in the same state when the communication will be reestablished.
3.6.3
How it works
The server manage all the game, including moving the ball with bounces on walls or on
rackets. It works like if the game had a 640x240 screen for the storage of the ball position. It
also deals with the score calculation.
The server is continuously sending data to the client containing the following information:
Score2
Xmsb
Xlsb
Y
ScreenRotated
The Score2 byte contains the score for the client. It is send in order to be printed by the
client on its screen.
The Xmsb and Xlsb bytes are used to store the horizontal position of the ball. The client will
print the ball on its screen only if the coordinate is between 320 and 640 (on its part of the
global screen).
The Y byte contains the vertical coordinate of the ball. It is used also in order to print the ball
at the good position.
The ScreenRotated field is used to know if the server's rotate button has been pressed or
not. It toggles every time the button is pressed, so the other board can know if it has to
update its own screen.
The client answers to this frame by sending back two values::
Racket 2 Y
ScreenRotated2
The Racket 2 Y stores the position of the client’s racket. In fact the server needs it to
compute bounces and to manage scores.
The ScreenRotated2 works like the ScreenRotated parameter but this time it is for the
client’s rotate button.
DocID026602 Rev 1
17/19
18
Revision history
4
UM1795
Revision history
Table 2. Document revision history
18/19
Date
Revision
25-Jun-2014
1
Changes
Initial release.
DocID026602 Rev 1
UM1795
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.
ST PRODUCTS ARE NOT DESIGNED OR AUTHORIZED FOR USE IN: (A) SAFETY CRITICAL APPLICATIONS SUCH AS LIFE
SUPPORTING, ACTIVE IMPLANTED DEVICES OR SYSTEMS WITH PRODUCT FUNCTIONAL SAFETY REQUIREMENTS; (B)
AERONAUTIC APPLICATIONS; (C) AUTOMOTIVE APPLICATIONS OR ENVIRONMENTS, AND/OR (D) AEROSPACE APPLICATIONS
OR ENVIRONMENTS. WHERE ST PRODUCTS ARE NOT DESIGNED FOR SUCH USE, THE PURCHASER SHALL USE PRODUCTS AT
PURCHASER’S SOLE RISK, EVEN IF ST HAS BEEN INFORMED IN WRITING OF SUCH USAGE, UNLESS A PRODUCT IS
EXPRESSLY DESIGNATED BY ST AS BEING INTENDED FOR “AUTOMOTIVE, AUTOMOTIVE SAFETY OR MEDICAL” INDUSTRY
DOMAINS ACCORDING TO ST PRODUCT DESIGN SPECIFICATIONS. PRODUCTS FORMALLY ESCC, QML OR JAN QUALIFIED ARE
DEEMED SUITABLE FOR USE IN AEROSPACE BY THE CORRESPONDING GOVERNMENTAL AGENCY.
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.
© 2014 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
DocID026602 Rev 1
19/19
19