Raw 2-wire

From DP

Revision as of 01:08, 11 September 2010 by Dpropicweb (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation , search

Contents

Overview

  • Bus: general purpose 2-wire library with bitwise pin control.
  • Connections: two pins (SDA/SCL) and ground.
  • Output type: 3.3volt normal, or open collector (pull-up resistors required).
  • Pull-up resistors: required for open drain output mode (2K – 10K).
  • Maximum voltage: 5.5volts (5volt safe).
  • Last documentation update: v5.6.

The raw 2 wire library is similar to I2C, but it doesn’t handle acknowledge bits and it has bitwise pin control. I2C could be built using the basic elements in the raw2wire library,

Configuration options

Speed - high (~50kHz) and low (~5kHz).

Output type - open drain/open collector (high=Hi-Z, low=ground) , normal (high=3.3volts, low=ground). Use open drain/open collector output types with pull-up resistors for multi-voltage interfacing.

Syntax

A/a/@ Toggle auxiliary pin. Capital “A” sets AUX high, small “a” sets to ground. @ sets aux to input (high impedance mode) and reads the pin value.
D/d Measure voltage on the ADC pin (v1+ hardware only).
W/w Capital ‘W’ enables the on-board power supplies. Small ‘w’ disables them. (v1+ hardware only).
{ or [ Issue I2C-style start condition.
] or } Issue I2C-style stop condition.
r Read one byte. (r:1…255 for bulk reads)
0b Write this binary value. Format is 0b00000000 for a byte, but partial bytes are also fine: 0b1001.
0x Write this HEX value. Format is 0×01. Partial bytes are fine: 0xA. A-F can be lower-case or capital letters.
0-255 Write this decimal value. Any number not preceded by 0x or 0b is interpreted as a decimal value.
, Value delimiter. Use a coma or space to separate numbers. Any combination is fine, no delimiter is required between non-number values: {0xa6,0, 0 16 5 0b111 0xaF}.
& Delay 1uS. (&:1…255 for multiple delays)
(#) Run macro, (0) for macro list
Bitwise
^ Send one clock tick. (^:1…255 for multiple clock ticks)
/ or \ Toggle clock level high (/) and low (\). Includes clock delay (100uS).
- or _ Toggle data state high (-) and low (_). Includes data setup delay (20uS).
 ! Read one bit with clock.
. Read data pin state (no clock).

Macro

0 Macro menu
1 ISO7813-3 ATR for smart cards, parses reply bytes.
2 ISO7813-3 parse only (provide your own ATR command).

Connections

Bus Pirate Dir. Circuit Description
MOSI SDA Serial Data
CLK SCL Serial Clock
GND GND Signal Ground