HydraFW binary SMARTCARD mode guide - hydrabus/hydrafw GitHub Wiki
HydraFW binary SMARTCARD mode guide
This guide is updated towards firmware release HydraFW v0.10 and later
This mode allows to control SMARTCARD
- SMARTCARD pins: /VCC=PA5, RST=PA6, CD=PA7, CLK=PA8, TX=PB6
For more details see https://github.com/hydrabus/hydrafw/wiki/HydraFW-SMARTCARD-guide
Commands
Once the SMARTCARD mode has been selected, the following commands are available :
0b00000000
Return to main mode. ReturnsBBIO1
0b00000001
Mode identification. ReturnsCRD1
0b00000010
RST low. Returns0x01
0b00000011
RST high. Returns0x01
0b00000100
Write-then-read (see below)0b00000110
Set CLK prescaler (see below)0b00000111
Set Guard Time (see below)0b01100000
Set SMARTCARD speed0b10000xyz
Configure SMARTCARD port0b11xxxxxx
Binary Auxiliary pins
Command details
0b01100000
)
Set SMARTCARD speed (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.
0b00000100
)
Write-then-read operation (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.
0b00000110
)
Set CLK prescaler (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.
0b00000111
)
Set Guard Time (This commands reads one byte, and sets the guard time value accordingly.
This commands returns 0x01
if successful, 0x00
in case of error.
0b10000xyz
)
Configure SMARTCARD port (This allows to set the following parameters :
x
sets the parity bit (0
= even,1
= odd)y
sets the stop bits (0
(for 0.5 stop bits) or1
(for 1.5 stop bits))z
sets the clock polarity value (0
or1
)
This commands returns 0x01
if successful, 0x00
in case of error.
See https://github.com/hydrabus/hydrafw/wiki/HydraFW-SMARTCARD-guide for more explanation.