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 :
0b00000000Return to main mode. ReturnsBBIO10b00000001Mode identification. ReturnsRAW10b00000110Read byte0b00000111Read bit0b00001000Peek input pin0b00001001Clock tick0b0000101xClock low(0) / high(1)0b0000110xData low(0) / high(1)0b0001xxxxBulk raw-wire transfer0b0010xxxxBulk clock ticks0b0011xxxxBulk send bits0b01000000Configure peripherals0b011000xxSet raw-wire speed0b10000xy0Configure raw-wire port0b11xxxxxxBinary Auxiliary pins
Command details
Read byte (0b00000110)
This command ready a byte on the raw-wire bus, and sends it back to the user.
Read bit (0b00000111)
This command will send a clock pulse, then return the value of the data line to the user.
Peek input pin (0b00001000)
This command returns the state of the data line.
Clock tick (0b00001001)
This command sends a clock pulse on the CLK line. Returns 0x01 once done.
Clock low(0) / high(1) (0b0000101x)
This commands sets the CLK line low(0) or high(1). Returns 0x01 once done.
Data low(0) / high(1) (0b0000110x)
This commands sets the data line low(0) or high(1). Returns 0x01 once done.
Bulk raw-wire transfer (0b0001xxxx)
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).
Bulk clock ticks (0b0010xxxx)
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.
Bulk send bits (0b0011xxxx)
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.
Configure peripherals (0b01000000)
Do nothing (to be defined for future evolution).
Returns 0x01.
Set raw-wire speed (0b011000xx)
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.
Configure raw-wire port (0b1000wxyz)
This allows to set the following parameters :
wsets the pin output (0=open drain, 1=push-pull)xsets the mode (0=2-wire, 1=3-wire)ysets the endianness (0=MSB, 1=LSB)zsets the clock polarity (0=idle low, 1=idle high)
This commands returns 0x01 if successful, 0x00 in case of error.