-
Notifications
You must be signed in to change notification settings - Fork 92
HydraFW I2C guide
Bus: I2C (Inter-Integrated Circuit)
Connections: two pins (SDA/SCL) and ground
Output types: open drain/open collector
Pull-up resistors: pull-ups always required (2K - 10K ohms)
Pull-up/down resistors Integrated in MCU: Between 30 to 50K (Typical 40K).
Maximum voltage: 5.5volts (5volt safe)
I2C is a common 2-wire bus for low speed interfaces.
This guide is updated towards firmware release HydraFW v0.9 Beta
-
show
Show I2C parameters orshow pins
Show pins used in this mode -
pull
with parameterup
ordown
orfloating
to choose internal MCU pull up/down or no pull/external -
frequency
with floating frequency value (supportk
(for khz),m
(for mhz) suffix or no suffix)- Frequencies available:
50khz
,100khz
,400khz
,1mhz
- Frequencies available:
-
scan
search I2C device(s) from address 0x01 to address 0x77- Note: returned scan hexadecimal value corresponds to 7bits I2C address so it shall be converted to 8bits R or W address before usage.
- Example:
scan
returned value 0x3c shall be converted to 8bits I2C address 0x78(Write) or 0x79(Read) see https://github.com/hydrabus/hydrafw/issues/102
-
exit
to exit I2C mode
Note default value:
> i2c
GPIO resistor: pull-up
Frequency: 100khz (50khz, 400khz, 1mhz)
Hardware Informations:
i2c1> show pins
SCL: PB6
SDA: PB7
Configuration of I2C1 400KHz(using internal MCU pull up):
> i2c
GPIO resistor: pull-up
Frequency: 100khz (50khz, 400khz, 1mhz)
i2c1> frequency 400k show
GPIO resistor: pull-up
Frequency: 400khz (50khz, 100khz, 1mhz)
trigger
configures the trigger mode
start
or [
Send I2C Start or Re-Start condition.
stop
or ]
Send I2C Stop condition.
r
or read
Read one byte, send ACK. (r:1…255 for bulk reads)
hd
Read one byte, send ACK. (hd:1…4294967295 for bulk reads). Displays a hexdump of the result (See Hexdump guide)
w
or write
Followed by values to write byte(s). (w:1…255 for bulk writes)
0
Write this Octal value, check ACK. Format is prefixed by a 0 (values from 000 to 077)
0b
Write this binary value, check ACK. Format is 0b00000000 for a byte, but partial bytes are also fine: 0b1001.
0x
Write this HEX value, check ACK. Format is 0x01. Partial bytes are fine: 0xA. A-F can be lower-case or capital letters.
0-255
Write this decimal value, check ACK. Any number not preceded by 0x or 0b is interpreted as a decimal value.
"
Write an ASCII-encoded string
Write support optional repeat :
(eg.: 10:1…255 for repeated write of same value 10 in this example)
space
Value delimiter.
Use a space to separate numbers/commands.
Any combination is fine, delimiter is required between each number/command, example: [ 0x1 0xff 0 10 0b11 077 ]
&
Delay 1uS. (&:1…1000000 for multiple delays)
%
Delay 1mS. (%:1…1000000 for multiple delays)
~
Write a random byte. (~:10 repeats the same random byte 10 times)
i2c1> [ 0x01 0xFF 0 1 0x80 0x55 0xAA 0xFF 0x11:4 [ 0x00 r:4 ]
I2C START
WRITE: 0x01 ACK 0xFF ACK 0x00 ACK 0x01 ACK 0x80 ACK 0x55 ACK 0xAA ACK 0xFF ACK 0x11 ACK 0x11 ACK 0x11 ACK 0x11 ACK
I2C START
WRITE: 0x00 ACK
READ: 0x00 ACK
READ: 0x00 ACK
READ: 0x00 ACK
READ: 0x00 NACK
I2C STOP
ACK/NACK management is same as BusPirate I2C see chapter ACK/NACK management: http://dangerousprototypes.com/docs/I2C
For more details on I2Cprotocol see: http://en.wikipedia.org/wiki/I%C2%B2C
I2C Pull-up Resistors: It is recommended to use external Pull-Up resistors (for I2C > 100KHz, like 10K for 100Khz and 2.2K for 400KHz/1MHz).
So recommended resistor for I2C is 2.2K.
http://dsscircuits.com/articles/effects-of-varying-i2c-pull-up-resistors
http://www.edn.com/design/analog/4371297/Design-calculations-for-robust-I2C-communications
- 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