Using the BusPirate V3 with Mac OSX

First install the FTDI drivers from here

Now you can connect to your bus pirate with screen:

press i to view your firmware version

If your firmware < 6.1, you should update your BusPirate to the latest and greatest version:
press $ and acknowledge with yes to get into the bootloader mode, the green mode led should now be burning
press ctrl + a +k to kill the screen window and flash the new firmware with:

unplug and replug your device and recheck your installed firmware.

press ? to show the help menu
press m to change bus mode
press w/W to disable/enable the builtin powersupply
press v to monitor the voltages
press p/P to disable/enable the builtin pullup resistors
enter (0) to show the macros

If you are unsure how to connect to different bus types, you can find a great reference card here.

In the following I will connect an Invensense MPU-9250 IMU I bought on eBay.

The output should look like this:

m
1. HiZ
2. 1-WIRE
3. UART
4. I2C
5. SPI
6. 2WIRE
7. 3WIRE
8. LCD
x. exit(without change)

(1)>4
Set speed:
1. ~5KHz
2. ~50KHz
3. ~100KHz
4. ~400KHz

(1)>4
Ready
I2C>W
POWER SUPPLIES ON
I2C>(1)
Searching I2C address space. Found devices at:
0xD2(0x69 W) 0xD3(0x69 R)
I2C>

Apparently that means that the sensor is available at address 0xD3 = 1101001+1 for read and at 0xD2 = 1101001+0 for write operations. That is in agreement with the datasheet.

Clear sleep mode bit (6), enable all sensors:
[0xD2 0x6B 0x00]
Read whoami register, should return 0x71:
[0xD2 0x75 [0xD3 r]

For the MPU-9150
[0xD0 0x6B 0x00]
[0xD0 0x75 [0xD1 r]
this should read 0x68

Now we will set up the BusPirate to sniff the i2c communication between a microcontroller and IMU.

This time I just hooked up the sda, scl and ground connection of the BusPirate.
PD0 = SCL = Pin 10 = gelb = BP lila
PD1 = SDA = Pin 9 = orange = BP grau

screen /dev/tty.usbserial* 115200
HiZ>m
1. HiZ
2. 1-WIRE
3. UART
4. I2C
5. SPI
6. 2WIRE
7. 3WIRE
8. LCD
x. exit(without change)

(1)>4
Set speed:
1. ~5KHz
2. ~50KHz
3. ~100KHz
4. ~400KHz

(1)>4
Ready
I2C>(2)
Sniffer
Any key to exit

Another great way to analyze the I2C protocol is to use the Open Logic Sniffer on top of BusPirate.

A nice tutorial on how to setup and use the Open Logic Sniffer with the BusPirate can be found here.

Schreibe einen Kommentar