Getting Started with the DS8113 Smart-Card Analog Interface Evaluation Kit
Abstract: This application note describes the steps necessary to quickly begin using the evaluation (EV) kit for the DS8113 smart-card analog interface. The document explains how to install and configure the kit's hardware and software, and how to create and load applications that can be executed by the on-board MAXQ2000 RISC microcontroller. A simple "Hello World" example is provided, as well as an example using the board's LCD. Also included are a number of functions (C source code included) that demonstrate smart-card transactions.
The DS8113 evaluation (EV) kit provides a convenient, proven platform for evaluating the DS8113 device. The DS8113 is a low-cost, low-power, analog front-end for use in smart-card readers, and is designed for use in all ISO 7816, EMV, and GSM11-11 applications. The DS8113 supports 5V, 3V, and 1.8V smart cards, and provides options for low active-, and stop-mode power consumption.
The DS8113 EV kit board and the supplied JTAG board are shown in Figure 1. The EV kit board contains a DS8113 and a MAXQ2000 microcontroller that can be programmed to provide a complete EMV smart-card interface. The software library functions for this interface are available either on the CD_ROM provided with the kit or available for download free from the Maxim web site in the file AN4200_sw.zip. The kit board also contains a smart-card socket and a two-line by 20-character LCD module.
Figure 1. DS8113 Evaluation Kit and JTAG boards.
This application note describes how to get started quickly with this EV kit, and how to compile and run application code on this hardware. Three applications are provided: a simple "Hello World" program, a demonstration of the LCD module, and a group of smart-card functions representative of real-world payment terminal transactions. The C source code for all applications is provided.
The DS8113 device is designed to interface between a system microcontroller and a smart card, providing all the power supply, ESD protection, and level shifting required for IC card applications. The DS8113 is a dual-supply device that operates with VDD in the range of 2.7V to 6.0V and VDDA that must be connected to 5.0V to 6.0V to provide the supply voltage for the smart card. The DS8113 produces smart-card supply voltages of 1.8V, 3.0V, or 5.0V. Communication with a microcontroller is provided through dedicated pins on the DS8113 connected directly to the processor's standard input/output (I/0) pins.
For this application note, Maxim's Microcontroller Tool Kit (MTK) and the Rowley CrossWorks C Compiler and Integrated Development Environment (IDE) will be used. Both programs should be installed on the PC. The MTK is included on the DS8113 EV kit disk or is available for download from the Maxim web site. Free for 30-days, a full-function copy of the Rowley tool set can be downloaded from their web site as described below. Instructions for installing these applications follow. If either, or both, of these applications is already installed on the PC, the section(s) describing their installation can be ignored.
Installing the Microcontroller Tool Kit (MTK)
- Insert the DS8113 EV kit CD into your computer's CD-ROM drive. The CD will autoboot and display the DS8113 EV kit main screen. If the CD does not autoboot, browse the CD's root folder and double-click on the index.html file.
- From the CD's main page, click on the DS8113/MAXQ2000 Evaluation Kit Information heading, and then MTK. Select Run when prompted, and this will initiate installation. Follow the on-screen instructions to complete the process.
- During the MTK installation, select the default settings. Note that security warnings may appear, depending on your web browser security settings and your version of Windows®. If this does occur, simply acknowledge the warning, and proceed with the installation.
Installing Rowley Associates' CrossWorks for MAXQ
Rowley Associates provides a fully functional version of CrossWorks for MAXQ® microcontrollers with a 30-day evaluation license. This software can be downloaded from the Rowley Associates' web site. Follow the instructions during installation. Choose the defaults for installation location and other options. You will need to obtain a 30-day product activation key from Rowley Associates by email before proceeding; follow the instructions on Rowley Associates' web site under "Support: Evaluating CrossWorks."
Further information on setting up, developing, and debugging programs using this tool set is available in application note 3698, "Getting Started with Rowley CrossWorks and the MAXQ2000 Evaluation Kit."
Several actions are necessary to configure the DS8113 EV kit board for loading the provided applications. The board's jumpers must be properly set. The JTAG debug interface board must be connected to the EV kit board with the JTAG board's serial port connected to the PC. Finally, power must be applied to both boards. These steps are detailed below.
- Connect jumpers 1 through 9, as described in Table 1. The locations and jumper positions are illustrated in Figure 2. Note that in this figure, the location of pin 1 of the jumpers and connectors is identified with a darkened circle.
- Connect the JTAG board to the EV kit board using the supplied 10-conductor ribbon cable. Be sure to note the polarity of the connections. On the JTAG board, pin 1 of the JTAG connector, P2, is located on the bottom-right when the board is oriented component-side up with the DB-9 connector on the left. On the EV kit board, pin 1 of the JTAG connector, J2, is located on the top-left, as shown in Figure 2 by the darkened pin. The side of the ribbon cable with the red stripe should be connected to the same pin of the JTAG connector on both boards. Figure 1 shows the proper configuration of the two boards.
- Connect one end of the supplied serial cable to the JTAG board's DB-9 connector, J1, and the other end to the COM port of your PC.
- Connect the 5V, regulated (±5%), 300mA, 2.5mm center positive power supply included with the EV kit to the JTAG board's power connector, J2. Be certain that jumper JH3 on the JTAG board is installed. This supplies 5V power from the JTAG board to the EV kit board over the JTAG ribbon cable. Note that the other two jumpers of the JTAG board (i.e., JH1 and JH2) should also be installed.
Figure 2. DS8113 board jumper locations.
Table 1. DS8113 EV Kit Board Jumper Settings
||DS8113's VCC connected to smart-card socket, C1 pin
||Installed: connect pins 1 and 2
||DS8113's PRES pin pulled high (3.3V) through 10kΩ resistor
||Installed: connect pins 2 and 3
||Smart-card socket's S2 pin connected to ground
||Installed: connect pins 2 and 3
||Board's VDDA source connected to DS8113's VDDA pin
||DS8113's VUP pin is unused
||Installed: connect pins 2 and 3
||Board's 5V source selected as board's VDDA
||Board's VDDA source connected to DS8113's VDDA pin
||Installed: connect pins 2 and 3
||Board's 3.3V source selected as DS8113's VDD
||Board's VDD source connected to DS8113's VDD pin
Loading an Executable File
We will now load an executable file into the MAXQ2000 processor's 32K word (16-bit) program memory and then run the program. The three application programs written for the DS8113 EV kit hardware are available on the kit's CD-ROM compressed into a file named an4200_sw.zip. If the kit's CD-ROM is not convenient, this file can also be downloaded from the Maxim web site. Before continuing, a directory "\DS8113" should be created on the computer's C: drive; all of the files contained in the .ZIP should be extracted to this directory. The extracted files will include the source code, the necessary header files, hex load files, and the CrossWorks project files. By placing these files in this specific directory, the software tools have a known location in which to find the files. Otherwise, the project files would need to be updated to indicate the new location.
The first program that we will load is the "Hello World" application. There are two convenient ways to load a program from the PC into the MAXQ2000's memory so that it can be executed: the MTK and the Rowley CrossWorks tool set. You can use the MTK program to load a HEX file. This approach is described in the Quick Start Guide included with the EV kit. The following steps describe how to use the Rowley CrossWorks tool set to load the program.
- Start CrossWorks MAXQ1.1 CrossStudio as described earlier.
- Click File, then Open Solution. Navigate to the C:\DS8113 directory, select the file "HelloWorld.hzp", and click Open. This will open the Hello World project. This project file contains complete information necessary for the tool set to build the application.
- Make certain that power is applied to the JTAG board (and hence the DS8113 EV kit board) and that the kit board's power switch (SW5) is in the ON position (lever toward DB-9 connector). Right-click on the Maxim Serial JTAG Adapter selection in the Targets window, and then Connect. When connected, the "Maxim Serial JTAG Adapter" text will be in bold font.
- Click Build, then Build and Run. The output log at the bottom of the screen will show the progress as the program is built. When complete, the log will indicate that the program was loaded and verified, as shown in Figure 3.
- Right-click on Maxim Serial JTAG Adapter in the Targets window, and then Disconnect (or click on the Disconnect icon).
- The application program has now been loaded into the board. Remove power from the JTAG and the EV kit boards, and disconnect the JTAG ribbon cable ribbon from the EV kit board. CrossWorks can also be closed as it will not be used in the next step.
More detailed image (PDF, 122.4kB)
Figure 3. CrossStudio screen after the "HelloWorld" project file is loaded.
Running the Hello World Program
The Hello World program sends a message to the serial port when it is executed. We can use MTK to receive and display this message on the PC screen. Follow these steps to run the program.
- Remove the RS-232 cable from the JTAG board, and plug it into the DB-9 connector, J3, of the DS8113 EV kit board.
- Locate and run the MTK program. When the "Select device" window appears (Figure 4), select Dumb Terminal and click OK.
- At the top of the main MTK window, click Options and then Configure Serial Port. Select the PC's com port to which the RS-232 cable is connected (e.g., COM1). Select the speed of 115200, and click OK.
- Now select Target and Open COMx at 115200 baud, where x is the com port number.
- Finally, connect 5V power directly to the EV kit board at J1, and toggle the power switch, SW5, toward the DB-9 connector to apply power to the board. The MTK screen should display the "Hello DS8113 World!" message shown in Figure 5. Powering the board OFF and then ON with the power switch will cause the processor to reset, the program to restart, and the message to be displayed again.
Figure 4. Select device.
Figure 5. Output screen.
EV Kit LCD Module
We will now run a program to display a message on the EV kit's 2-line by 20-character Liquid Crystal Display (LCD). Before beginning, however, we must set the LCD contrast adjustment, so that the message is displayed appropriately when the program is executed. First, apply power to the board. (Note that the LCD may be blank or may display some black rectangles in individual character positions.) Locate the LCD bias resistor, R4, on the board (see Figure 2 above). Using a small screwdriver, adjust the resistor until individual 5 x 7 dot blocks appear in the display. Slowly adjust R7 until the blocks just disappear. This sets the LCD's contrast so that the characters will be visible, but spaces will not.
Reconnect the JTAG board and power to the kit board following steps 2 through 4 of the Hardware Setup section above. Follow steps 1 through 4 of the Loading an Executable File section above to load the LCD demonstration program into the MAXQ2000's program memory. Since the serial port is not used by this application, it is not necessary to disconnect the JTAG interface and the RS-232 cable, as described in steps 5 and 6. In step 2, select the file LCD_8113.hzp. After completing step 4, the new demo program has been loaded and run. The message is now displayed on the LCD.
As a final demonstration, we will now load and run an application that performs transactions involving a smart card. Basic credit and debit transactions are implemented along with a smart-card initialization function. While no attempt was made to include any security measures normally associated with a real payment transaction system, the functionality demonstrated here is representative of such a system.
This transaction example implements and properly manages the sending and receiving of Application Protocol Data Units (APDUs), as defined in the EMV specifications, to the ACOS3 smart card supplied in the DS8113 EV kit. By manipulating and sending the appropriate APDUs and by handling their potential response(s), the actions representing a typical payment transaction are demonstrated.
To create a representative group of transaction functions, three primary smart-card operations are implemented in this example.
A fictitious initial balance of $100.00 is stored in the card, and the initial transaction count is set to 1 during the initialization transaction. To simplify the example, a fixed amount of $10.00 is added to, or deducted from, the card's balance for either a credit or debit transaction.
- A debit transaction, where an amount is deducted from the card's balance
- A credit transaction, where an amount is added to the card's balance
- A card initialization transaction, where the card's balance and transaction count are set to initial values
Follow steps 1 through 6 of the section Loading an Executable File above to load the smart-card transaction demonstration program into the EV kit board. In step 2, select the file Transaction_8113.hzp. After completing step 6, remove the RS-232 cable from the JTAG board, and plug it into the kit board's serial connector, J3. Start the MTK program, and select the device Dumb Terminal. Click Target, and select Open COMx at 115200 baud. Now apply 5V power directly to the kit, turn-on the power switch (toward DB-9 connector), and follow the instructions on the LCD to complete the desired transaction. The MTK screen will display the program's RS-232 serial output. This information is for analysis and debug, and can be ignored. If desired, however, the application's source code can be analyzed to determine the meaning of the serial output.
The DS8113 smart-card interface device is a low-cost, analog front-end for a smart-card reader, designed for all ISO 7816, EMV, and GSM11-11 applications. The DS8113 supports 5V, 3V, and 1.8V smart cards, and provides options for low active-, and stop-mode power consumption with as little as 10nA stop-mode current. The DS8113 EV kit provides a convenient, proven platform for evaluating the DS8113 smart-card interface.
This article describes the steps necessary to quickly begin using the DS8113 EV kit. The article explains how to install and configure the software, configure the hardware, and create and load applications that can be executed by the on-board MAXQ2000 RISC microcontroller. A simple "Hello World" example is provided, along with a demonstration of the board's LCD and a demonstration of smart-card transactions representative of a real-world payment system. The C source code for each of the three applications is provided, and the smart-card functions are based on a library of EMV-type operations.
MAXQ is a registered trademark of Maxim Integrated Products, Inc.
Windows is a registered trademark and registered service mark of Microsoft Corporation.
The content on this webpage is protected by copyright laws of the United States and of foreign countries. For requests to copy this content, contact us.
|© Mar 25, 2008, Maxim Integrated Products, Inc.
APP 4200: Mar 25, 2008
APPLICATION NOTE 4200,