2WIRE mode with bitwise operators

Wow! Well that happened fast and turned out better than I’d hoped.

The latest firmware includes 2WIRE mode:

  • Bidirectional 2 wire bus with open drain outputs (needs pull-up resistors)
  • [ and ] generate I2C-style start and stop sequences
  • { and } control the RST pin, which is frequently used in 2 wire busses (e.g. SLE4442 IC card)
  • Bitwise operators: / \ (clock high, low) -_ (data high, low) and . (read data pin)
  • Macro (1) performs an ISO 7816-3 Answer to Reset for IC cards, and decodes the result (currently SLE44xx cards only, SIMs and more to come soon)

This is the first mode to have bitwise operators. In the Bus Pirate v3 we could only manipulate pins individually in software bit-banged protocols. However, BP5 2WIRE is all done with precise hardware timing.

To manipulate the individual pins, the firmware creates PIO assembly instructions on the fly. This requires reading the state of unmanipulated pins and programming it into the instruction so we only change the desired pin. The instruction is then shoved in the FIFO and the PIO executes it. This is REALLY slick!

Now I’m going to take it for a spin with a SLE4442 IC card. I really really want to try to glitch hack it, but first I need to figure out how it works.