HydraFW binary raw wire mode guide - hydrabus/hydrafw GitHub Wiki
HydraFW binary raw-wire mode guide
This guide is updated towards firmware release HydraFW v0.8 Beta and later
This mode allows to control 2-Wire and 3-Wire (called raw-wire)
- 2-Wire pins: CLK=PB3, IO=PB4
- For more details see https://github.com/hydrabus/hydrafw/wiki/HydraFW-2wire-guide
- 3-Wire pins: CLK=PB3, SDI=PB4, SDO=PB5
- For more details see https://github.com/hydrabus/hydrafw/wiki/HydraFW-3wire-guide
Commands
Once the raw-wire mode has been selected, the following commands are available :
0b00000000
Return to main mode. ReturnsBBIO1
0b00000001
Mode identification. ReturnsRAW1
0b00000110
Read byte0b00000111
Read bit0b00001000
Peek input pin0b00001001
Clock tick0b0000101x
Clock low(0) / high(1)0b0000110x
Data low(0) / high(1)0b0001xxxx
Bulk raw-wire transfer0b0010xxxx
Bulk clock ticks0b0011xxxx
Bulk send bits0b01000000
Configure peripherals0b011000xx
Set raw-wire speed0b10000xy0
Configure raw-wire port0b11xxxxxx
Binary Auxiliary pins
Command details
0b00000110
)
Read byte (This command ready a byte on the raw-wire bus, and sends it back to the user.
0b00000111
)
Read bit (This command will send a clock pulse, then return the value of the data line to the user.
0b00001000
)
Peek input pin (This command returns the state of the data line.
0b00001001
)
Clock tick (This command sends a clock pulse on the CLK line. Returns 0x01
once done.
0b0000101x
)
Clock low(0) / high(1) (This commands sets the CLK line low(0) or high(1). Returns 0x01
once done.
0b0000110x
)
Data low(0) / high(1) (This commands sets the data line low(0) or high(1). Returns 0x01
once done.
0b0001xxxx
)
Bulk raw-wire transfer (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 wait for the defined number of bytes, then send a 0x01
(acknowledge).
0b0010xxxx
)
Bulk clock ticks (In this mode, the last 4 bits of the command define the number of clock ticks to send (from 1 to 16) (Command 0b00100000
will send 1 clock tick). Returns 0x01
once done.
0b0011xxxx
)
Bulk send bits (In this mode, the last 4 bits of the command define the number of bits to send (from 1 to 16) (Command 0b00110000
will send 1 bit). Returns 0x01
once done.
0b01000000
)
Configure peripherals (Do nothing (to be defined for future evolution).
Returns 0x01
.
0b011000xx
)
Set raw-wire speed (This command sets the raw-wire device bitrate. The two last bits will select the speed (int bits/sec) within the following list :
0b00
=> 50000b01
=> 500000b10
=> 1000000b11
=> 1000000
This commands returns 0x01
if successful, 0x00
in case of error.
0b1000wxyz
)
Configure raw-wire port (This allows to set the following parameters :
w
sets the pin output (0=open drain, 1=push-pull)x
sets the mode (0=2-wire, 1=3-wire)y
sets the endianness (0=MSB, 1=LSB)z
sets the clock polarity (0=idle low, 1=idle high)
This commands returns 0x01
if successful, 0x00
in case of error.