Benjamin Vernoux edited this page Dec 10, 2018 · 5 revisions

HydraFW SMARTCARD (Smart_card / ISO/IEC_7816)

Bus: Similar to UART (universal asynchronous receiver transmitter) but half duplex.
Connections: Up to 5 pins and ground.
Output types: 1.8volt, 3V & 5V (By default we support only 3v3 else it will requires a shield)
normal output, or open drain
(pull-up/pull-down resistors integrated in MCU or external).
Pull-up resistors: required for open collector output mode (2K – 10K).
Maximum Voltage: 5.5volts (5volt safe).

This guide is updated towards firmware [release HydraFW master commit e93be6c or more]

Protocol configuration syntax description:

  • show Show SMARTCARD parameters or show pins Show pins used in this mode

  • speed with integer baudrate value

    • Baudrate from 1282 and up to 5250000
  • parity with parameter none or even or odd for parity value

  • polarity Clock polarity 0 or 1

  • phase Clock phase 0 or 1

  • stop-bits with parameter 0 (for 0.5 stop bits) or 1 (for 1.5 stop bits)

  • guardtime Guardtime value

  • prescaler Prescaler value

  • exit to exit SMARTCARD mode

Configuration options:

Hardware Informations:

smartcard1> show pins
TX : PB6

Protocol configuration example:

Configuration of SMARTCARD 9600bps 1.5stop, even parity:

> smartcard
Speed: 9600 bps
Parity: even
Stop bits: 1.5
Convention: normal
Prescaler: 12 / 3.50mhz

Protocol interaction syntax description:

trigger configures the trigger mode

r or read Read one byte. (r:1…255 for bulk reads)

hd Read one byte. (hd:1…4294967295 for bulk reads). Displays a hexdump of the result (See Hexdump guide)

w or write Followed by values to write byte(s). (w:1…255 for bulk writes)

0 Write this Octal value. Format is prefixed by a 0 (values from 000 to 077)

0b Write this binary value. Format is 0b00000000 for a byte, but partial bytes are also fine: 0b1001.

0x Write this HEX value. Format is 0x01. Partial bytes are fine: 0xA. A-F can be lower-case or capital letters.

0-255 Write this decimal value. Any number not preceded by 0x, or 0b is interpreted as a decimal value.

" Write an ASCII-encoded string

Write support optional repeat : (eg.: 10:1…255 for repeated write of same value 10 in this example)

space Value delimiter. Use a space to separate numbers/commands. Any combination is fine, delimiter is required between each number/command, Example: 0x1 0xff 0 10 0b11 077

~ Write a random byte (repeat with :)

& Delay 1uS. (&:1…1000000 for multiple delays)

% Delay 1mS. (%:1…1000000 for multiple delays)

query Get OFF port value (card inserted)

atr Read card ATR

[ Toggle RST pin high

] Toggle RST pin low

- Toggle CMDVCC pin high

_ Toggle CMDVCC pin low

Wiring guide

Hydrabus <--> smartcard interface can be connected with the following schema :

3.3v <--> | VCC |       GND | <--> GND
          |-----|     |-----|
PA6  <--> | RST |     |     |
          |-----|     |-----|
PA8  <--> | CLK |     |  IO | <--> PB6
          |-----|     |-----|

CD pin (PA7) is used to connect to the Card Detect pins of a smartcard socket.

Protocol interaction example usage SMARTCARD1 write:

> smartcard 
Speed: 9600 bps
Parity: even
Stop bits: 1.5
Convention: normal
Prescaler: 12 / 3.50mhz
smartcard1> atr
Timing information:
Fi=372, Di=4, 93 cycles/ETU
37634 bits/s at 3.50mhz, 53763 bits/s for fMax=5 MHz)
3B 9F 13 81 B1 80 37 1F  03 80 31 F8 69 4D 54 43  |  ;.....7...1.iMTC 
4F 53 70 02 01 02 81 07  86                       |  OSp...... 

Additional informations about SMARTCARD

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.