English
Language : 

AN1527 Datasheet, PDF (1/14 Pages) STMicroelectronics – DEVELOPING A USB SMARTCARD READER WITH ST7SCR
AN1527
APPLICATION NOTE
DEVELOPING A USB
SMARTCARD READER WITH ST7SCR
by Microcontroller Division Applications
INTRODUCTION
This document describes a firmware implementation developed by STMicroelectronics for a
USB Smart Card Reader. This firmware is for the ST7SCR microcontroller and can be used
with the associated Smart Card Reader board available from STMicroelectronics.
It is divided into 4 parts:
– Universal Serial Bus (USB) management: This is the USB library which manages the USB
hardware.
– Chip Card Interface Device (CCID) implementation: This contains high level functions for us-
ing the USB in compliance with CCID specifications (messages for Bulk-in, Bulk-out, inter-
rupt and class requests)
– Interface Device (IFD) implementation: This contains high level functions for ISO 7816 spec-
ification implementation and the smartcard-specific command interpreter.
– 7816 UART Smartcard Interface (CRD) management: This contains low level functions for
the hardware management of the 7816 UART Smartcard Interface (CRD).
The main loop polls USB transactions (functions in Ccid_usb.c) using a state machine
process:
– USB_Polling() function from library for USB low level and endpoint 0 management.
– Receive USB Bulk-out message (CCID part).
– Execute the function corresponding to the Bulk-out message (IFD part).
– Send USB interrupt in message (CCID part) if necessary.
– Send USB Bulk-in response (CCID part).
The Bulk-out/in messages are managed by a state machine. When the Bulk-out message re-
ception is completed, the message function is executed and returns only after the completion
of the action to be done in the IFD part. As this may take several 10 ms (e.g. ATR reading), the
response is sent to the host by Bulk-in message. The Bulk-in/out messages are received in
several transactions with a single transaction at every main loop if the USB endpoint is avail-
able.
If there are any interrupt messages, they are sent just before the Bulk-in message is sent.
Specific CCID class requests are managed by the setup management function in the USB li-
brary (USER_USB_setup() function).
AN1527/0702
1/14
1