-
Notifications
You must be signed in to change notification settings - Fork 92
HydraFW binary UART mode guide
This guide is updated towards firmware release HydraFW v0.9 Beta and later
Default STM32 UART used is uart2 see https://github.com/hydrabus/hydrafw/wiki/HydraFW-UART-guide#configuration-options for more details not anymore since 463bfc5ad230e4a73c32aed6a726dd4c74997364 (it is now UART1 by default)
This mode allows to control UART1 or UART2
- UART1 pins: TX=PA9, RX=PA10
- UART2 pins: TX=PA2, RX=PA3
For more details see https://github.com/hydrabus/hydrafw/wiki/HydraFW-UART-guide
Once the UART mode has been selected, the following commands are available :
-
0b00000000
Return to main mode. ReturnsBBIO1
-
0b00000001
Mode identification. ReturnsART1
-
0b00000010
Start echo UART RX -
0b00000011
Stop echo UART RX -
0b00000111
Manual baud rate -
0b0001xxxx
Bulk UART transfer -
0b0110xxxx
Set UART speed -
0b1000xx00
Configure UART port (see below) -
0b11xxxxxx
Binary Auxiliary pins
Once the local echo is started, each received byte on the UART will be sent to the user. Local echo is stopped by default.
Returns 0x01
This mode differs from the Bus Pirate.
This command takes 4 bytes, containing the desired baud rate value (big-endian). If the selected baud rate is not possible, the UART will be reset to 9600 bauds.
This commands returns 0x01
if successful, 0x00
in case of error.
In this mode, the last 4 bits of the command define the number of bytes to write (from 1 to 16) (Command 0b00010000
will send 1 byte). Hydrabus will read the defined number of bytes, send a 0x01
(acknowledge) after each read bytes.
This command sets the UART device bitrate. The four last bits will select the speed (int bits/sec) within the following list :
-
0b0000
=> 640 -
0b0001
=> 1200 -
0b0010
=> 2400 -
0b0011
=> 4800 -
0b0100
=> 9600 -
0b0101
=> 19200 -
0b0110
=> 31250 -
0b0111
=> 38400 -
0b1010
=> 115200
This commands returns 0x01
if successful, 0x00
in case of error.
The following value for the `xx``bits configure the following parameters :
-
0b00
=> No parity -
0b01
=> Even parity -
0b10
=> Odd parity
See https://github.com/hydrabus/hydrafw/wiki/HydraFW-UART-guide for explanation.
This commands returns 0x01
if successful, 0x00
in case of error.
This script will enable BBIO UART mode and listen to all incoming bytes
import serial
import os
ser = serial.Serial('/dev/hydrabus', 115200)
for i in xrange(20):
ser.write("\x00")
if "BBIO1" not in ser.read(5):
print "Could not get into bbIO mode"
quit()
print "Into BBIO mode"
print "Switching to UART mode"
ser.write('\x03')
if "ART1" not in ser.read(4):
print "Cannot set UART mode"
quit()
print "Setting speed"
ser.write('\x6a')
if ser.read(1) != '\x01':
print "Error setting speed"
quit()
print "Starting reader"
ser.write('\x02')
if ser.read(1) != '\x01':
print "Error starting reader"
quit()
while 1:
print ser.read(1),
- CHANGELOG
- Console commands
- Binary mode guide
-
NFC/HydraNFC v1 guide
- Read UID of an ISO/IEC_14443 Tag
- Read UID and data of a MIFARE Ultralight Tag
- Read UID of an ISO/IEC 15693 Tag
- Emul ISO14443a Tag
- Emul MIFARE Ultralight Tag
- Emul Mifare Classic Tag
- Unique NFC sniffer design
- Launch NFC sniffer from console
- Sniffer ISO14443A wireshark pcap
- Autonomous/stand-alone sniffer mode
- Sniffer ISO14443A real-time infinite trace mode
- HydraFW-HydraNFC-v1.x-TRF7970A-Tutorial