HydraFW 2wire guide - hydrabus/hydrafw GitHub Wiki

HydraFW Bus 2-wire

This guide is updated towards firmware release HydraFW v0.10 and later

Bus: 2-wire
Connections: two pins (SDA/SCK) and ground
Output types: open drain/open collector
Pull-up resistors: required for open drain output mode (2K – 10K).
Pull-up/down resistors Integrated in MCU: Between 30 to 50K (Typical 40K).
Maximum voltage: 5.5volts (5volt safe)

This is a raw 2-wire communication mode (similar to I2C, but with no ACK handling)

Protocol configuration syntax description:

  • show Show 2-wire parameters or show pins Show pins used in this mode

  • pull with parameter up or down or floating to choose internal MCU pull up/down or no pull/external

  • frequency with floating frequency value: support k (for kHz), m (for MHz) suffix or no suffix (for Hz)

    • Frequencies available: up to 1MHz
  • polarity to select the clock idle level (0 or 1)

  • msb-first or lsb-first to send/receive respectively MSB first or LSB first.

  • exit to exit 2-wire mode

Note default value: 
    > 2-wire
    Device: twowire1
    GPIO resistor: floating
    Frequency: 1000000Hz
    Bit order: MSB first

Configuration options:

Hardware Informations:

twowire1> show pins 
CLK: PB3
IO: PB4

Protocol configuration example:

Configuration of twowire1 500KHz:

> 2-wire 
Device: twowire1
Frequency : 1000000Hz
twowire1> frequency 500k show 
Device: twowire1
Frequency : 500000Hz

SWD interaction

2-wire is also used to implement SWD protocol. From the CLI, two commands are available for SWD discovery :

  • idcode will send a JTAG-to-SWD reset, then query the SWD debug port IDR.
  • brute <integer> is used to discover SWD interfaces on unknown devices.
    • Perform a SWD enumeration on x pins (PB0 up to PB11) with x from 2 to 11

Once identified, the SWD interface can be used using OpenOCD mode

Protocol interaction syntax description:

Bus interaction commands

trigger configures the trigger mode

Protocol interaction example usage twowire1 write/read:

twowire1> 0x01 0x02 ~ r 0x00:4
WRITE: 0x01 0x02 0xFF 
READ: 0xFF
WRITE: 0x00 0x00 0x00 0x00 

Additional informations about 2-wire

For more information about its usage, see : http://dangerousprototypes.com/docs/Raw_2-wire

⚠️ **GitHub.com Fallback** ⚠️