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 :
0b00000000Return to main mode. ReturnsBBIO10b00000001Mode identification. ReturnsCRD10b00000010RST low. Returns0x010b00000011RST high. Returns0x010b00000100Write-then-read (see below)0b00000110Set CLK prescaler (see below)0b00000111Set Guard Time (see below)0b01100000Set SMARTCARD speed0b10000xyzConfigure SMARTCARD port0b11xxxxxxBinary 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 (0b10000xyz)
This allows to set the following parameters :
xsets the parity bit (0= even,1= odd)ysets the stop bits (0(for 0.5 stop bits) or1(for 1.5 stop bits))zsets the clock polarity value (0or1)
This commands returns 0x01 if successful, 0x00 in case of error.
See https://github.com/hydrabus/hydrafw/wiki/HydraFW-SMARTCARD-guide for more explanation.