Scan for I2C read and write addresses

i2c-scan

See the latest version in the documentation wiki.

You can find the I2C address for most I2C-compatible chips in the datasheet. But what if you’re working with an unknown chip, a dated chip with no datasheet, or you’re just too lazy to look it up?

The Bus Pirate has a built-in address scanner that checks every possible I2C address for a response. This brute force method is a fast and easy way to see if any chips are responding, and to uncover undocumented access addresses.

i2c-scan-thumbI2C chips respond to a 7bit address, so up to 128 devices can share the same two communication wires. An additional bit of the address determines if the operation is a write to the chip (0), or a read from the chip (1).

We connected the Bus Pirate to the 3EEPROM explorer board. The 7bit base address for the 24LC/AA I2C EEPROM is 101 0000 (0x50 in HEX). It answers at the write address 1010 0000 (0xA0) and the read address 1010 0001 (0xA1).

I2C>(1)<<<I2C search macro
Searching 7bit I2C address space.
Found devices at:
0xA0(0x50 W) 0xA1(0x50 R)
I2C>

Macro 1 in the I2C library runs the address scanner. The scanner displays the raw addresses the chip acknowledged (0xA0, 0xA1), and the 7bit address equivalent (ox50) with write or read bit indicators (W/R). Datasheets usually list the 7bit address, but the 8bit value is more recognizable on a logic analyzer, snooper, debugger, etc.

Free PCB Sunday: Bus Pirate v2a

v2a.iii

We go through a lot of prototype PCBs, and end up with lots of extras that we’ll never use. Every Sunday we give away a few professionally-made PCBs from one of our past or future projects, or a related prototype.

This week we’re giving away two Bus Pirate v2a PCBs, PCB by Seeed Studio. The Bus Pirate v2a was really handy for developing the Bus Pirate v2 series, but the Bus Pirate v2go is really the final revision of the v2 design. The nicest feature of v2a is the power switch, which allows developers to reset the Bus Pirate without messing with the USB cable.

We’re giving away two PCBs this week, just ask for one in the comments. Be sure to use a real e-mail in the address field so we can contact you for shipping info. Some rules after the break.

Don’t forget that today is the last day to rant for free Bus Pirate v3 preview PCBs, check out this post.

Continue reading “Free PCB Sunday: Bus Pirate v2a”

Bus Pirate: Fast upgrades on slow chips

speed-up

See the latest version in the documentation wiki.

The individual PIC chip we used on the Bus Pirate v3 is among those that won’t bootload at 115200bps. Our upgrade recommendation until now has been to bootload firmware at 9600bps, or faster if your PIC will allow.

After working with one of these ‘slow’ chips, we’ve found two methods to connect to the bootloader at full speed:

  1. Connect to the Bus Pirate with the quick programmer utility at 9600bps, then disconnect. Adjust the speed to 115200bps and connect again. This time the slow PIC should respond fine at 115200bps.
  2. We’ve also had success connecting to a slow PIC at 115200bps if we put the bootloader jumper between the PGC and PGD pins while it’s running, and then reset the Bus Pirate from within the terminal with the reset command (#). Disconnect your terminal program and connect with the quick programmer utility at 115200bps. Running correctly at 115200bps before talking to the bootloader seems to nudge slower PICs into the correct timing.

Good luck. If you have a ‘slow’ PIC, please let us know if this helped you upgrade at higher speeds.

Chips: DS1307 I2C real-time clock

cover.450

This is an old version, see the latest version on the documentation wiki.

The DS1307 is a simple, inexpensive I2C real-time clock, it’s somewhat similar to the PCF8563 that was previously demonstrated with the Bus Pirate.

This chip has some nice features. It has internal capacitors on both oscillator pins, the only required external part is a 32.768kHz time-keeping crystal. It also has a backup battery input so it can keep time during power failures. The battery backup also applies to 56byte of general purpose RAM.

Keep reading for a complete DS1307 demo using the Bus Pirate universal serial interface. If you’re not using a Bus Pirate, that’s OK, you can still follow along and get a better understanding of how to implement this chip in your own application.

Continue reading “Chips: DS1307 I2C real-time clock”

Bus Pirate: Repeat command

See the latest version in the documentation wiki.

RAW3WIRE>r:5<<<read 5 bytes (DEC)
READ 0x05 BYTES:
0x00 0x00 0x00 0x00 0x00
RAW3WIRE>r:0x05<<<read 5 bytes (HEX)
READ 0x05 BYTES:
0x00 0x00 0x00 0x00 0x00
RAW3WIRE>r:0b101<<<read 5 bytes (BIN)
READ 0x05 BYTES:
0x00 0x00 0x00 0x00 0x00
RAW3WIRE>

Many Bus Pirate commands can be repeated by adding ‘: ‘ to a command, followed by the number of times to repeat the command. To read five byte, enter r:5, etc. The repeat values can be HEX/DEC/BIN. In the example above we read five bytes each time using a different number format.

RAW3WIRE>0x40:5<<<write 0x40, repeat 5 times
WRITE: 0x40 , 0x05 TIMES
RAW3WIRE>^:5<<<send 5 clock ticks
0x05 CLOCK TICKS
RAW3WIRE>&:5<<<delay 1uS, repeat 5 times
DELAY 0x05uS
RAW3WIRE>

Depending on the bus mode, you can repeat reads, writes, macros, clock ticks, delays, and more. Refer to the Bus Pirate manual for detailed command tables for each mode.

Bus Pirate: 2K pull-up resistor mod

The Bus Pirate v2go shipped with 10K ohm pull-up resistors (R20-23). We modded our Bus Pirate with a 2K pull-up resistor so we don’t need an external resistor to work with 1-Wire devices. Pull-up resistors larger than 2.2K ohms don’t provide enough current for parasitically powered 1-Wire parts. Since we only need the bigger resistor for the 1-Wire protocol, we only replaced the pull-up resistor on the MOSI pin (R23).

Read more about our mod after the break.

Continue reading “Bus Pirate: 2K pull-up resistor mod”

Hack a Day Bus Pirate preorder 2 ships

bpv2go.450

Fan from Seeed Studio just posted this note in the forum:

Hey guys, This is fan from Seeedstudio. I got a good news for you, Bus pirate preorder 2 was ready and started shipping. You should get your preordered product very soon.

Thanks for the update! When you get your Bus Pirate remember to update the firmware, and check the Bus Pirate manual for all the latest demonstrations and updates. Help is always available in our forum.

Bus Pirate: Number formats

hexdecbin

This is an old version, see the latest version on the documentation wiki.

The Bus Pirate terminal interface accepts numbers in three formats: hexadecimal, decimal, and binary. It also displays values in HEX/DEC/BIN and a raw byte format. This short guide explains how to enter number values into the Bus Pirate, and how to adjust the Bus Pirate number display format.

Continue reading “Bus Pirate: Number formats”

Bus Pirate: SLE4442 smart card update

cover

This is an old version, see the latest version on the documentation wiki.

The SLE4442 is a popular smart card with 256bytes of protected EEPROM storage. You can buy blanks to play with for a few dollars, or pick some up at your local copy center. The advantage to buying them is that you’ll know the security code and be able to write to the card.

Hack a Day looked at the SLE4442 using the Bus Pirate, but the article uses v0a hardware and a very early firmware. This is an updated quick guide to reading a SLE4442 with v2go and firmware v2.2+. Refer to the original article for an in depth look at the SLE4442 and its data layout.

Continue readingBus Pirate: SLE4442 smart card update”

Free PCB Sunday: USB RGB color changer

USBRGBPCB

We go through a lot of prototype PCBs, and end up with lots of extras that we’ll never use. Every Sunday we give away a few professionally-made PCBs from one of our past or future projects, or a related prototype.

This is a USB controlled RGB color changing light. Ian did this project at DIY Life, a Weblogs, Inc. site that shut down about a year ago. Someone made some minor modifications to the design and had a bunch of boards produced, we ended up with a pile of the extras. This PCB is as-of-yet untested, you can discuss it in the forum.

We’re giving away two PCBs this week, just ask for one in the comments. Be sure to use a real e-mail in the address field so we can contact you for shipping info. Some rules after the break.

Continue reading “Free PCB Sunday: USB RGB color changer”

Bus Pirate firmware v2.2 roadmap

With Bus Pirate firmware v2.1 out the door, we started thinking about what we wanted to include in v2.2. Here’s our thoughts so far:

  • I2C/SPI EEPROM dump and program macro.
  • I2C hardware slave.
  • I2C sniffer.
  • UART auto baud rate detector.
  • JTAG library integration with bitbang functions, facelift and improvements.
  • Central data struct for syntax variables, keeps a ton of stuff off the stack by not passing commands and repeat values through three or four functions.

Feel free to make requests in the comments, in the forum, or on the SVN tracker.

Continue reading “Bus Pirate firmware v2.2 roadmap”

Fundamental Logic Bus Pirate v1 kit now $20

fl-bp

Fundamental Logic was the first company to offer a Bus Pirate for sale. Their Bus Pirate v1a through-hole kit is currently on sale for $20.  v1a is completely compatible with the latest firmware updates, the main difference between v1a and v2 & v3 is the connection type (serial vs USB) and the pull-up resistors (manual vs software controlled).

If you’re looking for a through-hole Bus Pirate kit, $20 seems like a great deal. Fundamental Logic had good prices on international shipping when we last checked.

Thanks Marc!

Why do you hate the Arduino?

a-a

That’s assuming you do. We’ve noticed a general malaise towards the Arduino and/or Arduino projects in comments at tech blogs. Arduino is to Hack a Day as Knex guns are to Instructables.

What’s the deal? Too many newbies with blinken LEDs? $30 is too much for an AVR with a bootloader? Is it the platform or the projects?

We all know the arguments for the Arduino: it’s an easy and open prototyping platform with free tools and great community support. But why do so many geeks detest the Arduino? Why the hate?

We’ll send a free Bus Pirate v3 PCB to the commenter with the best rant for- or against- the Arduino.

Continue reading “Why do you hate the Arduino?”

Bus Pirate firmware v2.1 released

v21

Bus Pirate firmware v2.1 is a major upgrade that fixes a lot of bugs. With Hack a Day’s second Bus Pirate preorder about to ship, we couldn’t wait any longer to release it.

This version has major fixes to the I2C library, hardware I2C support, new speed options, and improved terminal interface. Thanks to a dedicated translator, we’re also able to release the first Spanish and Italian localized firmware for the Bus Pirate. Download the updated firmware from the Google Code page, check out the change log below.

Do you have any requests for the next firmware version?  What hardware version do you use? How often do you update your firmware?

Continue reading “Bus Pirate firmware v2.1 released”

Bus Pirate HEX/DEC/BIN converter

logic

See the latest version in the documentation wiki.

Converting between hexadecimal, decimal, and binary is a pretty constant activity when you work with a new microchip.

HiZ>=<<<HEX/DEC/BIN converter command
CONVERT (1) >0b1010 <<<convert this value
0x0A <<<HEX equivalent
10<<<DEC equivalent
0b00001010<<<BIN equivalent
HiZ>=<<<HEX/DEC/BIN converter command
CONVERT (1) >0xf
0x0F
15
0b00001111
HiZ>

The latest Bus Pirate nightly firmware compile (v2.1-RC3+) adds a much-needed base conversion command, available in all modes. Press ‘=’ and enter any byte value to see the HEX/DEC/BIN equivalent.

Continue reading “Bus Pirate HEX/DEC/BIN converter”

Hack a Day Bus Pirate preorder 2 update

buspirate-p2-update

Seeed Studio just tweeted an update on Hack a Day’s second Bus Pirate preorder. Looks like they’ll ship in one week:

After long time waiting,we got ICs from Digikey. Now Bus Pirat Preorder 2 just started manufacture,will be ship out within a week.

Check out our Bus Pirate goodies when it arrives.

Thanks Mike! Artwork by Aaron, Creative Commons Attribution 3.0.

Easy infrared UART data link

Here’s an easy way to transfer data with an infrared LED and an infrared remote control demodulator. The example uses an Arduino, but the technique will work with any microcontroller.

IR-UART

The transmitting microcontroller powers an IR LED from a pin configured as a 38KHz pulse-width modulator. Another pin configured as a 2400bps UART switches the IR LED ground pin on and off. This converts the standard UART output into a train of rapidly-blinking light pulses.

The receiver is an IR remote control demodulator connected to a 2400bps UART input pin. The demodulator is specially tuned to detect IR light pulses at 38KHz. It converts the transmission back into a 2400bps UART bitstream.

How would you use a line of sight data link?

Via Make.

Seeed Studio Rainbowduino Carnival contest

rainbowduino-block

Seeed Studio, the team that handles fulfillment of the Bus Pirate, is celebrating the success of their Rainbowduino LED control platform with a design contest. The Rainbowduino can control any LEDs, but it seems to be designed for the 8×8 LED matrix blocks in the picture. The best projects win hardware and Seeed Studio store credit.

Thanks Eric!

Bus Pirate Spanish, Italian translations

bp-es

Project contributor pastus submitted Bus Pirate translations in Spanish and Italian. You can download the localized builds for most hardware versions from the project SVN nightly compiles folder. If you don’t see a build for your language and hardware combination, please request it in the comments.

Most of the Bus Pirate interface text is defined in a single translation file. If you’d like to prepare a translation, or request a specific language, check out the translation/localization thread.