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)

Commands

Once the raw-wire mode has been selected, the following commands are available :

  • 0b00000000 Return to main mode. Returns BBIO1
  • 0b00000001 Mode identification. Returns RAW1
  • 0b00000110 Read byte
  • 0b00000111 Read bit
  • 0b00001000 Peek input pin
  • 0b00001001 Clock tick
  • 0b0000101x Clock low(0) / high(1)
  • 0b0000110x Data low(0) / high(1)
  • 0b0001xxxx Bulk raw-wire transfer
  • 0b0010xxxx Bulk clock ticks
  • 0b0011xxxx Bulk send bits
  • 0b01000000 Configure peripherals
  • 0b011000xx Set raw-wire speed
  • 0b10000xy0 Configure raw-wire port
  • 0b11xxxxxx Binary 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 => 5000
  • 0b01 => 50000
  • 0b10 => 100000
  • 0b11 => 1000000

This commands returns 0x01 if successful, 0x00 in case of error.

Configure raw-wire port (0b1000wxyz)

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.