Skip to content

HydraFW binary SMARTCARD mode guide

Baldanos edited this page Apr 11, 2019 · 9 revisions

HydraFW binary SMARTCARD mode guide

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

Commands

Once the SMARTCARD mode has been selected, the following commands are available :

  • 0b00000000 Return to main mode. Returns BBIO1
  • 0b00000001 Mode identification. Returns CRD1
  • 0b00000010 RST low. Returns 0x01
  • 0b00000011 RST high. Returns 0x01
  • 0b00000100 Write-then-read (see below)
  • 0b00000110 Set CLK prescaler (see below)
  • 0b00000111 Set Guard Time (see below)
  • 0b01100000 Set SMARTCARD speed
  • 0b1000wxyz Configure SMARTCARD port
  • 0b11xxxxxx Binary Auxiliary pins

Command details

Set SMARTCARD speed (0b01100000)

This command sets the SMARTCARD device bitrate. It must be followed by 4 bytes, representing the speed in bauds (little-endian). This commands returns 0x01 if successful, 0x00 in case of error.

Write-then-read operation (0b00000100)

This command is used to send at most 4096 bytes and will read at most 4096 bytes of data. Format :

Byte 1           2          3          4          5         6        ...
|----------|----------|----------|----------|----------|----------|------...
 [command]    [Bytes to write]      [Bytes to read]       [Data to write

The bytes to read/write are in big-endian format. All data will be buffered before being sent to the SMARTCARD. Read data will also be buffered on the Hydrabus. A 0x01 is sent before sending values back to the user.

Set CLK prescaler (0b00000110)

This commands reads one byte, and sets the prescaler accordingly. The following formula allows to calculate the final CLK frequency :

fclk = 42000000/<prescaler_value>

This commands returns 0x01 if successful, 0x00 in case of error.

Set Guard Time (0b00000111)

This commands reads one byte, and sets the guard time value accordingly.

This commands returns 0x01 if successful, 0x00 in case of error.

Configure SMARTCARD port (0b1000wxyz)

This allows to set the following parameters :

  • x sets the parity bit (0 = even, 1 = odd)
  • y sets the stop bits (0 or 1)
  • z sets the clock polarity value (0 or 1)

This commands returns 0x01 if successful, 0x00 in case of error.

See https://github.com/hydrabus/hydrafw/wiki/HydraFW-SMARTCARD-guide for more explanation.

Clone this wiki locally
You can’t perform that action at this time.