AN2271
APPLICATION NOTE
Ekey-Udisk solution
Introduction
This document describes a firmware implementation for an Ekey-Udisk device based on
ST72651.
The software is divided into 3 parts:
●
USB management:
the main USB operations are managed by a USB library with USB
hardware, which is not the focus in this documentation. For further information on this
subject, please refer to the ST7 USB software library documentation.
NAND Flash interface:
this part software is migrated from PFD solution. How to
implement it is not mentioned in this documentation.
Smart Card interface:
this interface is implemented by timer and accords ISO7816-1,
2, 3.
●
●
December 2005
1/8
www.st.com
USB Interface
AN2271
3
USB Interface
This solution uses a USB Composite Device to combine the Ekey and Udisk functions into
one USB device.
The Ekey function uses an HID protocol, and the Udisk function uses a Mass Storage
protocol. Both of these two functions use a Microsoft driver, so when an Ekey-Udisk device
plugs in, Windows2000/XP recognizes one USB composite device comprised of one HID
device and one Mass Storage device. No extra driver is needed.
The USB interface for Udisk is traditional.
The USB interface for Ekey is shown below, and the PC Application Software can use this
data structure to communicate with Ekey through the HID driver.
Report ID (1 Byte)
Message Length (1 Byte)
Data (1-128 Bytes)
Enumerating a USB composite device with HID and a Mass Storage device is listed in the
file
descript.c
According to the HID protocol, PC communication is configured in USER_USB_Setup() in
User_lib.c
Note:
According to the limitation of the HID driver, in order to save time to send data to the device,
PC Application Software should select the correct Report ID based on the Message Length.
9 report types are provided for use with supporting lengths from 0x0f to 0x8f. If necessary,
additional descriptors can be created by modifying these to provide other report types.
Table 1.
Report ID based on message length
ID
1
2
3
4
5
6
7
8
9
Length
0x01~0x0f
0x01~0x1f
0x01~0x2f
0x01~0x3f
0x01~0x4f
0x01~0x5f
0x01~0x6f
0x01~0x7f
0x01~0x8f
Data Length
Data(0x01~0x0f bytes)
Data(0x01~0x1f bytes)
Data(0x01~0x2f bytes)
Data(0x01~0x3f bytes)
Data(0x01~0x4f bytes)
Data(0x01~0x5f bytes)
Data(0x01~0x6f bytes)
Data(0x01~0x7f bytes)
Data(0x01~0x8f bytes)
4/8
AN2271
NAND Flash Interface
4
NAND Flash Interface
This part firmware is migrated from the ST PFD solution, and for related applications, please
refer to the PFD application note.
This NAND Flash Interface provides two partitions where one is the Public Partition and the
other is the password-protected Security Partition.
Two types of NAND Flash (512B/page & 2kB/page) are supported. Other Flash formats can
be supported by modifying software.
5/8