Skip to content

HydraFW SMARTCARD guide

Benjamin Vernoux edited this page Mar 26, 2024 · 9 revisions

HydraFW SMARTCARD (Smart_card / ISO/IEC_7816)

This guide is updated towards firmware release HydraFW v0.10

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).

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

  • convention Convention value (0=Normal default, 1=Inverse)

  • exit to exit SMARTCARD mode

Configuration options:

Hardware Informations:

smartcard1> show pins
/VCC: PA5
RST: PA6
CD: PA7
CLK: PA8
TX : PB6

Protocol configuration example:

Configuration of SMARTCARD 9600bps 1.5stop, even parity:

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

Protocol interaction syntax description:

Bus interaction commands

trigger configures the trigger mode

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
          |-----|     |-----|
          |_____|_____|_____|

3.3v (connected to SmartCard VCC) can be connected to PA5 (to Switch ON/OFF SmartCard VCC from MCU)

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

Protocol interaction example usage SMARTCARD1 write:

> smartcard 
Device: SMARTCARD1
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

How to Flash/Use HydraFW

How to Build/Flash/Use HydraFW

Developer Getting-Started with HydraBus and STM32CubeIDE

Hardware

Firmware (hydrafw) performances

Firmware (hydrafw) Application guides

Firmware (hydrafw) guides

How to Help

Clone this wiki locally